LuxRender Volumes - LuxRender Wiki
Luxrender GPL Physically Based Renderer

LuxRender Volumes

Personal tools

From LuxRender Wiki

Jump to: navigation, search

LuxRender includes a flexible, powerful volume system that controls how light behaves when it moves through objects or the space in-between objects.

Typically, when creating a scene that uses volumetric rendering you create a set of medium types, which are then assigned to the interior and exterior of objects in the scene. The interior medium defines how light moves within the object, the exterior medium defines how light moves through the space between the object it just left and the next one it encounters.

The interior volume setting is primarily used to give absorption and internal scattering to the object it is assigned to. In most cases you will create a separate medium for each material you want to have internal absorption and scattering effects with. The exterior volume setting is generally used to provide atmospheric effects, and is kept the same for all objects in the scene.

As of LuxRender 0.8, volumes do not have a precedence system. This means that when light moves from one volume to another without passing through air (for example a liquid in a glass), you will need to assign a separate material to the surface where those volumes touch, using the volumes of those two objects as its interior and exterior volume.

When using volumes, some care must be taken with planar meshes such as leaves or cloth. You must make sure to attach the atmosphere volume to both the interior AND exterior of the mesh, or else some paths involving the surface may confuse Lux as to which volume is which, leading to incorrect appearance for the mesh. (Do not try to use SSS with planar meshes, it will not work). The reason for all of this is that exterior defines what is in front of the face, and interior defines what is behind it. In the case of a planar mesh/open shape, this would be the same air/water/fog/vacuum/etc on both sides, so both volumes must be that same air/water/fog/vacuum/etc. (leaving both of them blank counts as "matching" since LuxRender assumes a blank volume is just a vacuum). Alternately, you can try using a "solidify" tool in your modeler to make the mesh a closed volume.

In some cases having the volume continue behind the plane is desired, such as using a glass2 plane as the surface of water in an opaque container. In this case, the volume will continue beyond the plane until it hits a solid object, which will give you volumetric water while only ever modeling the surface.

Contents

Volume Types

Clear

The clear medium used with the glass2 material


Clear is a simple volume that features refraction and absorption but no scattering. It is primarily meant to be used with clear materials, in particular the glass materials. It takes an index of refraction and an absorption color.

index of refraction / fresnel texture

The refractive properties are defined by a texture of the Fresnel type assigned to the volume. If your exporter uses your modeler's built-in materials and texture editor, it may require you to create a new texture, assign it to the volume, and define these properties from the textures editor. Some exporters allow you to key in an IOR value directly that will be exported as the "constant" texture.

Not all materials require that an IOR be assigned to the clear volume. In fact, in LuxRender 0.8 (and previous versions), the only material that will use it is glass2, all others either do not account for refractions in the first place, or have their own IOR settings that will be used instead.

Index of refraction examples. From left to right, hydrogen gas (1.000132), ice (1.31), common crown glass (1.519), heavy flint glass (1.805), and diamond (2.41)


absorption color

The absorption color determines how light is lost as it passes through the volume. This defines an attenuation rate, meaning that the color will be become more dark and saturated the farther it travels through the volume. It also means that this color control will seem to work "backwards". If you specify the raw absorption color as red, it will remove red light, leaving you with a cyan volume.

Since this is very counter-intuitive for many people, most exporters offer an abstraction called "Color @ Depth". This control takes an RGB color and a distance of how far a light ray should travel through the volume before reaching that color. It will then create the actual absorption color for you based on that data. If a ray travels exactly the given distance, it will match the color you set. If it travels a shorter distance, it will be lighter and less saturated than the given color. If it travels farther than the specified distance, it will be darker and more saturated. Unlike the normal absorption color, color @ depth allows you to set a color and have your volume actually be that color. It is important to remember that color @ depth will not work with textures, since it is pre-computed by the exporter.

It is also possible to set absorption using measured data, via the tabulateddata texture type. This should be attatched to the absorption color channel, and color @ depth disabled. If your file uses a unit other than meters for distances, you can use the absorption scale control to correct for this.

Depth of absorption. From left to right the depth of absorption is 10m, 1m, 10cm, 1cm, and 1mm.


Saturation of absorption color. From left to right the saturation is 0.0, 0.5, 0.9, 0.999 and 1.0.


The clear medium used with the roughglass material. Model courtesy of Stanford Computer Graphics Lab. Floor texture by patro


Homogeneous

Smokeball.jpg Air homogeneous.jpg

The homogeneous volume represents a volume with an even distribution of microscopic particles. When used as an interior volume, it can be used for sub-surface scattering (SSS), cloudy liquids, or rendering an object as smoke (like the example above). It can also be used as the world volume, which will enable atmospheric scattering.

IMPORTANT: Atmospheric scattering is very light. To simulate it efficiently, you should use the "single" volume integrator, not "multi". This will greatly reduce the noise in the scene. The "multi" integrator should be used with heavy internal scattering (aka SSS)

Homogeneous uses the same index of refraction and absorption parameters as the clear volume. In addition to those, it has two extra parameters, scattering coefficient and scattering asymmetry.

scattering coefficient (sigma_s)

The coefficient determines the color and density of the particles. Higher values are denser. This control can also affect the color of your volume, but that will be determined primarily by the absorption color:

Left: colored absorption with gray scattering. Right: colored scattering with gray absorption. Both use RGB .1-.1-.9


The effect of absorption depths and scattering scales on a material with colored absorption


While the absorption color has red, green, and blue values, it is not strictly an RGB float like other color fields. You can specify values higher than 1. In fact, for interior volumes you will often need to use values in the 30-100 range, or even higher. For atmospheric effects, a value of about .1 is plenty, and may even be too much. To help deal with this wide range of values, most exporters will present you with a set of RGB values and a "scale factor" that the RGB values will be multiplied by. So if you want a final coefficient around 100 with a blue tint, you could set the scale factor to 100, and use .9, .9, 1.0 as the RGB values. This will result in the final coefficient of 90, 90, 100.

An example of various values for sigma_s when used for atmospheric effects. Ceiling is approximately 2m high. Absorption set to leave light at 90% intensity at 40m. Sigma_s values, from left to right: 0.001, 0.01, 0.05, 0.1, 1.0


scattering asymmetry (g)

The asymmetry value is a number between -1 and +1 that determines if the scattering is primarily forward (light is scattered in the same direction as the ray was traveling) or backwards (light is scattered back towards where the ray came from). Positive values are more forward scattering (best for clear particles), negative values are more backward scattering (best for opaque particles). 0 is isotropic, meaning the light is scattered evenly in all directions.

You can see a screenshot of the setup in 3D space here.

Light passing through a volume that back-scatters blue at -0.25 and forward-scatters red at 0.25. Light traveling from left to right


Past and Present Volume Systems

It is important to remember that, as its name implies, the microparticles that make up the homogeneous volume are distributed evenly (as is the absorption of the clear volume). While it is possible to apply a color texture to sigma_s or absorption color, this will only be examined when the ray enters the volume, it will not consider that the volume may be heterogeneous (aka, the ray might encounter a change in volume properties during its transit through the volume).

Heterogenous volumes are not currently supported in the new volume system, although they can be used via the old "volumegrid" system if needed. Note that volumegrid does not fully support other LuxRender features such as the bidirectional integrator, and is eventually scheduled to be deprecated and removed once heterogeneous volume support is added to the new object volume system that is documented on this page.