Scripting API

Scripting API

CameraFog

Record struct in Abyss.Core, from Abyss.Core.

How far a camera sees through the air: what it fogs to, how fast, and the glow it takes toward the sun — CameraFog.Linear(sky, 96f, 128f) hides the edge of a world drawn to 128 meters in the sky's color. Colors are sRGB with alpha, alpha how much fog there is at its thickest. Materials are fogged; the sky behind them is not, so a fog the sky's color makes the two one. A camera's CameraSky is mapped as its materials are, so a fog of its horizon's color is the sky whatever the camera's Tonemapping; the window's clear color is mapped only by a camera in HDR, so a fog of the clear color's shows darker on one that is not and tone-maps, as Bevy's start out doing, unless its Tonemapping is None.

public readonly record struct CameraFog

Remarks

Laid out as abyss_core::render::CameraFog is, 52 bytes.

Constructors

CameraFog

public CameraFog(Vector4 Color, Vector4 SunColor, float SunExponent, FogFalloff Falloff, float Start, float End, float Density)

How far a camera sees through the air: what it fogs to, how fast, and the glow it takes toward the sun — CameraFog.Linear(sky, 96f, 128f) hides the edge of a world drawn to 128 meters in the sky's color. Colors are sRGB with alpha, alpha how much fog there is at its thickest. Materials are fogged; the sky behind them is not, so a fog the sky's color makes the two one. A camera's CameraSky is mapped as its materials are, so a fog of its horizon's color is the sky whatever the camera's Tonemapping; the window's clear color is mapped only by a camera in HDR, so a fog of the clear color's shows darker on one that is not and tone-maps, as Bevy's start out doing, unless its Tonemapping is None.

Parameters

  • Color: What it fogs to.
  • SunColor: What it glows looking toward a directional light; nothing for no glow.
  • SunExponent: How tight the glow is: higher, smaller.
  • Falloff: How it thickens.
  • Start: Where a linear fog starts, in meters from the camera.
  • End: Where a linear fog is whole.
  • Density: How fast an exponential fog thickens.

Laid out as abyss_core::render::CameraFog is, 52 bytes.

Properties

Color

public Vector4 Color { get; init; }

What it fogs to.

SunColor

public Vector4 SunColor { get; init; }

What it glows looking toward a directional light; nothing for no glow.

SunExponent

public float SunExponent { get; init; }

How tight the glow is: higher, smaller.

Falloff

public FogFalloff Falloff { get; init; }

How it thickens.

Start

public float Start { get; init; }

Where a linear fog starts, in meters from the camera.

End

public float End { get; init; }

Where a linear fog is whole.

Density

public float Density { get; init; }

How fast an exponential fog thickens.

Methods

Linear

public static CameraFog Linear(Vector4 color, float start, float end)

A fog of color from start meters to whole at end, no glow.

Parameters

  • color
  • start
  • end

Exponential

public static CameraFog Exponential(Vector4 color, float density, bool squared = false)

A fog of color thickening by density, squared for mist that is clear near, no glow.

Parameters

  • color
  • density
  • squared