r/Unity3D • u/Silent_Answer7889 • 5d ago
Show-Off Got orbit-to-surface terrain, ocean, and clouds running on a single URP camera without camera stacking or z-fighting
90
Upvotes
r/Unity3D • u/Silent_Answer7889 • 5d ago
7
u/Silent_Answer7889 5d ago
One continuous take in URP Forward+ dropping from an asteroid ring past a 428 km-radius moon and through the clouds onto a 2,000 km-radius planet. It's for a multiplayer survival game I'm working on, and I ended up writing the terrain and ocean together instead of trying to get separate systems to agree on depth and lighting.
Worst part to get right was the clip range. Double-precision coords with a floating origin stopped position jitter, but a 10,000 km far plane against a 1 m near plane still wrecked Unity's directional shadow cascades even with reversed-Z. To stay on one camera, I clamp
farClipPlanedown during culling and shadow fit while keeping a full-rangecullingMatrixso distant bodies don't drop out. Then I swap the real 10,000 km projection back in right before rendering.At 2,000 km radius, GPU terrain and CPU colliders also drifted apart by 0.2 to 0.6 m even though HLSL and Burst ran the same simplex FBM and domain-warp math. Characters would end up floating or stuck in hillsides. Now the CPU height path is mostly just for rough spawn and altitude checks or fallback. Runtime
MeshCollidertiles come from async compute readback, then go back into a GPU buffer so nearby terrain renders straight from the collider vertices.Clouds go into an offscreen target in a RenderGraph pass right before transparents. For the asteroid ring at the start, rock prefabs get split into meshlets once on the CPU, then instances are generated from a hashed grid and their meshlets get culled on the GPU into an indirect draw.
3
u/ProgMeOnPaper 4d ago
That's a definition of "there is always somtheing better that you've done"!
That's really awesome! Over the past few months, I've been spending a lot of time working with URP to create many unique effects for my game, and I felt I had made great progress, but you've motivated me to keep improving.
I wish you the best of luck!
2
u/DapperNurd 5d ago
How long have you been working on this?
2
u/Character-Scale-1040 5d ago
that glowing ring with the asteroids drifting past looks so good
1
u/_norx Indie 5d ago
Wow, looks cool!
1
u/oddwavelab 5d ago
Doing that on a single camera without stacking is super impressive. How are you avoiding the z-fighting between orbit and surface, logarithmic depth or floating origin?
1
u/LockYaw 4d ago
Waohhh awesome, is this going to be an asset?
EDIT: Just found you submitted to the store, I'll be getting it once it's out if I remember!
1
u/EvilBritishGuy 4d ago
This reminds me of Megaton Rainfall but without the Superman powers.
1
u/JaeokPhysics 1d ago
You brought to life what I had only imagined. It's really wonderful.
1
u/SouthgateGames 18h ago
Did you start something like this from scratch, or are there papers or videos that you used to get started and then did the work of solving the problems that came up yourself?
This is incredible work, thanks for sharing! I'm going to have to tread some of this same territory for my own project eventually, and I'm always interested to see how other people are tackling it.
1
u/studiocari 3h ago
what's the end goal? kitten space agency?
1
u/LowerFrequencies 4d ago
A game where I could somehow as realistically as possible just explore space sounds really really pleasing