Vixen
dd8b0a81
csharp
public sealed class FogRenderer

Depth fog, with an optional height falloff and sun scattering.

Read the guide page for this →

Remarks

A post-process rather than a per-material term, and that is what makes it affordable: fog depends on the distance from the camera to whatever was drawn, which the depth buffer already holds for every pixel of the frame. Adding it in every material's shader would mean every material carrying the fog's parameters and evaluating it whether it is on or not.

Fields and properties (23)

  • public required string Source

    The colour it fogs.

  • public required string Depth

    The depth it reads distance from.

  • public int Mode

    Which falloff curve is used.

  • public bool HeightFalloff

    Whether fog thins with altitude, as an atmosphere does.

  • public bool SunScattering

    Whether looking toward the sun brightens the fog.

  • public RenderView? View

    The view the two below are derived from, or null to set them by hand.

  • public Matrix4x4 InverseViewProjection

    Clip back to world, when no View supplies it.

  • public Vector3 CameraPosition

    Where the camera is, which the distance is measured from.

  • public Vector3 Colour

    What the fog looks like away from the sun, as a radiance in cd/m², when Frame has no sky in it.

  • public float Density

    How quickly it accumulates with distance.

  • public float Start

    Where it begins, for the linear mode.

  • public float End

    Where it is fully opaque, for the linear mode.

  • public float Height

    The altitude the authored density holds at.

  • public float HeightFalloffRate

    How fast density thins above Height, per world unit.

  • public Vector3 SunDirection

    Which way the light travels, when no Sun answers.

  • public Vector3 SunColour

    What the fog looks like straight down-sun, as a radiance in cd/m², when Sun has no directional light in it.

  • public ISunSource? Sun

    Where the frame's directional light comes from, or null to use the authored pair.

  • public SceneConstants? Frame

    The frame's own lighting, which is where the sky's mean radiance comes from.

  • public float SunAnisotropy

    Henyey–Greenstein anisotropy, 0 isotropic to just under 1 sharply forward.

  • public string Volume

    The marched volume VolumetricFogRenderer filled, or empty for the falloff alone.

  • public float VolumeNear

    The volume's own near plane, in view depth.

  • public float VolumeFar

    The volume's own far plane. Past this the analytic falloff is what runs.

  • public int VolumeSlices

    How many slices it cut between the two.

Methods (3)

Used by (3)

  • PhotometricDefaultTestsVixen.Rendering.PostFx.Tests
  • PostEffectFactoryVixen.Rendering.PostFx
  • PostEffectTestsVixen.Rendering.PostFx.Tests