Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

Fog-Shader

Fog shaders are used to define how fog is added to (or subtracted from) a scene in a given area. Fog shaders are always used together with FogVolumes and volumetric fog. Fog shaders only have one processing function, the fog() function.

Die Auflösung der Fog-Shader hängt von der Auflösung des volumetrischen Nebel-Froxel-Rasters ab. Dementsprechend hängt der Detailgrad, den ein Fog-Shader hinzufügen kann, davon ab, wie nah das FogVolume an der Kamera ist.

Fog shaders are a special form of compute shader that is called once for every froxel that is touched by an axis-aligned bounding box of the associated FogVolume. This means that froxels that just barely touch a given FogVolume will still be used.

Built-ins

Values marked as in are read-only. Values marked as out can optionally be written to and will not necessarily contain sensible values. Samplers cannot be written to so they are not marked.

Globale Built-ins

Globale Built-ins sind überall verfügbar, auch in benutzerdefinierten Funktionen.

Built-in

Beschreibung

in float TIME

Global time since the engine has started, in seconds. It repeats after every 3,600 seconds (which can be changed with the rollover setting). It's affected by time_scale but not by pausing. If you need a TIME variable that is not affected by time scale, add your own global shader uniform and update it each frame.

in float PI

A PI constant (3.141592). The ratio of a circle's circumference to its diameter and the number of radians in a half turn.

in float TAU

A TAU constant (6.283185). Equivalent to PI * 2 and the number of radians in a full turn.

in float E

An E constant (2.718281). Euler's number, the base of the natural logarithm.

Fog-Built-ins

Alle Ausgabewerte von Nebelvolumina überlagern sich gegenseitig. Dadurch können FogVolumes effizient gerendert werden, da sie alle auf einmal gezeichnet werden können.

Built-in

Beschreibung

in vec3 WORLD_POSITION

Position der aktuellen Froxel-Zelle im World-Space.

in vec3 OBJECT_POSITION

Position des Zentrums des aktuellen FogVolume im World-Space.

in vec3 UVW

3-dimensional UV, used to map a 3D texture to the current FogVolume.

in vec3 SIZE

Größe des aktuellen FogVolume, wenn sein shape eine Größe hat.

in vec3 SDF

Signed Distance Field zur Oberfläche des FogVolume. Negativ, wenn innerhalb des Volumens, sonst positiv.

out vec3 ALBEDO

Ausgabe-Basisfarbwert, interagiert mit dem Licht, um die endgültige Farbe zu erzeugen. Wird nur in das Fog Volume geschrieben, wenn es verwendet wird.

out float DENSITY

Ausgabe-Dichtewert. Kann negativ sein, damit ein Volumen von einem anderen subtrahiert werden kann. Die Dichte muss verwendet werden, damit der Fog-Shader überhaupt etwas schreiben kann.

out vec3 EMISSION

Ausgabe -Emissionsfarbwert, der während des Lichtdurchlaufs zur Farbe addiert wird, um die endgültige Farbe zu erzeugen. Wird nur in das Nebelvolumen geschrieben, wenn es verwendet wird.