YafaRay's volumetric features provide a simulation of light interacting with particles suspended in a region of space. A common volumetrics scenario is the "beam of light" effect, for example when light enters a dusty room through a window creating a visible shaft of light. YafaRay uses a realistic physics-based model to render volumetrics, and provides a basis for creating not just believable beams of light, but also smoke, clouds, fog, and other volumetric effects.
| Important: Use PNG or any other lossless format to save renders with volumetrics. JPG compression kills volumetrics detail. |
This section gives a brief overview of rendering volumetrics in YafaRay. Specific parameters and settings are covered in subsequent sections.
There are several basic steps necessary to render volumetrics in YafaRay. A brief outline of the workflow is:
An important characteristic governing the final appearance of volumetric media is density. It is intuitively clear that a greater particle density in a volume region equates to a more pronounced volumetric effect. Also, a method to control density is needed to render effects such as clouds or smoke, which have a variable density. So in YafaRay there are three different volume types for a region based on how density is controlled:
UniformVolume: a uniform density volumetric effect, useful for dust, fog, mist, etc.

ExpDensityVolume: like a UniformVolume, but decreases the density of the volume as height (in positive z direction) increases. Useful for ground fog, etc.

NoiseVolume: lets a blender procedural texture control the density of the volume, good for clouds, smoke, etc. Note that this method must be considered a "fake" compared to a realistic cloud or smoke density simulator that is unavailable in YafaRay.

One of these volume types can be selected for the volume region once Enable volume is selected.
The following sections discuss volumetric settings and parameters in detail.
The volume integrator settings are located in the World tab of the Yafaray UI, underneath the background settings. The settings here for the Single Scatter integrator pertain to the global precision of volumetric calculations. These settings have a considerable impact on render speed, and so they are important to control the balance of speed versus quality.

This parameter is the main control for the precision of volumetric rendering. Consider the following example setup with a volume, a camera, and a light source:

When a viewing ray shot from the camera (the blue lines) intersects a volume, the portion of the ray inside the volume is subdivided into "steps," with the length of each step being the value of the step size parameter (in blender units). At each step shadow rays are traced to all the light sources in the scene (the red line) to determine how much light reaches the step, and then from this information the total light contribution to the viewing ray is computed. This calculation at each step is called attenuation.
So the following conclusions about step size can be drawn:
Here are the rest of the volume integrator settings:

The volume on the left is grainy because the step size is too high (0.5). A lower step size on the right (0.1) corrects the issue, but is of course slower (four times slower in this case).

Volumes with Att. Grid Resolution of 1, 3, and 5, plus another with Optimize off for reference. Notice the improved shading detail with higher grid resolutions. Even at a grid resolution of 5 the render time was about one third compared to the render without Optimize on.
For reference, the texture settings used for the NoiseVolumes in the previous examples are shown below:

The volume region defines the general shape and characteristics of a volumetric effect. Volumetrics only occur inside of a volume region, allowing control over placement of a volumetric effect in a scene. When a volume region is the active object in a scene the volume settings in the Objects tab of the YafaRay UI control specific aspects of how a volume renders.
Some quick notes on volume regions:
The volume region settings in the Objects tab control specific qualities related to the look of a volumetric effect. Each type of volume region (UniformVolume, ExpDensityVolume, NoiseVolume) may have its own unique set of parameters, but every volume region type has parameters controlling two fundamental properties -- absorption (sigma_a) and scattering (sigma_s).

On the left is a volume with only absorption (sigma_a = 0.5), and has a dark smoky appearance. On the right is the same volume but with scattering added (sigma_s = 0.05), and has a denser, more complex look.

For reference, these are the texture settings used to create the previous example image.

These show the effect of scattering on light from spot lights. Notice how the the monkey object blocks light from the lamps, creating a shadowed area in the visible cone of light. Also note the interaction of the colored lamps in the volume.

These show the result of area lights in a volume. Here light from the area lamps is scattered widely across the volume.
This section discusses the different types of volume regions, including parameters and workflow specific to a particular volume type.
The UniformVolume type provides a basic uniform density volumetric effect within the volume region.

The parameters for the UniformVolume are limited to controls for absorption and scattering. These parameters were discussed in a previous section.
The ExpDensityVolume defines a density within the volume region that decreases with increased height (in the direction of the positive z-axis). This decrease is an exponential rate of decay, controllable using the two parameters height and steepness. This volume type is useful for effects such as ground fog where the effect is most pronounced close to the ground.

In addition to parameters for absorption and scattering, the ExpDensityVolume has the following settings:

In the above example H is height and S is steepness. Notice that increasing the value for height results in a denser volumetric effect near the floor, while decreasing the value for steepness results in a longer and slower transition from dense to not dense.
The NoiseVolume type allows the density of the volume to be controlled by a blender procedural texture. YafaRay translates the intensity values of a blender texture into density, with darker values on the texture corresponding to lower density and lighter values corresponding to higher density. This provides a method to approximate the look of different variable-density effects such as steam, smoke, clouds etc.

The NoiseVolume has the following unique parameters:

The above example illustrates the effect of both the sharpness and cover parameters (S=sharpness, C=cover). For those interested, the texture settings used to create this example volume are included below:

The blender procedural texture used to control the density of a NoiseVolume is the primary control for how this volume type looks. First, even though this information was mentioned earlier, it is so important that it will be repeated:
|
Important: when using NoiseVolumes the blender texture used must be called TEmytex, so that the texture setup looks like this:
If this exact name is not used blender will crash during the render process and all work will be lost. This limitation will be removed in the future. |

All settings relevant to the use of a procedural texture for a NoiseVolume can be found in blender's texture buttons panel (F6). Any procedural texture supported by YafaRay can be used as a texture for a NoiseVolume. More information on YafaRay and procedural textures is available in the Procedural Textures section of the manual.