Class HorizonFogUniforms
Shared _FogParams/_FogColor uniform shape for every screen-space overlay shader: tiles, polylines, bulk markers, marker labels, and polygon fills all sample it through the exact same TileQuad.shader-style ApplyHorizonFog term (saturate((viewDist - start) * invRange), lerp rgb toward the fog color). One packing implementation so a map with horizon fade on fogs every flat-view layer identically instead of each layer's renderer carrying its own copy of the (start, 1/range) math to drift out of sync.
public static class HorizonFogUniforms
- Inheritance
-
objectHorizonFogUniforms
Remarks
World-space draws (a SurfaceMapView table's RenderWorld path on
PolylineLayer/PolygonLayer, and MarkerLabelSdf.shader's
LANSMAP_WORLD_GLYPH/LANSMAP_WORLD_PLATE variants) never call
Bind(Material, Vector4, Color), so their materials keep Unity's default zero
vector for both properties - the same "off unless a caller wires it"
invariant SetFog(float, float, Color) already relies on
for SurfaceMapView.
Fields
ColorPropertyId
public static readonly int ColorPropertyId
Field Value
ParamsPropertyId
public static readonly int ParamsPropertyId
Field Value
Methods
Bind(Material, Vector4, Color)
Binds packed fog uniforms onto one material's flat-view draw.
public static void Bind(Material material, Vector4 fogParams, Color fogColor)
Parameters
materialMaterialMaterial to bind onto.
fogParamsVector4Value from PackParams(float, float).
fogColorColorColor distant geometry fades toward.
PackParams(float, float)
Packs a horizon fade band into the shader's _FogParams shape: x = start view distance, y = 1 / (end - start), in the same units as clip w. A non-positive or non-finite range packs to UnityEngine.Vector4.zero, which switches the shader's fade term off (its saturate hits 0 for every finite viewDist when y = 0).
public static Vector4 PackParams(float startViewDistance, float endViewDistance)
Parameters
startViewDistancefloatView distance where the fade begins, in multiples of the camera distance.
endViewDistancefloatView distance where the fade is complete. At or below
startViewDistancethe fade packs off.
Returns
- Vector4