diff --git a/tutorials/3d/img/volumetric_fog_fog_material_density_texture.webp b/tutorials/3d/img/volumetric_fog_fog_material_density_texture.webp new file mode 100644 index 000000000..fc264eeb8 Binary files /dev/null and b/tutorials/3d/img/volumetric_fog_fog_material_density_texture.webp differ diff --git a/tutorials/3d/particles/attractors.rst b/tutorials/3d/particles/attractors.rst index 2604b09f8..7b4012875 100644 --- a/tutorials/3d/particles/attractors.rst +++ b/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 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 :alt: Vector field attractor in a field of particles diff --git a/tutorials/3d/volumetric_fog.rst b/tutorials/3d/volumetric_fog.rst index 60f632fdf..1b84a2b17 100644 --- a/tutorials/3d/volumetric_fog.rst +++ b/tutorials/3d/volumetric_fog.rst @@ -217,6 +217,40 @@ the following properties in FogMaterial: You can import any image as a 3D texture by :ref:`changing its import type in the Import dock `. +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 ------------------------