Aetheria/Assets/Shaders/Brushes/GravityField.shader
Meta Vens 3a5b3b0bab Gravity grid-lowering: the drawn height is one Gravity Field pass over the zone's wells; gravity brushes and brush inputs deleted
Zone.WellReference owns each body's reference zero (GetHeight uses it). Gravity.cginc mirrors GravityField.Potential;
Brushes/Gravity Field draws depth = -h on layer 9 from a StructuredBuffer that GravityLowering.Lower fills from the
zone each frame; GravityLowering.CreateField makes the one quad. GravityFieldParityVerify renders it and compares every
texel with -Zone.GetHeight (max error 0.0059 u), the gradient with GetForce (0.03 degrees) and the wiring.

Deleted: the Gravity Well children of Planet, Gas Giant, Sun and PlanetOutpost prefabs, Wormhole 1's three gravity
children, their overrides in Main Menu and TestScene, five wormhole/wave materials and two brush shaders,
Planet.GravityWellDepth/Radius, BodyData keys 6-7, PlanetSettings.GravityDepth/GravityRadius (and the Settings.asset
keys). Surface Displacement culls layer 9 only. Headless build and tests not yet run at this commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 07:11:25 +02:00

47 lines
1.1 KiB
Text

// 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
// law lives in Gravity.cginc, which mirrors ServerShared's GravityField.
Shader "Brushes/Gravity Field" {
Category {
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" }
Blend One One
ColorMask RGB
Cull Off Lighting Off ZWrite Off
SubShader {
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma target 4.5
#include "UnityCG.cginc"
#include "../Gravity.cginc"
struct appdata_t {
float4 vertex : POSITION;
};
struct v2f {
float4 vertex : SV_POSITION;
float2 world : TEXCOORD0;
};
v2f vert (appdata_t v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.world = mul(unity_ObjectToWorld, v.vertex).xz;
return o;
}
float4 frag (v2f i) : SV_Target
{
return (-gravityHeight(i.world)).xxxx;
}
ENDCG
}
}
}
}