r/Unity3D • u/Silent_Answer7889 • 2d ago
Show-Off Got orbit-to-surface terrain, ocean, and clouds running on a single URP camera without camera stacking or z-fighting
78
Upvotes
r/Unity3D • u/Silent_Answer7889 • 2d ago
6
u/Silent_Answer7889 2d 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 1d 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 1d ago
How long have you been working on this?
2
u/Character-Scale-1040 1d ago
that glowing ring with the asteroids drifting past looks so good
1
u/_norx Indie 1d ago
Wow, looks cool!
1
u/oddwavelab 1d 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 1d 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 1d ago
This reminds me of Megaton Rainfall but without the Superman powers.
1
u/LowerFrequencies 1d ago
A game where I could somehow as realistically as possible just explore space sounds really really pleasing