FogOfWarCompositorEffect ​
Inherits: CompositorEffect
CompositorEffect that renders fog of war as a post-process. Uses depth buffer reconstruction to apply fog based on world position.
Variables ​
RenderingDevice | rd | |
RID | shader | |
RID | pipeline | |
RID | sampler_linear | |
RID | shroud_texture_rid | |
RID | vision_texture_rid | |
Vector2 | map_min | Vector2(-256, -256) |
Vector2 | map_max | Vector2(256, 256) |
float | shroud_alpha | 1.0 |
float | fog_alpha | 0.2 |
float | edge_threshold | 0.3 |
float | edge_softness | 1.0 |
float | blur_radius | 1.0 |
Methods ​
void | set_fog_textures( shroud_rid: RID, vision_rid: RID ) |
void | set_map_bounds( min_bounds: Vector2, max_bounds: Vector2 ) |
void | set_fog_colors( p_shroud_alpha: float, p_fog_alpha: float ) |
void | set_edge_params( p_threshold: float, p_softness: float ) |
void | set_blur_radius( p_blur_radius: float ) |
void | set_debug( enabled: bool ) |
Constants ​
StringSHADER_PATH ="res://addons/chroniclenode/runtime_classes/world/fog/fog_of_war.glsl"- The compute shader that draws the fog.
Variable descriptions ​
RenderingDevice rd ​
The rendering device the effect draws with.
RID shader ​
The compiled shader.
RID pipeline ​
The compute pipeline of the shader.
RID sampler_linear ​
The sampler of the fog textures.
RID shroud_texture_rid ​
The texture of the shroud (the places that were never seen).
RID vision_texture_rid ​
The texture of the places seen now.
Vector2 map_min = Vector2(-256, -256) ​
The corner of the map with the lowest coordinates.
Vector2 map_max = Vector2(256, 256) ​
The corner of the map with the highest coordinates.
float shroud_alpha = 1.0 ​
How dark the shroud is (1 = fully dark).
float fog_alpha = 0.2 ​
How dark the places that were seen but are not in view are.
float edge_threshold = 0.3 ​
Where the soft edge of the fog starts.
float edge_softness = 1.0 ​
How soft the edge of the fog is.
float blur_radius = 1.0 ​
Multiplier for blur sampling distance (1.0 = normal, 1.5 = wider blur)
Method descriptions ​
void set_fog_textures( shroud_rid: RID, vision_rid: RID ) ​
Gives the effect the shroud and the vision textures.
void set_map_bounds( min_bounds: Vector2, max_bounds: Vector2 ) ​
Sets the corners of the map the fog covers.
void set_fog_colors( p_shroud_alpha: float, p_fog_alpha: float ) ​
Sets how dark the shroud and the fog are.
void set_edge_params( p_threshold: float, p_softness: float ) ​
Sets the threshold and the softness of the edge of the fog.
void set_blur_radius( p_blur_radius: float ) ​
Sets how wide the blur of the edge is (0.5 to 3).
void set_debug( enabled: bool ) ​
Turns the debug output on or off.