Page 1 of 5

Using medium nodes

PostPosted: Fri Oct 28, 2011 5:14 am
by roeland
As of version 1.0 beta 2.55 OctaneRender supports participating media inside objects (absorption, SubSurface Scattering
and emission). These settings are stored in medium nodes, which are attached to the corresponding input pin of diffuse
or specular material nodes.

There are two types of medium nodes, absorption and scattering. Scattering has parameters for absorption and scattering of light passing
through the medium, and emission inside the medium. Absorption is a simple version with only absorption.

Rendering a medium requires the path tracing or PMC kernel, with a sufficiently large maxdepth setting. The direct light kernel
renders an approximation.


Participating media should only be added to meshes that define a closed volume, rather than planes. Using planes to model
leaves of a plant with SSS will for instance not work. Using a single plane as ground plane should be OK (it will be treated
as an infinively deep material). The mesh can have opaque objects nested inside, but nested participating media are not supported.

The normals of the mesh must be oriented properly (outwards).

How to make a medium node work

material node parameter setup for using medium nodes.

A specular material is the easiest: by default it is set up properly. Transmission must be nonzero;
for the best effect reflection and transmission should be set to 1.0.

On diffuse materials subsurface scattering only works after they are set up with diffuse transmission.
To do so, connect a node to the transmission input pin, or in the node inspector use the drop down box to create a
node (beta 2.58b and later).

The reflection value needs to be set to a sufficiently low value, as only the part of the spectrum that is not reflected can
enter the inside of the object. If the reflection is set to 1.0, all light gets reflected regardless of the transmission value. If
set to 0.0, all light gets transmitted, but this gives an unnatural appearance. Values of 0.1–0.2 are a good starting point.
Also, if the reflection is coloured, the transmitted light will have the complementary color (e.g. if the reflection is set to
yellow, the transmitted light is blueish).

The transmission value works the same as in the previous releases, and is multiplied with the complement of the reflection
spectrum. This should be set to a high value.

Medium node parameters

Absorption is controlled with the absorption texture, which defines how fast light is absorbed
while passing through a medium. A setting of 0.0 means no absorption. The higher the value the faster light is absorbed by
the medium. This setting is wavelength-dependent, in the following setup for example it is set to absorb blue light faster
than other colors, giving the object a yellow appearance.

Textures are restricted to values between 0.0 and 1.0, but the absorption value can have a wider range of values. To allow
setting these values the absorption texture is multiplied with the scale parameter.

absorption settings.png

Subsurface scattering is controlled by the scatter texture (multiplied by the scale value),
and the phase function. The scattering texture defines how fast light gets scattered when traveling
through the medium, in a similar way to how absorption is defined. A very high value means light gets scattered very fast, a
value of 0.0 means no scattering.

The phase function controls in what direction light gets scattered. There is currently one kind of phase function defined,
with one parameter, scattering_direction. If set to 0.0, it means light gets scattered the same amount in any direction. A
setting larger than 0.0 means forward scattering, the larger the value, the more light is scattered in a similar direction as
it was traveling. 1.0 means it doesn't change direction. A negative value means backscattering, so more light is scattered
back to where it came from. This makes objects appear brighter on the side where the light is coming from.

The following setup uses a wavelength dependent scattering. Blue light is scattered more, so it has more tendency to scatter
back out of the material before it gets absorbed. Yellow-red light is scattered less, so more of it goes straight through the material,
giving shadowed areas the yellow color.

node settings.png

Scattering can generate a lot of noise with small light sources and low roughness. You can increase the caustic_blur parameter
in the kernel settings.

For a fast approximation you can use a specular material with both scattering and fake_shadows enabled.

The unit for absorption and scattering is m^-1 (or 1/m). If you have a measured value in cm^-1 you can convert it to m^-1 by
multiplying it by 100. For example: suppose you want to enter 4.5 cm^-1. This equals 450 m^-1. You can enter this value by
setting the scale to 1000 and the absorption texture to 0.45.

Finally emission is defined by attaching an emission node to the emission input pin. When connecting an emission node to
a medium node, it defines emission inside the volume instead of at the surface of the object. The power parameter gets a
different meaning: it controls how fast the radiance along a ray increases while traveling through the volume, and not the
total power. It is not multiplied with the scale parameter.

This effect works best with large and not too bright objects, very small bright objects will create a lot of noise.

The following image shows a normal mesh emitter (left) and a volume emission (right). The emitter in the right side has specular
material with an index of refraction of 1.0 (making it invisible without the emission).


Re: Using medium nodes

PostPosted: Fri Oct 28, 2011 8:52 am
by bepeg4d
Thanks Roeland for the complete explenation ;)
ciao beppe

Re: Using medium nodes

PostPosted: Fri Oct 28, 2011 1:23 pm
by ycarry
Thanks Roeland!

Re: Using medium nodes

PostPosted: Fri Oct 28, 2011 1:32 pm
by Jaberwocky
Cheers Roeland in explaining it.

Re: Using medium nodes

PostPosted: Fri Oct 28, 2011 1:45 pm
by gabrielefx
very useful!!


Re: Using medium nodes

PostPosted: Fri Oct 28, 2011 2:02 pm
by cornel
Great, thanks!

I do have a question regarding the scattering direction.
How does it affect the render in detail?

Re: Using medium nodes

PostPosted: Fri Nov 18, 2011 3:16 pm
by nuverian
I didnt understand a think. Can't get SSS working no matter what..

Re: Using medium nodes

PostPosted: Fri Nov 18, 2011 4:44 pm
by t_3
cornel wrote:Great, thanks!

I do have a question regarding the scattering direction.
How does it affect the render in detail?

simply said, if scattered to the inside (+1) the material appears darker, if scattered to the outside (-1), the material appears brighter, toned by whatever texture or color is set in the scattering node...

@nuverian: just try to start with a dead simple diffuse or specular material and maybe place some emitters in a way, they help visualizing the effect. just turning on sss on premade materials doesn't work well, and the more textures or other settings are added to a material the harder it is to get it right - it also depends on what to expect from sss; i thought of it before like it was something magical, that you can turn on and -bang- everything looks great... of course it isn't that way ;) often in the final image the effect is hard to spot, but if you do some a/b comparsions, you know the difference (at least talking about common scenes, not the ones especially playing with sss as special effect)...

Re: Using medium nodes

PostPosted: Sun Nov 20, 2011 6:38 pm
by colorlabs
I just can't get any SSS at all, diffuse or specular, even copying & pasting the settings in these screenshots. Could someone attach some sample scenes where it works?

Re: Using medium nodes

PostPosted: Mon Nov 21, 2011 1:44 am
by t_3
... i tried to create a scene to give an idea what sss does; it uses the same settings for diffuse and specular materials, which is a bit complicated (because of the very different impact of the transmission color); it's not that exciting, but i'm not a pro in material creation anyway - and it should be simple (as requested) ;)

description of the image:
  • sphere 1: blue diffuse
  • sphere 2: blue diffuse + green transmission
  • sphere 3: blue diffuse + green transmission + sss (most visible on the shadowed side, because light is scattered back and the transmisson color gets less visible)
  • sphere 4: blue specular + green transmission
  • sphere 5: blue specular + green transmission + sss (pretty visible)

by the way, the sss node (same for all materials) uses no textures, but only plain intensities (floattextures): a little absorption, scattering set a little outwards and full scattering.

ps: while changing the scattering ammount and scattering direction values of the scene, the differences should be pretty easy to spot; turning scattering to zero just makes sphere 3 and 5 appear (of course) exactly like 2 & 4.