The nebula patch reads gravity from the R32 surface height, not a half-float copy

Patch Displacement no longer culls layer 9; cloudDensity adds the surface displacement to the patch-only displacement.
GravityFieldParityVerify wiring checks the camera. Neither commit has been built when this is written.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-15 17:45:57 +02:00
commit 3b039d069b
4 changed files with 16 additions and 3 deletions

View file

@ -1,5 +1,5 @@
// Draws the zone's gravity: depth = -Zone.GetHeight at the world xz of every texel, into whichever gravity camera culls
// layer 9 (Surface Displacement, Patch Displacement, Slime Gravity, both Map Gravity). One quad covers the zone; the
// layer 9 (Surface Displacement, Slime Gravity, both Map Gravity). One quad covers the zone; the
// law lives in Gravity.cginc, which mirrors ServerShared's GravityField.
Shader "Brushes/Gravity Field" {
Category {

View file

@ -97,7 +97,9 @@ float cloudDensity(float3 pos, float surfaceDisp)
float2 uv = getUV(pos.xz);
const float dist = pos.y + surfaceDisp - _NebulaFloorOffset;
const float patch = tex2Dlod(_NebulaPatch, half4(uv, 0, 0)).r;
const float patchDisp = tex2Dlod(_NebulaPatchHeight, half4(uv, 0, 0)).r;
// Gravity comes from the R32 surface height the caller sampled at this uv; the patch texture carries only the patch
// layers (sector waves, patch brushes), small enough for half floats.
const float patchDisp = surfaceDisp + tex2Dlod(_NebulaPatchHeight, half4(uv, 0, 0)).r;
const float patchDensity = saturate((-abs(pos.y+patchDisp - _NebulaFloorOffset)+patch)/_NebulaPatchBlend)*_NebulaPatchDensity;
const float floorDist = -dist;