summaryrefslogtreecommitdiff
path: root/doc/classes
diff options
context:
space:
mode:
authorclayjohn <claynjohn@gmail.com>2021-10-03 04:28:55 -0700
committerclayjohn <claynjohn@gmail.com>2021-10-28 22:02:23 -0700
commit1b2cd9f2519d54c0cf9cf58939f09d7a6834f292 (patch)
treeb76e4e5aa4d28d78482a4b54b2a5aefb66450a2c /doc/classes
parent93078089878296cca7548692fd2e472898379d1c (diff)
Addition of FogVolumes, FogShaders, FogMaterial, and overhaul of VolumetricFog
Co-authored-by: Brian Semrau <brian.semrau@gmail.com>
Diffstat (limited to 'doc/classes')
-rw-r--r--doc/classes/Environment.xml36
-rw-r--r--doc/classes/FogMaterial.xml31
-rw-r--r--doc/classes/FogVolume.xml23
-rw-r--r--doc/classes/ProjectSettings.xml5
-rw-r--r--doc/classes/RenderingServer.xml74
-rw-r--r--doc/classes/Shader.xml3
-rw-r--r--doc/classes/VisualShader.xml5
7 files changed, 153 insertions, 24 deletions
diff --git a/doc/classes/Environment.xml b/doc/classes/Environment.xml
index 80298a0319..57f6e9547a 100644
--- a/doc/classes/Environment.xml
+++ b/doc/classes/Environment.xml
@@ -248,23 +248,41 @@
<member name="tonemap_white" type="float" setter="set_tonemap_white" getter="get_tonemap_white" default="1.0">
The white reference value for tonemapping. Only effective if the [member tonemap_mode] isn't set to [constant TONE_MAPPER_LINEAR].
</member>
- <member name="volumetric_fog_density" type="float" setter="set_volumetric_fog_density" getter="get_volumetric_fog_density" default="0.01">
+ <member name="volumetric_fog_albedo" type="Color" setter="set_volumetric_fog_albedo" getter="get_volumetric_fog_albedo" default="Color(1, 1, 1, 1)">
+ The [Color] of the volumetric fog when interacting with lights. Mist and fog have an albedo close to [code]Color(1, 1, 1, 1)[/code] while smoke has a darker albedo.
+ </member>
+ <member name="volumetric_fog_ambient_inject" type="float" setter="set_volumetric_fog_ambient_inject" getter="get_volumetric_fog_ambient_inject" default="0.0">
+ Scales the strength of ambient light used in the volumetric fog. A value of [code]0[/code] means that ambient light will not impact the volumetric fog.
+ </member>
+ <member name="volumetric_fog_anisotropy" type="float" setter="set_volumetric_fog_anisotropy" getter="get_volumetric_fog_anisotropy" default="0.2">
+ The direction of scattered light as it goes through the volumetric fog. A value close [code]1[/code] means almost all light is scattered forward. A value close to [code]0[/code] means light is scattered equally in all directions. A value close to [code]-1[/code] means light is scattered mostly backward. Fog and mist scatter light slightly forward, while smoke scatters light equally in all directions.
+ </member>
+ <member name="volumetric_fog_density" type="float" setter="set_volumetric_fog_density" getter="get_volumetric_fog_density" default="0.05">
+ The base density of the volumetric fog. Set this to the lowest density you want to have globally.
</member>
<member name="volumetric_fog_detail_spread" type="float" setter="set_volumetric_fog_detail_spread" getter="get_volumetric_fog_detail_spread" default="2.0">
+ The distribution of size down the length of the froxel buffer. A higher value compresses the froxels closer to the camera and places more detail closer to the camera.
+ </member>
+ <member name="volumetric_fog_emission" type="Color" setter="set_volumetric_fog_emission" getter="get_volumetric_fog_emission" default="Color(0, 0, 0, 1)">
+ The emitted light from the volumetric fog. Even with emission, volumetric fog will not cast light onto other surfaces. Emission is useful to establish an ambient color. As the volumetric fog effect uses single-scattering only, fog tends to need a little bit of emission to soften the harsh shadows.
+ </member>
+ <member name="volumetric_fog_emission_energy" type="float" setter="set_volumetric_fog_emission_energy" getter="get_volumetric_fog_emission_energy" default="1.0">
+ The brightness of the emitted light from the volumetric fog.
</member>
<member name="volumetric_fog_enabled" type="bool" setter="set_volumetric_fog_enabled" getter="is_volumetric_fog_enabled" default="false">
+ Enables the volumetric fog effect. Volumetric fog uses a screen-aligned froxel buffer to calculate accurate volumetric scattering in the short to medium range. Volumetric fog interacts with [FogVolume]s and lights to calculate localized and global fog. Volumetric fog uses a PBR single-scattering model based on extinction, scattering, and emission which it exposes to users as density, albedo, and emission.
</member>
<member name="volumetric_fog_gi_inject" type="float" setter="set_volumetric_fog_gi_inject" getter="get_volumetric_fog_gi_inject" default="0.0">
+ Scales the strength of Global Illumination used in the volumetric fog. A value of [code]0[/code] means that Global Illumination will not impact the volumetric fog.
</member>
<member name="volumetric_fog_length" type="float" setter="set_volumetric_fog_length" getter="get_volumetric_fog_length" default="64.0">
- </member>
- <member name="volumetric_fog_light" type="Color" setter="set_volumetric_fog_light" getter="get_volumetric_fog_light" default="Color(0, 0, 0, 1)">
- </member>
- <member name="volumetric_fog_light_energy" type="float" setter="set_volumetric_fog_light_energy" getter="get_volumetric_fog_light_energy" default="1.0">
+ The distance over which the volumetric fog is computed. Increase to compute fog over a greater range, decrease to add more detail when a long range is not needed. For best quality fog, keep this as low as possible.
</member>
<member name="volumetric_fog_temporal_reprojection_amount" type="float" setter="set_volumetric_fog_temporal_reprojection_amount" getter="get_volumetric_fog_temporal_reprojection_amount" default="0.9">
+ The amount by which to blend the last frame with the current frame. A higher number results in smoother volumetric fog, but makes "ghosting" much worse. A lower value reduces ghosting but can result in the per-frame temporal jitter becoming visible.
</member>
<member name="volumetric_fog_temporal_reprojection_enabled" type="bool" setter="set_volumetric_fog_temporal_reprojection_enabled" getter="is_volumetric_fog_temporal_reprojection_enabled" default="true">
+ Enables temporal reprojection in the volumetric fog. Temporal reprojection blends the current frame's volumetric fog with the last frame's volumetric fog to smooth out jagged edges. The performance cost is minimal, however it does lead to moving [FogVolume]s and [Light3D]s "ghosting" and leaving a trail behind them. When temporal reprojection is enabled, try to avoid moving [FogVolume]s or [Light3D]s too fast.
</member>
</members>
<constants>
@@ -349,13 +367,5 @@
</constant>
<constant name="SDFGI_Y_SCALE_50_PERCENT" value="2" enum="SDFGIYScale">
</constant>
- <constant name="VOLUMETRIC_FOG_SHADOW_FILTER_DISABLED" value="0" enum="VolumetricFogShadowFilter">
- </constant>
- <constant name="VOLUMETRIC_FOG_SHADOW_FILTER_LOW" value="1" enum="VolumetricFogShadowFilter">
- </constant>
- <constant name="VOLUMETRIC_FOG_SHADOW_FILTER_MEDIUM" value="2" enum="VolumetricFogShadowFilter">
- </constant>
- <constant name="VOLUMETRIC_FOG_SHADOW_FILTER_HIGH" value="3" enum="VolumetricFogShadowFilter">
- </constant>
</constants>
</class>
diff --git a/doc/classes/FogMaterial.xml b/doc/classes/FogMaterial.xml
new file mode 100644
index 0000000000..431f3ac2b7
--- /dev/null
+++ b/doc/classes/FogMaterial.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="FogMaterial" inherits="Material" version="4.0">
+ <brief_description>
+ [Material] used with a [FogVolume] to draw things with the volumetric fog effect.
+ </brief_description>
+ <description>
+ A [Material] resource that can be used by [FogVolume]s to draw volumetric effects.
+ </description>
+ <tutorials>
+ </tutorials>
+ <members>
+ <member name="albedo" type="Color" setter="set_albedo" getter="get_albedo" default="Color(1, 1, 1, 1)">
+ Sets the single-scattering [Color] of the [FogVolume]. Internally [member albedo] is converted into single-scattering which is additively blended with other [FogVolume]s and the [member Environment.volumetric_fog_albedo].
+ </member>
+ <member name="density" type="float" setter="set_density" getter="get_density" default="1.0">
+ Sets the density of the [FogVolume]. Denser objects are more opaque, but may suffer from under-sampling artifacts that look like stripes.
+ </member>
+ <member name="density_texture" type="Texture3D" setter="set_density_texture" getter="get_density_texture">
+ Sets a 3D texture that is used to scale the [member density] of the [FogVolume].
+ </member>
+ <member name="edge_fade" type="float" setter="set_edge_fade" getter="get_edge_fade" default="0.1">
+ Sets the hardness of the edges of the [FogVolume]. A higher number will result in softer edges while a lower number will result in harder edges.
+ </member>
+ <member name="emission" type="Color" setter="set_emission" getter="get_emission" default="Color(0, 0, 0, 1)">
+ Sets the [Color] of the light emitted by the [FogVolume]. Emitted light will not cast light or shadows on other objects, but can be useful for modulating the [Color] of the [FogVolume] independently from light sources.
+ </member>
+ <member name="height_falloff" type="float" setter="set_height_falloff" getter="get_height_falloff" default="0.0">
+ Sets the rate by which the height-based fog decreases in density as height increases in world space. A high falloff will result in a sharp transition, while a low falloff will result in a smoother transition. A value of [code]0[/code] results in uniform-density fog. The height threshold is determined by the height of the associated [FogVolume].
+ </member>
+ </members>
+</class>
diff --git a/doc/classes/FogVolume.xml b/doc/classes/FogVolume.xml
new file mode 100644
index 0000000000..ba1b5d3372
--- /dev/null
+++ b/doc/classes/FogVolume.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<class name="FogVolume" inherits="VisualInstance3D" version="4.0">
+ <brief_description>
+ A node used to add local fog with the volumetric fog effect.
+ </brief_description>
+ <description>
+ [FogVolume]s are used to add localized fog into the global volumetric fog effect.
+ Performance of [FogVolume]s is directly related to their relative size on the screen and the complexity of their attached [FogMaterial]. It is best to keep [FogVolume]s relatively small and simple where possible.
+ </description>
+ <tutorials>
+ </tutorials>
+ <members>
+ <member name="extents" type="Vector3" setter="set_extents" getter="get_extents" default="Vector3(1, 1, 1)">
+ Sets the size of the [FogVolume] when [member shape] is [constant RenderingServer.FOG_VOLUME_SHAPE_ELLIPSOID] or [constant RenderingServer.FOG_VOLUME_SHAPE_BOX].
+ </member>
+ <member name="material" type="Material" setter="set_material" getter="get_material">
+ Sets the [Material] to be used by the [FogVolume]. Can be either a [FogMaterial] or a custom [ShaderMaterial].
+ </member>
+ <member name="shape" type="int" setter="set_shape" getter="get_shape" enum="RenderingServer.FogVolumeShape" default="1">
+ Sets the shape of the [FogVolume] to either [constant RenderingServer.FOG_VOLUME_SHAPE_ELLIPSOID], [constant RenderingServer.FOG_VOLUME_SHAPE_BOX], or [constant RenderingServer.FOG_VOLUME_SHAPE_ELLIPSOID] or [constant RenderingServer.FOG_VOLUME_SHAPE_WORLD].
+ </member>
+ </members>
+</class>
diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml
index c646380bee..e67ccf9efd 100644
--- a/doc/classes/ProjectSettings.xml
+++ b/doc/classes/ProjectSettings.xml
@@ -1577,10 +1577,13 @@
Scales the distance over which samples are taken for subsurface scattering effect. Changing this does not impact performance, but higher values will result in significant artifacts as the samples will become obviously spread out. A lower value results in a smaller spread of scattered light.
</member>
<member name="rendering/environment/volumetric_fog/use_filter" type="int" setter="" getter="" default="1">
+ Enables filtering of the volumetric fog effect prior to integration. This substantially blurs the fog which reduces fine details but also smooths out harsh edges and aliasing artifacts. Disable when more detail is required.
</member>
- <member name="rendering/environment/volumetric_fog/volume_depth" type="int" setter="" getter="" default="128">
+ <member name="rendering/environment/volumetric_fog/volume_depth" type="int" setter="" getter="" default="64">
+ Number of slices to use along the depth of the froxel buffer for volumetric fog. A lower number will be more efficient but may result in artifacts appearing during camera movement.
</member>
<member name="rendering/environment/volumetric_fog/volume_size" type="int" setter="" getter="" default="64">
+ Base size used to determine size of froxel buffer in the camera X-axis and Y-axis. The final size is scaled by the aspect ratio of the screen, so actual values may differ from what is set. Set a larger size for more detailed fog, set a smaller size for better performance.
</member>
<member name="rendering/global_illumination/gi/use_half_resolution" type="bool" setter="" getter="" default="false">
</member>
diff --git a/doc/classes/RenderingServer.xml b/doc/classes/RenderingServer.xml
index b53233add5..86e66a5738 100644
--- a/doc/classes/RenderingServer.xml
+++ b/doc/classes/RenderingServer.xml
@@ -1120,13 +1120,16 @@
<argument index="0" name="env" type="RID" />
<argument index="1" name="enable" type="bool" />
<argument index="2" name="density" type="float" />
- <argument index="3" name="light" type="Color" />
- <argument index="4" name="light_energy" type="float" />
- <argument index="5" name="length" type="float" />
- <argument index="6" name="p_detail_spread" type="float" />
- <argument index="7" name="gi_inject" type="float" />
- <argument index="8" name="temporal_reprojection" type="bool" />
- <argument index="9" name="temporal_reprojection_amount" type="float" />
+ <argument index="3" name="albedo" type="Color" />
+ <argument index="4" name="emission" type="Color" />
+ <argument index="5" name="emission_energy" type="float" />
+ <argument index="6" name="anisotropy" type="float" />
+ <argument index="7" name="length" type="float" />
+ <argument index="8" name="p_detail_spread" type="float" />
+ <argument index="9" name="gi_inject" type="float" />
+ <argument index="10" name="temporal_reprojection" type="bool" />
+ <argument index="11" name="temporal_reprojection_amount" type="float" />
+ <argument index="12" name="ambient_inject" type="float" />
<description>
</description>
</method>
@@ -1134,6 +1137,7 @@
<return type="void" />
<argument index="0" name="active" type="bool" />
<description>
+ Enables filtering of the volumetric fog scattering buffer. This results in much smoother volumes with very few under-sampling artifacts.
</description>
</method>
<method name="environment_set_volumetric_fog_volume_size">
@@ -1141,6 +1145,37 @@
<argument index="0" name="size" type="int" />
<argument index="1" name="depth" type="int" />
<description>
+ Sets the resolution of the volumetric fog's froxel buffer. [code]size[/code] is modified by the screen's aspect ratio and then used to set the width and height of the buffer. While [code]depth[/code] is directly used to set the depth of the buffer.
+ </description>
+ </method>
+ <method name="fog_volume_create">
+ <return type="RID" />
+ <description>
+ Creates a new fog volume and allocates an RID.
+ </description>
+ </method>
+ <method name="fog_volume_set_extents">
+ <return type="void" />
+ <argument index="0" name="fog_volume" type="RID" />
+ <argument index="1" name="extents" type="Vector3" />
+ <description>
+ Sets the size of the fog volume when shape is [constant FOG_VOLUME_SHAPE_ELLIPSOID] or [constant FOG_VOLUME_SHAPE_BOX].
+ </description>
+ </method>
+ <method name="fog_volume_set_material">
+ <return type="void" />
+ <argument index="0" name="fog_volume" type="RID" />
+ <argument index="1" name="material" type="RID" />
+ <description>
+ Sets the [Material] of the fog volume. Can be either a [FogMaterial] or a custom [ShaderMaterial].
+ </description>
+ </method>
+ <method name="fog_volume_set_shape">
+ <return type="void" />
+ <argument index="0" name="fog_volume" type="RID" />
+ <argument index="1" name="shape" type="int" enum="RenderingServer.FogVolumeShape" />
+ <description>
+ Sets the shape of the fog volume to either [constant RenderingServer.FOG_VOLUME_SHAPE_ELLIPSOID], [constant RenderingServer.FOG_VOLUME_SHAPE_BOX], or [constant RenderingServer.FOG_VOLUME_SHAPE_ELLIPSOID] or [constant RenderingServer.FOG_VOLUME_SHAPE_WORLD].
</description>
</method>
<method name="force_draw">
@@ -1430,6 +1465,13 @@
Sets a margin to increase the size of the AABB when culling objects from the view frustum. This allows you to avoid culling objects that fall outside the view frustum. Equivalent to [member GeometryInstance3D.extra_cull_margin].
</description>
</method>
+ <method name="instance_set_ignore_culling">
+ <return type="void" />
+ <argument index="0" name="instance" type="RID" />
+ <argument index="1" name="enabled" type="bool" />
+ <description>
+ </description>
+ </method>
<method name="instance_set_layer_mask">
<return type="void" />
<argument index="0" name="instance" type="RID" />
@@ -3417,7 +3459,10 @@
<constant name="SHADER_SKY" value="3" enum="ShaderMode">
Shader is a sky shader.
</constant>
- <constant name="SHADER_MAX" value="4" enum="ShaderMode">
+ <constant name="SHADER_FOG" value="4" enum="ShaderMode">
+ Shader is a fog shader.
+ </constant>
+ <constant name="SHADER_MAX" value="5" enum="ShaderMode">
Represents the size of the [enum ShaderMode] enum.
</constant>
<constant name="MATERIAL_RENDER_PRIORITY_MIN" value="-128">
@@ -3789,6 +3834,15 @@
</constant>
<constant name="PARTICLES_COLLISION_HEIGHTFIELD_RESOLUTION_MAX" value="6" enum="ParticlesCollisionHeightfieldResolution">
</constant>
+ <constant name="FOG_VOLUME_SHAPE_ELLIPSOID" value="0" enum="FogVolumeShape">
+ [FogVolume] will be shaped like an ellipsoid.
+ </constant>
+ <constant name="FOG_VOLUME_SHAPE_BOX" value="1" enum="FogVolumeShape">
+ [FogVolume] will be shaped like a box.
+ </constant>
+ <constant name="FOG_VOLUME_SHAPE_WORLD" value="2" enum="FogVolumeShape">
+ [FogVolume] will have no shape, will cover the whole world and will not be culled.
+ </constant>
<constant name="VIEWPORT_UPDATE_DISABLED" value="0" enum="ViewportUpdateMode">
Do not update the viewport.
</constant>
@@ -4155,7 +4209,9 @@
</constant>
<constant name="INSTANCE_VISIBLITY_NOTIFIER" value="11" enum="InstanceType">
</constant>
- <constant name="INSTANCE_MAX" value="12" enum="InstanceType">
+ <constant name="INSTANCE_FOG_VOLUME" value="12" enum="InstanceType">
+ </constant>
+ <constant name="INSTANCE_MAX" value="13" enum="InstanceType">
Represents the size of the [enum InstanceType] enum.
</constant>
<constant name="INSTANCE_GEOMETRY_MASK" value="14" enum="InstanceType">
diff --git a/doc/classes/Shader.xml b/doc/classes/Shader.xml
index 14c5ba9247..99e38e969d 100644
--- a/doc/classes/Shader.xml
+++ b/doc/classes/Shader.xml
@@ -60,5 +60,8 @@
<constant name="MODE_SKY" value="3" enum="Mode">
Mode used for drawing skies. Only works with shaders attached to [Sky] objects.
</constant>
+ <constant name="MODE_FOG" value="4" enum="Mode">
+ Mode used for setting the color and density of volumetric fog effect.
+ </constant>
</constants>
</class>
diff --git a/doc/classes/VisualShader.xml b/doc/classes/VisualShader.xml
index cdb9de4f86..d7b4673b9f 100644
--- a/doc/classes/VisualShader.xml
+++ b/doc/classes/VisualShader.xml
@@ -176,7 +176,10 @@
</constant>
<constant name="TYPE_SKY" value="8" enum="Type">
</constant>
- <constant name="TYPE_MAX" value="9" enum="Type">
+ <constant name="TYPE_FOG" value="9" enum="Type">
+ A compute shader that runs for each froxel of the volumetric fog map.
+ </constant>
+ <constant name="TYPE_MAX" value="10" enum="Type">
Represents the size of the [enum Type] enum.
</constant>
<constant name="NODE_ID_INVALID" value="-1">