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>
This commit is contained in:
parent
c4dfd905ff
commit
3a5b3b0bab
42 changed files with 504 additions and 1301 deletions
|
|
@ -13,8 +13,6 @@ using static CultMath.math;
|
|||
[Serializable, MessagePackObject(keyAsPropertyName:true), JsonObject]
|
||||
public class PlanetSettings
|
||||
{
|
||||
public ExponentialCurve GravityDepth;
|
||||
public ExponentialCurve GravityRadius;
|
||||
public ExponentialCurve LightRadius;
|
||||
public ExponentialCurve BodyRadius;
|
||||
|
||||
|
|
|
|||
|
|
@ -612,14 +612,17 @@ public class Zone
|
|||
return security;
|
||||
}
|
||||
|
||||
// The potential of a body's well at the zone's edge, subtracted so every well is zero there: the one owner of the
|
||||
// reference. GetHeight sums with it and the renderer's lowering (GravityLowering) hands it to the shader unchanged.
|
||||
public float WellReference(Planet body) => GravityField.Potential(body.WellStrength, body.CoreRadius, Pack.Radius);
|
||||
|
||||
public float GetHeight(float2 position)
|
||||
{
|
||||
var result = 0f;
|
||||
foreach (var body in PlanetInstances.Values)
|
||||
{
|
||||
var offset = position - body.Orbit.Position;
|
||||
result += GravityField.Potential(body.WellStrength, body.CoreRadius, length(offset))
|
||||
- GravityField.Potential(body.WellStrength, body.CoreRadius, Pack.Radius);
|
||||
result += GravityField.Potential(body.WellStrength, body.CoreRadius, length(offset)) - WellReference(body);
|
||||
}
|
||||
|
||||
return result / Settings.HeightExaggeration;
|
||||
|
|
@ -685,9 +688,6 @@ public class Planet
|
|||
public Orbit Orbit;
|
||||
protected readonly PlanetSettings Settings;
|
||||
public BodyData BodyData;
|
||||
// Brush inputs only (ZoneRenderer's Gravity Well brushes and planet icon); no sim reader. grid-lowering deletes them.
|
||||
public float GravityWellDepth;
|
||||
public float GravityWellRadius;
|
||||
public float BodyRadius;
|
||||
|
||||
// The well (GravityField): strength c and softened core radius R by mass, and the Roche limit, the closest a child
|
||||
|
|
@ -707,8 +707,6 @@ public class Planet
|
|||
public void CalculateProperties()
|
||||
{
|
||||
BodyRadius = Settings.BodyRadius.Evaluate(BodyData.Mass) * BodyData.BodyRadiusMultiplier;
|
||||
GravityWellRadius = Settings.GravityRadius.Evaluate(BodyData.Mass) * BodyData.GravityRadiusMultiplier;
|
||||
GravityWellDepth = Settings.GravityDepth.Evaluate(BodyData.Mass) * BodyData.GravityDepthMultiplier;
|
||||
WellStrength = Settings.WellStrength.Evaluate(BodyData.Mass);
|
||||
CoreRadius = Settings.CoreRadius.Evaluate(BodyData.Mass);
|
||||
RocheLimit = Settings.RocheLimit.Evaluate(BodyData.Mass);
|
||||
|
|
|
|||
|
|
@ -86,12 +86,6 @@ public abstract class BodyData
|
|||
|
||||
[JsonProperty("bodyRadiusMul")] [Key(5)]
|
||||
public float BodyRadiusMultiplier = 1;
|
||||
|
||||
[JsonProperty("gravRadiusMul")] [Key(6)]
|
||||
public float GravityRadiusMultiplier = 1;
|
||||
|
||||
[JsonProperty("depthMul")] [Key(7)]
|
||||
public float GravityDepthMultiplier = 1;
|
||||
}
|
||||
|
||||
[CultDocument("aetheria.planetdata", "1"), MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
||||
|
|
|
|||
Loading…
Reference in a new issue