Particle Volume Cloud

 
 
 

Density | Color | Shading | Marching | Lookup Table | Preview | Framebuffer | Final Gathering | Shadows | Render Tree Usage | Basic Workflow for Using the Particle Volume Cloud Shader

Category: Particle

Shader Family: Volume

Output: Color

The Particle Volume Cloud shader is a volume shader that renders a point cloud's bounding box as a volume. This shader lets you create particle volumes with a low density like clouds, dust, smoke, and fog.

Because rendering volumes and raytraced shadows can be time-consuming, this shader uses a lookup table to store the shadows and other volume data of adjacent voxels (voxels are points/areas in 3D space).

TipFor information on how to get started with setting up this shader, see Basic Workflow for Using the Particle Volume Cloud Shader.

Shader Compounds

You can use the Particle Renderer or Particle Shaper shader compounds to get going quickly with particle volumes. They both contain variations of the Particle Volume Cloud shader, the Particle Density shader, plus some other shaders to help you set up for basic volume effects. As well, fewer parameters of these shaders are exposed so they're simpler to use.

See Particle Renderer Compound for information.

Tips for Lighting Volumes

Here are some general tips to help you set up the lighting for particle volume effects:

  • A rule of thumb with all rendering: always set the lighting first to create the correct look for the particles, then set the color.

  • Put light into the center of the base of particle cloud volume to create a glowing, light-scattered effect.

  • If you're creating smoke and you want it lit at the edges (rim lighting), use two or more back lights.

  • On the Shading tab, you can select specific lights in your scene to use for rendering. By default, all lights in the scene are used.

  • Self-shadowing is always enabled for all lights.

  • If you're using light Scatter option on the Color tab, set the Light Attenuation values for your light (such as a point light) to determine how the light's intensity falls off over distance, which affects the light scattering.

Density

Density Input

Density Input

Controls the shape of the volume. This is the most important input of the shader that determines the shape of the particle volume. The input can be the Particle Density shader, with or without the Fractal Scalar shader attached, for example, or the Particle Shaper compound.

Contrast Amount

The contrast of the opacity and transparency of the particle's density, mostly at the edges of the particle. This controls the contrast falloff from the center to the edges.

Low contrast values create a softer, diffuse look while higher contrast values sharpen up the detail and bring out the shadows more.

If you're using a fractal shader for creating density noise, increase this contrast as a first step to help you more easily see the noise shape.

Contrast Center

Determines the contrast of the opacity and transparency of the density in the particle's center.

Density

Global Density

The density of each particle volume. This sets the overall effect of the density on the particle, with the center of the particle being more opaque than its edges.

Low density values give softer, smoother effects (more transparency) while higher density values create more well-defined details and edges (more opacity).

Per Ray Type

Fine-tunes the density of the volume depending on the ray type:

  • View - the amount of color used in the volume — see Color.

  • Shadow - the amount of shadows in the volume.

  • Scatter - the amount of light scattering used for the volume, if you have the Scatter option selected — see Illumination.

  • Absorption - the amount of color absorption used for the volume, if you have the Color Absorption option selected — see Absorption.

Example Global Density/Contrast Amount Settings

 

Density 0.05

Density 0.15

Density 0.75

Density 3.00

Contrast 0.5

       

Contrast 0.95

       

Distort Texture Coordinates

Distort Texture Coordinates

Distorts the whole volume (with particles) based on an input texture. Useful for adding detail to smoke, such as that from cigarettes.

Noise Input

Sets the warp noise: RGB values of 0.5 for each does not shift the other textures. Red shifts the texture space in X, Green in Y, and Blue in the Z direction.

Intensity

Intensity of the distortion shift.

Distort Examples (2D)

Original Textures

Warp Noise 1

Result 1

     
     
 

Warp Noise 2

Result 2

     
     
 

Warp Noise 3

Result 3

     

Color

Color

For tips on setting up the color values, see Particle Volume Cloud.

Diffuse

The "main" color that is distributed over lit areas of the particle. It is used by the Illumination and Scatter options, below.

To see the results of this parameter in the render region, make sure that the Shading option is selected on the Preview tab.

Diffuse Intensity

Scales the Diffuse color.

Ambience

A secondary color that is used to affect the color of the shadows of the particle. This color is always added to the volume: it is not influenced by the scene's lights or global ambience.

To see the results of this parameter in the render region, make sure that the Shading option is selected on the Preview tab.

Ambience Intensity

Scales the Ambience color.

Illumination

Illumination

Sets the overall illumination of the volume.

If this option is not selected, the volume is lit only by the lights that you define on the Shading page.

To see the results of this parameter in the render region, make sure that the Illumination option is selected on the Preview tab.

 

  • Illum color: Color for the overall illumination.

Specular

Enables specular highlights for the particles.

To see the results of this parameter in the render region, make sure that the Specular option is selected on the Preview tab.

 

  • Specular Color: Color for the specular highlight.

 

  • Decay: Falloff of the specular highlight, which affects its size.

 

  • Rim Reduction: If the particle volume is lit from almost behind, the highlights tend to be very wide but still bright. Use this parameter to reduce the specular intensity for backlit cases.

Scatter

Computes single light scattering inside the particle volume. This adds light to help create good shadows and more realistic looking effects for smoke and clouds.

The Per Ray Type - Scatter option on the Density tab sets the overall amount of scattering used for the volume.

To see the results of this parameter in the render region, make sure that the Scatter option is selected on the Preview tab.

You can set the Light Attenuation values in your light's property editor (such as a point light) to determine how the light's intensity falls off over distance, which affects the light scattering.

 

  • Intensity: Global color modifier for the scatter illumination.

 

  • Suppress: Limits how far the light scattering travels through the particle volume. The scattering is usually brighter around the area of the direct illumination. If scattering increases the brightness too much, use this parameter to reduce scattering in this area.

 

  • Max Distance: Sets the maximum distance that the light scattering can travel for the scatter calculation.

 

  • Scatter Sample Rate: Reduces the number of lookup table cells used for the scatter calculation. A value of 1.0 uses all neighboring table entries to calculate the scattering. A value of 0.5 uses half of the neighbors, so it's twice as fast to calculate.

Absorption

Color Absorption

Simulates the behavior of water absorbing colors. The water absorbs red first, then green. Select this option if you are rendering volumes that you want to look like water.

The Per Ray Type - Absorption option on the Density tab sets the overall amount of absorption used for the volume.

 

  • Absorption for Shadow Rays: Absorbs shadow rays in the volume.

 

  • Absorption Color: The color of the particle volume with Color Absorption.

This is the volume shader without absorption. The more distance you have to a sphere, the more water is occluding the sphere.

This example has absorption enabled. Inside water, not every light color is transmitted equally. Red is absorbed at first, then green,

Ambient Occlusion

Ambient occlusion simulates indirect illumination which gives good detail in the shadows, as well as fractal noise patterns such as those created by the Fractal Scalar shader.

Ambient occlusion works by firing sample rays into a predefined hemispherical region above a given point on an object's surface in order to determine the extent to which the point is blocked (occluded) by other geometry.

Once the amount of occlusion has been determined, a bright and a dark color are returned for points that are unoccluded and occluded, respectively. Where the object is partially occluded, the bright and dark colors are mixed in accordance with the amount of occlusion.

Ambient Occlusion

Calculates simple ambient occlusion, as described above.

The Ambient Occlusion is calculated for the lookup table, therefore it is not useful for details, nor does it take normal directions into account.

To see the results of this parameter in the render region, make sure that the Ambient Occlusion option is selected on the Preview tab.

 

  • Max Distance in volume cells: Sets the maximum distance for the sample rays that are fired from a given point for the Ambient Occlusion calculation. Using lower values renders more of the details and cracks of a volume.

 

  • Intensity: Sets the overall intensity of the result of the Ambient Occlusion calculation. Using higher values creates more well-defined details in the shadows.

 

  • Color: The Ambient Occlusion color, which affects the shadow color.

Shading

Shading

Shading Model and Strength

The illumination of the volume changes with the angle of camera to the main light (Select the main light in the box below).

 

Constant (shading only by self-shadowing): Camera/Light/volume angle does not matter, it always uses full illumination. This is often good for shading particles as smoke or clouds, where you want more of a flat look, and the illumination creates shadows and defines the particle volume.

 

Lambert: The illumination changes with the cosine of the angle.

Strength = 0 is the same as Constant shading,

Strength = 1 is Lambert shading

 

Linear: The illumination changes linearly with the angle.

Strength = 0 is the same as Constant shading,

Strength = 1 is full linear shading.

 

Rayleigh/Henyey-Greenstein (He-Gr): Most of the light is reflected back to the light and is transmitted in the light's direction. This is the most physically correct interpretation for volumes like clouds (normal shading is not recommended for this mode).

Strength = -1: Most of the light is transmitted in the light direction.

Strength = 0: Amount of light transmitted and reflected is the same.

Strength = 1: Most of the light is reflected back to the light.

Mix with Flat Shading

If you selected Rayleigh/He-Gr as the Shading Model, you can select this option to mix it with constant (flat) shading.

The following graphs show the brightness of the object depending on the angle light-camera (light-normal, respectively). For each shading model, different strength values have been used.

Linear

Lambert

Rayleigh/He-Gr

     

Normal Shading

Normal Shading

Creates a normal for the illumination. The illumination is calculated by the normal-light angle (same as for hard-surface objects - think of rendering a sphere).

If this option is off, the camera-light angle is used.

You should use normal shading for dense volumes with structure which would be lost with shading from only shadows.

This shading can be useful for rendering particles to look more like 3D objects instead of smoke, such as bubbles or blobs.

Only Main Light Shading (finer if only one light used)

The light direction is calculated for every sample. The disadvantage is that only one light is supported (the Main Light, which you have to pick below).

If this option is off, a light direction averaged between all lights is used and interpolated between the lookup table cells.

The following images show renderings of a volume sphere from different camera directions.

Note that shading without normal shading looks constant in this example, but don't forget the shadows! They will do their part for the shading and darken volume areas farther away from the light.

View Direction

         

Linear

         

Lambert

         

Rayleigh/He-Gr

         

Linear + Normal

         

Lambert + Normal

         

Rayleigh/He-Gr + Normal

         

Lights

Restrict Illumination Lights

By default, this shader uses all lights in the scene to illuminate the volume. However, if you have many lights, you should consider using only specific ones to illuminate the volume to save rendering time. Every light used (especially raytraced shadow-casting lights) reduces the speed of the rendering.

Illumination Lights

If Restrict Illumination Lights is selected, you can add lights to this list. Only these lights are used to illuminate the particle volume.

Click Pick Item and select the light you want to add to this list from the pop-up explorer.

To remove a light from the list, select the light in the list and click Remove Selected.

Main Light Direction

This is used when Scattering or Normal Shading are selected.

Main Light Direction

The main light direction is used to calculate the Normal Shading (if Only main light shading is selected) and the Scatter direction (which is influenced by the shading model).

Click the Pick button and select the main light in the scene that you want to use for this.

Marching

The marching defines how often the volume is sampled along the camera ray.

Simple Mode

Simple Mode

If you select this option, then all marching settings are calculated according to the Detail level you select below. This is a simple way to use the default values. If you turn on info messages in mental ray, the shader displays the values used.

If you want to adjust some specific marching settings, deselect this option to display the parameters below.

Detail

Uses presets for the marching step settings.

  • Low Settings render in about 60% of the default setting's time.

  • Default Settings gives a good balance between detail and render time.

  • With High Settings, the particle volume takes twice the render time of the default settings.

Marching Step/Volume Detail

TipYou need to adjust the marching step if you change the size or shape of the particles or if you change the illumination of the cloud.

Max Adaptive Subdivision

The volume is sampled two times per lookup table cell (per camera ray). If subdivided 1 time, the cell is sampled 4 times; if subdivided 2 times, the cell is sampled 8 times.

Each cell is analyzed to determine if the subdivision is required. The higher the contrast/detail in the cell, the higher the resulting subdivision.

If this value is too large, the effect won't be detailed enough, but if the value is too small, the render times will be long.

If you use the Preview Mode (Preview page), the shader can show the subdivisions used.

Density Threshold

The threshold that determines if the sampling ray should be subdivided or not.

Fine Volume Detail

Light Samples per Cell

Usually, one sample is used to fill a cell with density, color, and illumination. However, if you have a very thin density texture, it's possible that this one sample will miss the texture.

For example, at one frame, the sample point is in the light; then on the next frame, the particle volume moves slightly and the sample point is in the shadows. This results in flickering.

You can lower the lookup table cell size to catch all shadow detail, but this requires more memory. Another solution is to increase the number of samples per cell. The shader then averages the light between the multiple sample points.

Stop Marching

Use Table if Alpha

If the alpha value reaches the limit, the shader does not call the input textures any more. It only renders the lookup table, which is much faster.

The lookup table does not have as much structure/detail, but you don't see the difference if you are that far inside the volume.

Evaluate input textures only if volume density is between ...

Min and Max

If the density input is outside the Min/Max value range, the shader uses the lookup table for density and color.

You don't usually need to change this value. However, if you are rendering a volume with high density and a fine volume structure, you should increase this value to increase the Min/Max range. Reducing the range increases render times.

Lookup Table

The lookup table is a very low-resolution version of the particle volume. It stores color and shadow information for a fast lookup. The shader computes all shadows for this low-res volume and applies it to the final volume. The final lookup table you create should cover the average shape of the particle volume, but does not require detail, which is provided by the input texture shaders.

For information on how to set up the lookup table, see Setting the Lookup Table.

Rendered cloud

Lookup table of cloud

Lookup table interpolated with rendered cloud

     

Generally, the shader uses voxels to create volume per particle. You can define the voxel size by setting the cell size in the lookup table. Smaller cell sizes create a better look and nice shadows, but more time and memory is required; larger cell size is faster and takes less memory, but gives little interpolation, so the look is not as good or detailed. As with anything in rendering, this is the eternal struggle: time and memory versus detail and good looks!

The more detail you have in your volume, the more cells you need for your shadows, otherwise you could get flickering shadows. If you have lots of detail in your volume, but you want to use big cells for smooth shadows, increasing the number of input samples per cell can give you better results.

TipYou need to adjust the lookup table if you change the size or shape of the particles or if you change the illumination of the cloud.

Table Interpolation

Cell Interpolation

  • No Interpolation between cells: No blending is done between the table cells. This is fast, but should be used only to tweak the table size because you can see the voxels (cells).

 

  • Linear: Simple interpolation (default) between the cells.

 

  • Cubic: More complex calculation used for interpolation between the cells. Use this option if you can still see the rows (lines) of the lookup table, but you already have enough table resolution to catch all shadows.

 

  • Full Light Raytrace: This option is the slowest. Use it for very dense volumes with a very small edge falloff, such as volumes that have too much shadow detail for a lookup table. You need to set a cell size because the lookup table is used not only for shadows.

Lookup Table Cells

You can define the voxel size by setting the cell size in the lookup table. You should aim to set this size to something that is appropriate to the size of the particles.

For example, if the particle size is 0.5 units, you should not set the Cell Size to something much higher if the particles are separated in space. Large cell sizes can sometimes lead to non-rendered blocks, if a detail (a single particle in space) is missed by the lookup table.

But don't set it too small either! If you have a particle size of 10, don't set the cell size to 0.5. Small cell sizes lead to long render times, which you want to avoid when you are testing out values.

Cell Size

Smaller cell sizes create a better look and nice shadows, but more time and memory is required; larger cell size is faster and takes less memory, but gives little interpolation, so the look is not as good or detailed.

You may want to keep the cell size large for general working and previewing, then make the cell size smaller when you're ready to do final tuning and rendering.

You will need to adjust this setting if the particle volume size is animated so that it also changes over time.

Note: The particle volume's bounding box is filled with whole cells only. As a result, the bounding box may shrink a bit to fit to the cell size.

Set Cells by Size

Sets the cells by size. If this option is off, you can set the number of cells using the No. of Cells parameter below.

No. of Cells X/Y/Z

If your volume does not change its size, then you can set the number of cells in X/Y/Z. This does not have the limitation that the particle volume's bounding box shrinks to fit to the cell size.

Motion Blur

Motion Blur Samples per Cell

If you use mental ray motion blur, the shadow lookup table needs to motion blurred too. This is similar to the motion-blurred shadow map. This value controls how many light samples are used per cell.

Memory Limit

Max Memory to Prevent Crash

While you are tuning the shader, you will probably reach the memory limit. This parameter catches this case and prevents mental ray from stopping the rendering. It causes the volume to be rendered with lower settings and in a red color to warn you that you are reaching the memory limit.

For tips about reducing the memory used, see Memory Limit.

Bounding Box

Auto Bounding Box

The shader uses the Manual BBox value and cuts it by the automatically calculated bounding box. If have set your Manual BBox to a large value, this parameter reduces it to the necessary size. It only reduces the bounding box size — it does not increase it.

Manual BBox

You can define a bounding box in which the particle volume is rendered, such as to use a smaller bounding box to reduce memory usage.

Use Camera Coordinates

If you select Manual BBox, you can define the bounding box relative to the camera.

Min/Max:

  • X is left to right

  • Y is top to bottom

  • Negative Z is behind the camera, and positive Z in front of the camera

If the volume is behind the camera or on the outer left of the image not casting shadows in your view area, you can just clip it away and save memory.

Preview

You can preview the effects of this shader using only the options on this page. This is useful for isolating and optimizing different options for troubleshooting. For the final rendering, however, the "real" settings on the other property pages are used.

Preview Mode

Preview Mode

With the preview mode, you can easily switch the total render times by influencing the lookup table and ray length. You can also render the lookup table for tuning, or render the volume in slices to check a texture.

Deselect this option when you're finished previewing and are ready for the final render.

Use Preview for Render Region Only

The preview is only used for the render region, but not for the final pass rendering.

If you are shading other objects in the scene, you probably don't want to wait for the slow volume rendering. However, you don't want to hide the volume because it will completely change the look of the scene (and you might forget to turn the volume back on).

Select this option to keep the volume in your scene while working, and still render it in the render region.

Lookup Table

Reduce

Reduces the number of cells by increasing the width of the cell. Use one of these multipliers to increase the cell width: X2, X3, X4, X5, or X10.

Render Lookup Table

The shader renders only the lookup table and no further detail. This is useful for tweaking the table.

Show Cells Detail Level

The lookup tables are rendered in a diagnostic color to show how the marching subdivision value is used.

Subdivision = 0: dark gray; 1: blue; 2: red; 3: green.

Fast Cell Shadows

Uses larger cell sizes with a single shadow ray for creating shadows more quickly.

Enable/Disable

Select each option that you want to render: Illumination, Shading, Specular, Ambient Occlusion, and Scatter.

If that option is not selected, the shader does not render that feature.

Slices

For tips on setting the Slices parameters, see Particle Volume Cloud.

Slices

Select an axis along which to render the volume as parallel planes: Slices in X, Y, or Z.

Number of Slices

Defines how many slices are rendered.

Density

Density of the slices.

Transparent Edge

Each slice is composed with the density over the background.

If this option is off, each slice is composed on black to see the extent of the slice.

Color

The color of the slices. You can select Coordinates (XYZ=RGB) or any of the input textures (Ambient, Diffuse, Specular, Final Gathering, or Distortion).

Framebuffer

You can render some color channels of this shader into framebuffers. Framebuffers are used to store rendered pixel data, then the buffer content is output to image files which can be used in compositing programs. For more information about framebuffers in general, see Render Channels & Framebuffers.

If you select Not in Main Buffer for any of these options, that channel is rendered only in the frame buffer, but not in the main image.

Ambient

See Color.

Illumination

See Illumination.

Specular

See Illumination.

Scattering

See Illumination

Final Gathering

See Final Gathering.

Distance

The minimum and maximum distance from the camera.

Motion

Maximum motion in screen pixels. Use this framebuffer to output motion vector data that can be used for motion blur in a compositing program.

Ambient Occlusion

See Ambient Occlusion.

Ambient2

This is a second Ambient input, in case you want to render a second color. You can set the color of it here.

Normal

If you use Normal Shading, you can render the normal into a frame buffer for post-lighting.

See Normal Shading.

Final Gathering

Final gathering is a way of calculating indirect illumination without using photon energy. Instead of using rays cast from a light to calculate illumination, final gathering uses rays cast from each illuminated point on an object's surface. The rays are used to sample a hemispherical area above each point and calculate direct and indirect illumination based on what the rays hit.

NoteFinal gathering in combination with volume shaders can result in render artifacts.

Cast Final Gathering

Cast FG

Select this option to have the particle volume illuminate the surrounding objects with its final gathering color.

FG Cast Color

The color that is used to illuminate the final gathering.

Cast Intensity

Sets the intensity of the final gathering cast from this particle volume.

  • FG Cast color: The intensity of the FG Cast Color.

  • Illumination: The direct illumination from all lights to the particle volume.

Receive Final Gathering

Sets the marching step size for final gather rays.

Receive FG Shading

Select this option to have the particle volume illuminated by the final gathering color.

FG Receive Color (Radiance)

Adjust the final gathering illumination received by the particle volume.

Get Input Normal for FG (Density input shader)

Uses the normal information for final gathering from the shader (such as Particle Density) that is plugged into the Density port of this shader.

Double-Sided FG

The particle volume checks for FG illumination from both the front and back sides.

Back Face Intensity

Determines how much of the particle volume should be illuminated by FG rays from the other side (inverted normal).

Shadows

Shadows

Use Illumination Light List for Exterior Shadows

The particle volume casts shadows for only the lights that are in the Illumination list. This way you can remove the shadows for specific lights

Interior/Self shadow

Interior shadows are the shadows rendered inside the particle volume. This setting changes the calculation method for the shadows at a volume sample point.

  • All light rays: The shader uses all light rays to calculate shadows.

  • One Single Shadow Ray (faster area lights): The shader shoots one ray to the outer face of the particle volume in the direction of the light and calculates the self-shadow (one ray for each light). Then it adds the light which hits the outer surface of the volume. This mode makes rendering area lights faster.

    This option ignores if the shadow is enabled or not for the lights: it always uses self-shadowing.

Shadow Saturation

Changes the saturation of the shadow.

  • 0.0: The shadow is only influenced by the density, no color.

  • 0.5: A bit of the particle volume color is added to the shadow.

  • 1.0: The shadow is completely influenced by the particle volume color.

Adjust Shadow Color

Adjusts the color of the shadow.

Default shadow ray

Shadow table

Shadow table with table interpolated

     

Render Tree Usage

The Particle Volume Cloud shader is the base shader for creating particle volume effects, but you need to use the Particle Density shader with it to give each particle a shape within the volume.

1

Plug the Volume output from the Particle Volume Cloud shader into the Volume port of the Material node.

2

Plug the Particle Density shader into the Density port. This shader defines each particle within the volume so that the point cloud doesn't look like a single volumetric mass.

3

You can then plug the Fractal Scalar or Cell Scalar shader into the Particle Density shader to add noise to the density. For more realistic or complicated smoke effects, you may want to use two Fractal Scalar shaders, or a combination or Fractal and Cell Scalar shaders.

4

You can plug the Particle Gradient shader into the Particle Density shader to use a gradient on the global color and/or global density.

If you use this shader to define the color, you must plug the Particle Density's Color output into one or more of the Particle Volume Cloud's Color ports, such as Diffuse Color.

Basic Workflow for Using the Particle Volume Cloud Shader

Open the Particle Volume Cloud shader's property editor and follow these guidelines for getting set up:

  1. You first need a Density Input (see Density). Plug the Particle Density shader into the Density port of the Particle Volume Cloud shader.

    You can also plug the Fractal Scalar shader into the Particle Density shader to add noise to the density.

  2. Don't worry about the color for now: just set the Ambience to white (see Color).

  3. You need to set the Lookup Table (see Lookup Table) to something which is appropriate to the size of the particles.

    For example, if the particle size is 0.5 units, you should not set the Cell Size to something much higher if the particles are separated in space. Large cell sizes can sometimes lead to non-rendered blocks, if a detail (a single particle in space) is missed by the lookup table.

    But don't set it too small either! If you have a particle size of 10, don't set the cell size to 0.5. Small cell sizes lead to long render times, which you want to avoid at the beginning.

    Once you're familiar with the Particle Volume Cloud shader, you will know some good starting values for the lookup table.

    TipRemember that you have to adjust the lookup table if you change the size or shape of the particles or if you change the illumination of the cloud.
  4. The same rules that apply for the lookup table also apply for the Marching Step size (see Marching).

    You can keep the Simple Mode option selected to use the default values, but if you want to do some adjusting, deselect the Simple Mode option.

    For the Maximum Adaptive Subdivision, use a value which creates a bit of noise. If the value is too large, the effect won't be detailed enough, but if it's too small, the render times will be too long.

    You have to adjust the Marching Step if you change the size or shape of the particles.

    Setting the Shape and Color

  5. Back to the Density Input: Now, as you see your volume, you might already change some input shaders/particle attributes and the Density sliders.

    • If you use a fractal shader as the Density Input, it is often useful to use it as the Ambient texture first.

    • Take a look at the texture. Especially if you shape particles, you should first get a sense for the size of the noise.

    • Increase the contrast of the noise as a first step. It is much easier to see the noise shape.

  6. Illumination (see Color): After you have checked the rough shape of the volume and rendered with a white ambient light, you can enable the illumination for a better workflow with a shaded cloud.

    • Reduce the Ambience color to 0.2 for each RGB value.

    • Select the Illumination option.

    • Add a light to the Illumination Lights list (see Shading), probably a simple directional from above.

    • Enable Shadows for the light and set its shadow Umbra to black.

    Slices Mode

  7. Sometimes it can help to use the Slices mode (see Preview), especially if you try to adjust the shape of the cloud. Try out the Slices mode using the images below as a guide.

    The following example is a slice through particles. A fractal was used for the Density Input shape of the particles. The first value of the fractal remains at 1, the second value was adjusted as shown in the following images.

           

    Second value = 1.0 (no influence on shape)

    Second value = 0.5

    Second value = 0.0

    Second value = -0.5

    Setting the Lookup Table

  8. Set up the lookup table as shown in this section.

    For information on the lookup table parameters, see Lookup Table.

Cell size: Cover the volume shape

The lookup table is a low-resolution version of your volume object. It should cover the shape of the object, but does not require detail, which is added by the input textures.

If it does not cover the shape, then it can be that some parts of your volume are not ignored.

  • Enable the Preview Mode (see Preview), set the Lookup Table Reduce value to "---", and select the Render Lookup Table option.

  • Set the Cell Interpolation (see Lookup Table) to No Interpolation. This way you can clearly see the size of the cells.

  • Then change the Cell Interpolation to Linear to see the result.

       

A. Final render of the cloud (no "Render Lookup Table" in this image)

B. Cell size is too big: the correct shape is not really recognizable. Notice that the two "arms" of the volume are almost gone.

C. Correct cell size: The shape of the volume can be recognized, but this is correct for only the shape - for the shadows, see the next section below.

D. Cells are too small: You can even see the texture at the rim of the volume.

Cell size: Cover the shadows

The lookup table holds the illumination/shadow information for the whole cloud. If you have small shadows, either from other thin objects casting shadows on the volume or from small details of the volume itself, then the illumination could flicker.

Now take a look at the images above. Image C was correct for the shape, but the shadow is very hard, the edge of the volume is crisp, and small details are already casting shadows.

The small, separate particle at the top right is casting shadows on the main particle cluster, but in image C the shadow is almost gone and very blurred. It will definitely flicker. In this case, the cell size for the final render should be something between Images C and D.

As long as you can see the lines of the table (when you render the table only), it will probably flicker in your animation. Try using Cubic Interpolation, reduce the Cell Size, or use multiple samples per cell for illumination.

Cubic interpolation

If you have medium-dense particles, you can sometimes see the lines of the lookup table, although the lookup table has enough resolution to catch all the shadow detail.

Take a look at the following image. If you follow the blue lines into the volume, you can see the lines inside the illumination of the cloud.

If you select Cubic Interpolation, the lines will disappear.

Multiple Samples per Cell

Usually, one sample is used to fill a cell with density, color, and illumination. However, if you have a very thin density texture, it's possible that this sample misses the texture. This results in cubic holes (see following image).

If you have a density texture with a very small and hard contrast, it's possible that a sample could hit a small white point on the texture, even though the average color in this area is gray. The result will be flickering in the alpha of the lookup table.

To eliminate this problem, you can use multiple samples per cell (deselect the Simple Mode option on the Marching page to display the parameters you need — see Marching).

Memory Limit

The shader has a Memory Limit setting for the lookup table (see Lookup Table). Without this limit, you can easily reach a few GB of memory for this shader, which would lead to a render exit of mental ray.

An automatic reduction of the lookup table is not possible because it would lead to strange behavior of a sequence (such as the lookup table flickering from frame to frame).

If you reach the memory limit, the shader issues an warning message into the log file of how many MB the table would take.

Because you probably don't look into the log every time you render, or can't because it is a single frame in a farm-rendered sequence, the shader will reduce the lookup table to 20x20x20 and turns the volume red. The red volume is basically a warning that if the shader were to continue with the current settings, it would take all the memory.

Here are some steps to take to help you reduce the memory used:

  • Increase the Cell Size: This is the first step. Take a look at the Cell Size tips previously discussed. If it flickers, try to use multiple samples for each cell (Density and Illumination).

If you cannot reduce the cell size in all directions, try to reduce it in only one axis. For example, if the light is coming from the top, then you need more shadow detail in the top-bottom direction.

  • Animate the Cell Size: You have a close-up and need fine shadows, but you also see the total volume at a different frame? Just animate the Cell Size value.

  • Increase the Memory Limit value, which is set to 1250 MB by default.

  • Disable features: The lookup table takes a different amount of memory depending on the features you activate:

     

    Illumination and Ambient Occlusion

    +14%

    Normal Shading, main light only

    +43%

    Normal Shading

    +86%

    Scattering

  • Reduce the particle volume size: Very often, you emit particles and they just fly through your whole scene until they die, even though you are just rendering some the particles. If you use an obstacle that kills the particles after they pass the camera, you can save a lot of memory (consider shadows and reflections from outside the view area).

  • Combine Auto Bounding Box with Manual Bounding Box: If many of the particles are not seen (such as if they are behind the camera), then you don't need to include the whole particle object in your rendering. You can restrict the Auto Bounding Box of your particle object with a Manual Bounding Box. For example, select Manual BBox and the User Camera Coordinates options, and limit the Min/Max Z bounding box size in the negative Z direction (behind camera).

  • Axis-aligned volume: The lookup table is axis-aligned. If your particle stream moves diagonally, you can waste a lot of cells on empty space. You could rotate the scene's world (camera, lights, emitter, forces) or rotate the particle object.

Switch to table

On rare occasions with high densities and a fine volume structure, the lookup table could be visible (see first image below).

To solve this problem, deselect the Simple Mode option on the Marching page.

Then increase the Max value for the Evaluate input textures only if volume density is between parameter.