FogMaterial
Built-in FogVolume density, scattering and emission material.
Multiplies Density by height attenuation, the DensityTexture red channel and SDF edge profile. FogVolumes can share the material. Use a fog-type ShaderMaterial for another formula; similarly named parameters on different material types are not automatically linked.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
FogMaterialConstructor
public FogMaterial();Creates a fog material with Density=1, Albedo=White, Emission=Black, HeightFalloff=0, EdgeFade=0.1 and DensityTexture=null. It is a FogVolume material, not an ordinary MeshInstance3D surface material.
Properties6
AlbedoProperty
public Color Albedo { get; set; }Medium light-scattering color, not a guaranteed final pixel color. Output depends on lights, Density and Environment. Emission controls the medium’s own emission.
DensityProperty
public float Density { get; set; }Local volume contribution to density. Positive adds fog, zero removes its contribution and negative reduces existing density. This is not transparent-mesh alpha. In the gallery, 0.08 creates local mist at global density 0, while -0.12 reduces global fog at 0.02.
DensityTextureProperty
public Texture3D DensityTexture { get; set; }Optional Texture3D whose red channel multiplies Density using volume UVW. null clears it and leaves the built-in sampler white fallback. This is not a Texture2D. Use a fog-type ShaderMaterial for custom world-coordinate mapping.
EdgeFadeProperty
public float EdgeFade { get; set; }Nonnegative exponent of the shape-edge density falloff. Positive values fade density toward the boundary; increasing it changes the transition profile rather than Size. Negative assignments become zero. The gallery uses 0.5.
EmissionProperty
public Color Emission { get; set; }Medium self-emission. Black removes this contribution. It does not replace Light3D for lighting neighboring meshes: the fog shader writes emission into the volume buffer rather than creating a light.
HeightFalloffProperty
public float HeightFalloff { get; set; }Nonnegative density falloff upward along world Y relative to the FogVolume position. Zero retains density across height before other factors. The shader uses clamp(exp2(-HeightFalloff × (worldY − volumeY)), 0, 1); negative assignments become zero.
Methods12
GetAlbedoColor
public Color GetAlbedo();Incoming-light scattering RGB. Without lighting/emission, black albedo produces an absorbing volume. Color alpha does not control fog transparency; density does.
ColorStored albedo Color.
GetDensityfloat
public float GetDensity();Density contribution, not surface alpha. Positive adds fog, zero removes this material contribution and negative subtracts overlapping density. The setter retains negative values. Density subtraction does not guarantee removing another volume emission: RD accumulates them separately.
floatStored density.
GetDensityTextureTexture3D
public Texture3D GetDensityTexture();Optional Texture3D whose red channel multiplies Density using volume UVW. null clears it and leaves the built-in sampler white fallback. This is not a Texture2D. Use a fog-type ShaderMaterial for custom world-coordinate mapping.
Texture3DAssigned Texture3D, or null.
GetEdgeFadefloat
public float GetEdgeFade();Nonnegative exponent of SDF-based density falloff toward the shape boundary. It is neither a width in meters nor the volume Size. The setter clamps negative values to zero without an upper limit of one.
floatStored nonnegative exponent.
GetEmissionColor
public Color GetEmission();Medium self-emission RGB, not a Light3D illuminating nearby models. Contribution depends on positive density. Black removes this material emission; another volume negative density does not necessarily erase it.
ColorStored emission Color.
GetHeightFallofffloat
public float GetHeightFalloff();Nonnegative height attenuation along world Y relative to FogVolume position. The built-in shader uses clamp(exp2(-HeightFalloff * (worldY - volumeY)),0,1). The setter clamps negative values to zero but permits values above one.
floatCoefficient after clamping its lower bound to zero.
SetAlbedovoid
public void SetAlbedo(Color albedo);Incoming-light scattering RGB. Without lighting/emission, black albedo produces an absorbing volume. Color alpha does not control fog transparency; density does.
| Name | Type | Default |
|---|---|---|
albedo | Color | — |
albedoScattering color; the shader uses RGB.
SetDensityvoid
public void SetDensity(float density);Density contribution, not surface alpha. Positive adds fog, zero removes this material contribution and negative subtracts overlapping density. The setter retains negative values. Density subtraction does not guarantee removing another volume emission: RD accumulates them separately.
| Name | Type | Default |
|---|---|---|
density | float | — |
densityDensity, including negative subtraction; the inspector range hint is not a setter clamp.
SetDensityTexturevoid
public void SetDensityTexture(Texture3D densityTexture);Optional Texture3D whose red channel multiplies Density using volume UVW. null clears it and leaves the built-in sampler white fallback. This is not a Texture2D. Use a fog-type ShaderMaterial for custom world-coordinate mapping.
| Name | Type | Default |
|---|---|---|
densityTexture | Texture3D | — |
densityTexture3D density texture, or null.
SetEdgeFadevoid
public void SetEdgeFade(float edgeFade);Nonnegative exponent of SDF-based density falloff toward the shape boundary. It is neither a width in meters nor the volume Size. The setter clamps negative values to zero without an upper limit of one.
| Name | Type | Default |
|---|---|---|
edgeFade | float | — |
edgeFadeBoundary-profile exponent; initially 0.1.
SetEmissionvoid
public void SetEmission(Color emission);Medium self-emission RGB, not a Light3D illuminating nearby models. Contribution depends on positive density. Black removes this material emission; another volume negative density does not necessarily erase it.
| Name | Type | Default |
|---|---|---|
emission | Color | — |
emissionSelf-emission color; RGB is used, not alpha.
SetHeightFalloffvoid
public void SetHeightFalloff(float heightFalloff);Nonnegative height attenuation along world Y relative to FogVolume position. The built-in shader uses clamp(exp2(-HeightFalloff * (worldY - volumeY)),0,1). The setter clamps negative values to zero but permits values above one.
| Name | Type | Default |
|---|---|---|
heightFalloff | float | — |
heightFalloffCoefficient; zero disables height attenuation.