雾着色器
Fog shaders are used to define how fog is added (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.
The resolution of the fog shaders depends on the resolution of the volumetric fog froxel grid. Accordingly, the level of detail that a fog shader can add depends on how close the FogVolume is to the camera.
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.
内置
Values marked as “in” are read-only. Values marked as “out” are for optional writing and will not necessarily contain sensible values. Samplers cannot be written to so they are not marked.
全局内置
Global built-ins are available everywhere, including in custom functions.
内置 | 描述 |
---|---|
in float TIME | 全球时间, 以秒为单位. |
in float PI | A |
in float TAU | A |
in float E | A |
Fog built-ins
All of the output values of fog volumes overlap one another. This allows FogVolumes to be rendered efficiently as they can all be drawn at once.
内置 | 描述 |
---|---|
in vec3 WORLD_POSITION | Position of current froxel cell in world space. |
in vec3 OBJECT_POSITION | Position of the center of the current FogVolume in world space. |
in vec3 UVW | 三维 UV,用于将 3D 纹理映射到当前的 FogVolume 中。 |
in vec3 SIZE | |
in vec3 SDF | Signed distance field to the surface of the FogVolume. Negative if inside volume, positive otherwise. |
out vec3 ALBEDO | Output base color value, interacts with light to produce final color. Only written to fog volume if used. |
out float DENSITY | Output density value. Can be negative to allow subtracting one volume from another. Density must be used for fog shader to write anything at all. |
out vec3 EMISSION | Output emission color value, added to color during light pass to produce final color. Only written to fog volume if used. |
© 版权所有 2014-present Juan Linietsky, Ariel Manzur and the Godot community (CC BY 3.0). Revision b1c660f7
.
Built with Sphinx using a theme provided by Read the Docs.