LuxCoreRender Volumes

From LuxCoreRender Wiki
Revision as of 09:21, 6 December 2017 by Piita (talk | contribs)
Jump to navigation Jump to search

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

When creating a scene that uses volumetric rendering, you create special "mediums" or volume shaders, 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.

When using exterior volumes, some care must be taken with planar meshes such as leaves or cloth. You must make sure to attach the exterior/atmosphere volume to both the interior AND exterior of the mesh, or else some paths involving the surface may confuse LuxCoreRender as to which volume is which, leading to incorrect appearance for the mesh. Avoid using interior mediums on planar meshes, as that 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. If you do want to use internal volumes on planar meshes, you can try using a "solidify/thickness" tool in your modeler to make the mesh a closed volume.

When not assigning a volume, LuxCoreRender assumes a blank volume is just a vacuum. This will work fine for air, unless you need scattering.

In some cases having the volume continue behind the plane is desired, such as using a "glass" 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.

LuxCoreRender always requires objects to have a surface material defined. If you want a "volume only" object, such as for a cloud or smoke simulation container, add a null material to the surface to make it transparent.

Volume Types

Clear Volume

Clear is a simple volume that features refraction and absorption. It is primarily meant to be used with clear materials, such as colored glass. It can also be used to add some extra realism to translucent material with little performance cost. It has two properties, an index of refraction(IOR) and an absorption color.


Absorption Color

The absorption color determines how light is lost(absorbed) as it passes through the volume. This defines an attenuation rate, meaning that the color will be become darker and more 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, a special texture type is provided to simplify this, Color at Depth. This texture 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 output an absorption spectrum 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, and darker and more saturated if it travels farther. When you set this distance, you are not limited to the size of the object containing the volume. Unlike the normal absorption color, color at depth allows you to set a color and have your volume actually be that color. Its transmission-color value is also textureable.


Index of Refraction

The refractive properties are defined by the IOR value. Your exporter will have some preset ready for the most common volumes.

It's important to note that the only material that will use this IOR setting is glass2. Glass has got its own IOR setting and will ignore the IOR of the volume assigned to it. The other transmissive materials(null, matte translucent and glossy translucent) do not support refraction.


Homogeneous Volume

The homogeneous volume represents a volume with an even distribution of microscopic particles. When used as an interior volume, it can be used for subsurface scattering (SSS) or cloudy liquids. It can also be used as the world volume, which will enable atmospheric scattering.

Please note that atmospheric scattering is very light. To simulate it efficiently, you should keep multiscattering disabled in your exporter. This will greatly reduce the noise in the scene. Multiscattering should be used with heavy scattering volumes, such as milk or orange juice to simulate subsurface scattering (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 color and scattering asymmetry.


Scattering Color

The scattering color 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.

While the scattering color has red, green, and blue values, it is not limited to this range. You can specify values higher than 1 (pure white). In fact, for heavy interior volumes you will often need to use values in the 30-1000 range. For atmospheric effects, a value of about .01 is plenty, and may even be too much. To help deal with this wide range of values, your exporter will present you with a set of RGB values and a "scale factor" that the RGB values will be multiplied by.


Technical info:

Technically speaking, scattering color (also known as sigma_s) and absorption (also known as sigma_a) aren't so much colors, as probability values. To help understand them, you can think of them more simply as not being colors, just values or shades of grey. As a ray travels through the volume, one of two things can happen to it at any time. It can either be absorbed (losing its energy and disappearing) or it can be scattered (reflecting out in another direction). Sigma_a and sigma_s are the respective probabilities of these events occurring over a given travel distance. The higher they are, the shorter (on average) a ray needs to travel through the volume before an event occurs. For example, raising sigma_a increases the chance the average ray will be absorbed, thus darkening the volume. Raising sigma_s increases the chance of a scattering event, causing the volume to appear brighter and more dense.

As to why these are colors values, that becomes simple to explain: they are wavelength dependent. Rather than being a constant value for all frequencies of light, they allow different values for different colors of light. For example, making sigma_a yellow increases the chance that yellow light will be lost compared to other colors, causing the volume to take on the color of the remaining light (in this case, it's yellow's complement, purple).


Scattering asymmetry

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.



Heterogeneous Volume

The heterogeneous medium is the most powerful (and also the slowest) of the three medium types. It has the same functionality as the homogeneous volume, but it also includes ray-marching support. This means it can deal with volumes with varying internal properties, such as clouds, smoke, and ground-hugging fog.

The heterogeneous volume can be used as the exterior medium as well, although this comes at a substantial performance cost (even when not using multiscatter) and is not recommended in most cases. A dedicated "volume container" object should be used when rendering things such as clouds or fog. A simple cube with a null material works fine as a container.

The clear and homogeneous volumes evaluate volume properties only once as it enters the volume. They assume these properties hold constant all the way to other side of the volume. For volumes that are continuous, this is a helpful optimization. However, if the volume is not continuous (such as a cloud), this causes blurred details and the edges of the volume container to become visible. In order to handle changing details, heterogeneous subdivides the volume transit path into several sub-paths (a process known as ray-marching) and evaluates the properties again at each sub-point.


The heterogeneous volume has the same properties as the homogeneous volume, with one extra setting, step size.


Step Size

Step size defines the spacing between the ray-marching sub paths, in meters. Smaller steps will show greater volume detail, but are slower to render. Setting too large of steps may result in a blocky or noisy appearance of the volume.