Browse Source

Merge pull request #7340 from Calinou/volumetric-fog-noisetexture3d

Max Hilbrunner 2 years ago
parent
commit
3fb3f67b86

BIN
tutorials/3d/img/volumetric_fog_fog_material_density_texture.webp


+ 7 - 0
tutorials/3d/particles/attractors.rst

@@ -165,6 +165,13 @@ To create a vector field attractor, add a new child node to your scene and selec
 from the list of available nodes. You can animate the attractor's position or attach it to a
 from the list of available nodes. You can animate the attractor's position or attach it to a
 moving node for more dynamic effects.
 moving node for more dynamic effects.
 
 
+.. tip::
+
+   If you don't have external tools to create vector field textures, you can use
+   a NoiseTexture3D with a Color Ramp attached as a vector field texture. The
+   Color Ramp can be modified to adjust how much each coordinate is affected by
+   the vector field.
+
 .. figure:: img/particle_attractor_vector.webp
 .. figure:: img/particle_attractor_vector.webp
    :alt: Vector field attractor in a field of particles
    :alt: Vector field attractor in a field of particles
 
 

+ 34 - 0
tutorials/3d/volumetric_fog.rst

@@ -217,6 +217,40 @@ the following properties in FogMaterial:
   You can import any image as a 3D texture by
   You can import any image as a 3D texture by
   :ref:`changing its import type in the Import dock <doc_importing_images_changing_import_type>`.
   :ref:`changing its import type in the Import dock <doc_importing_images_changing_import_type>`.
 
 
+Using 3D noise density textures
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Since Godot 4.1, there is a NoiseTexture3D resource that can be used to
+procedurally generate 3D noise. This is well-suited to FogMaterial density
+textures, which can result in more detailed fog effects:
+
+.. figure:: img/volumetric_fog_fog_material_density_texture.webp
+   :alt: FogMaterial comparison (without and with density texture)
+
+   Screenshot taken with **Volume Size** project setting set to 192 to make
+   high-frequency detail more visible in the fog.
+
+To do so, select the **Density Texture** property and choose **New NoiseTexture3D**.
+Edit this NoiseTexture3D by clicking it, then click **Noise** at the bottom of the
+NoiseTexture3D properties and choose **New FastNoiseLite**. Adjust the noise texture's
+width, height and depth according to your fog volume's dimensions.
+
+To improve performance, it's recommended to use low texture sizes (64×64×64 or lower),
+as high-frequency detail is difficult to notice in a FogVolume. If you wish to represent
+more detailed density variations, you will need to increase
+**Rendering > Environment > Volumetric Fog > Volume Size** in the project settings,
+which has a performance cost.
+
+.. note::
+
+    NoiseTexture3D's **Color Ramp** affects FogMaterial density textures, but
+    since only the texture's red channel is sampled, only the color ramp's red
+    channel will affect the resulting density.
+
+    However, using a color ramp will *not* tint the fog volume according to the
+    texture. You would need to use a custom shader that reads a Texture3D to
+    achieve this.
+
 Custom FogVolume shaders
 Custom FogVolume shaders
 ------------------------
 ------------------------