Creating a soap material - LuxRender Wiki
Luxrender GPL Physically Based Renderer

Creating a soap material

Personal tools

From LuxRender Wiki

Jump to: navigation, search

This is a tutorial for the soap material I did for my soap scene, written for LuxRender 0.7rc3 or later.

I hope I can show interested people a summary of the creation of the soap from my scene, and on the other hand I may be able to help some with what steps you have to go through before creating something more complex, to achieve your results and ideas rapidly, and not wasting time trying to adjust every single button.

Caution: This is not a tutorial for beginners, I will not explicitly describe where buttons and values are located and how textures should be applied.

Soap tut render 10.jpg

Because of license I can't provide any textures I used for this project, only the following two are made by my own from scratch in Photoshop:

Soap tut text 01.jpg Soap tut text 02.jpg

All other textures I used have the same style, black/white images with high contrast, some have smooth edges others not. I hope this helps for imagination of the used images.


Thoughts about a soap material

Before starting to develop a soap material, you have to have some knowledge about the material. Soap is something organic where light is shining more or less through the object. There are many different kinds of soap and I will describe only the method I used for my soap scene. This means there are several other ways, and even my result isn't the one and only correct method. The differences between soap materials in reality could be:

  1. Light shining through the object to varying degrees
  2. Some soap has reflective surfaces
  3. Some have structures on the surface like fractures, others could have those in the inside as well

First of all you have to search for some photos of the materials you have in mind. These photos could give you a more specific view what you have to do and maybe where the complexity lies. When watching the photos think about what fundamental materials from LuxRender you see on the surface (matte, glossy, matte translucent, mirror, etc.) The more difficult part are objects with a subsurface scattering effect (SSS), where light rays enter into the object and interact with its inner material.

In our soap material we see that light is shining through the object, furthermore light will be more attenuated the more the light travels through the object (thus the thicker our soap is). Regarding LuxRender materials and settings we need a 'mattetranslucent' with 'absorption' activated. The simplest would be to use the SSS model, but LuxRender doesn't support it yet. Therefore we will fake this effect by creating an inner mesh that will take care of the scattering.

The conclusion is that we we will use the following fundamental LuxRender materials/mechanism for our soap:

  1. mattetranslucent material
  2. absorption
  3. matte material for surface variations
  4. glossy material for shiny reflection
  5. bump mapping
  6. second mesh for scattering

Setting up a scene

The purpose of creating a scene isn't merely to get a proper background. More importantly, the scene should place focus to the objects and the topic. In achieving this, light and shadow are equal partners. Only the right interaction of light and shadow brings a nice contrast. The human eye is able to see three dimensional structures more clearly on pictures with a balanced contrast, and it will give the image a improved depth. To follow this idea, think of a simple sphere which will be lit from three different directions with the same light strength. A rendering of this sphere would only show a bright circle, and it would be difficult to see that it's a sphere. But if you use only one light, the balance between bright and dark areas would make it much easier to realize that it is a sphere. Unfortunately it is not always clear what the best light properties are, and there is not only one solution for a specific scene. Some scenes would go best with one, some with two and others with three lights. But using more than three light sources is rarely needed (except when using HDRI).

To set my soap scene into the right spot, I chose a setup with three point lights (with different gain) in a scene like a studio. With the three lights, the scattering effect shows nicely and let the soap look more voluminous.

The scene from the blender window:

Tut the scene blender.jpg

To test and tweak the best light setup (gain, color) and to be able to view the light/shadow interaction I used some simple cubes.

Top light:
Soap tut scene light top.jpg

Back light:
Soap tut scene light back.jpg

Front light:
Soap tut scene light front.jpg

Top/Back/Front light:
Soap tut scene light all.jpg

The last image uses adjusted settings:

  1. gamma: 1.9
  2. vignetting on
  3. c aberration on
  4. linear tonemapper
  5. color space (0.33,0.33)
  6. light back 9100 kelvin
  7. light front 4100 kelvin
  8. light top 6500 kelvin

Soap tut scene light all final.jpg

I'm using these final settings for the following tests as well.

Creating the soap material

It is not a very good idea to create the whole mix material at the beginning, and adjust all buttons and texture channels. On the one hand a complex mix material set could be very confusing, and on the other hand it is a lot more difficult to adjust a specific channel of a material when other materials and channels are also active. So we will create our material tree from the root up to the top.


First of all for the soap material we select a 'mattetranslucent' material and adjust the reflection and transmission values. Here you have to be careful that the reflection and transmission values added together don't get a value higher than one. Otherwise you may get fireflies and your scene will be clearing up much slowly.

  1. Reflection: 0.3
  2. Transmission: 0.6

I should mention that when activating absorption the rule of 'reflection+transmission<1' is not that important, because the absorption is able to attenuate the light a lot (also depending on the depth value). Anyhow it is better to go with this rule.

Soap tut render 01.jpg

For more variation I created textures for the reflection and transmission channel:

Soap tut render 02.jpg

This seems a bit too bright so we adjust the gamma value of both reflection and transmission texture up to '3':

Soap tut render 03.jpg

This looks much better, we could consider setting the gamma value higher, but this can be done in the final tweaking later on.


Now we activate absorption by selecting an internal and external medium. The external one should be 'world' with its predefined settings. Let's call the internal medium 'soap' with the following settings:

  1. R: 0.976473
  2. G: 0.874213
  3. B: 0.646678
  1. type: clear
  2. IOR: constant 2.040

'color' and 'at depth' are set at a depth value of '100 mm'.

The RGB values may be a bit high, but as mentioned in the previous section an absorption means that light will be attenuated through the object, thus these values aren't as dangerous in view of fireflies as the 'normal' reflection and transmission channels. Important is the yellow color I choose. If you look on a real soap than you will see that typically scattered light near top of the surface is brighter and more white. In contrast, light which scattered from the depth of the object becomes a more dirty yellow or brown. For the index of refraction I'm not sure what a normal value for a soap should be. I choose '2' which may be a bit high, but it doesn't influence the result much. Maybe '1.5' or less would be a better choice.

Soap tut render 04.jpg

Mix glossy & matte

Now we are ready to take the next step and create our final mix material preset. Next to the SSS effect our soap will have a glossy as well as a matte component. This way we are able to control another matte (non glossy) component on the surface to simulate non reflective parts without a scattering effect from the inner mesh.

So our material set should look like this:

Soap tut mat preset 01.jpg

A little tip: Before you switch the main material to a mix, save the current mattetranslucent as LBM file and reload it into the first mix material like the preset above. This saves you the time resetting all values for mattetranslucent. With the button '>' you are able to save and load LuxRender material sets.


First of all we want to set up our glossy material, because this will be our second main material beside mattetranslucent:

  1. Diffuse: 0.45
  2. Specular: 0.1
  3. Exponent: 700

Bump mapping

To get some surface roughness we go on with bump mapping, and create a texture for it.

  1. Bumpmap value: 0.002

To get a fast result if our texture and the bumpmap value fits, we set both mix material amounts to '1' and render the scene in „Direct Lighting“ render preset. This will render the scene only with glossy material and the bump mapping very fast.

Soap tut render 05.jpg

Ok, looks good so far. Now we will set two textures, one for specular and one for exponent:

This is the result:

Soap tut render 06.jpg

Don't worry about the overexposed areas, the next important steps will reduce them. And on the other hand remember that I'm still using a linear tonemapper with 'fixed' values, so this could be tweaked a bit in the end as well.


Now we are ready for the settings of the last material. As described above the matte will help us to get better control of non reflective parts and less scattered parts of the object surface.

  1. Diffuse: 0.55
  2. Mix amount (of matte and glossy): 0.9
  3. Texture for mix amount

Soap tut render 07.jpg

Setting up the mix amount for mattetranslucent + glossy/matte

The second last important step is to find the right values for mixing the mattetranslucent with the glossy/matte! For this we also use a texture and the following value:

  1. Mix amount: 0.2
  2. Texture for mix amount

Soap tut render 08.jpg

And don't forget to set „MLT/Bidir Path Tracing“ render preset for this render!

Creating the mesh object for a scattering effect

The last result looks ok but still not really like a soap. The reason is that too much light is shining through the object, making it look empty. As we know the soap has light being scattered through countless surfaces, so we need a second inner mesh to simulate this effect. Note that you have to be careful with this second mesh, the gap between the outer and the inner mesh should be set to the right value. If the gap is too small you will get a lot of fireflies with high absorption color values like I chose in section 3.2! So it is necessary to watch the gap between inner and outer shell as well as setting the absorption color and depth. The situation gets more complicated when using more than one inner mesh for scattering. I tried up to three inner meshes which also reduced the render speed a lot! The inner mesh should also be as simple as possible, and should only follow the outer shell roughly.

Image of inner mesh and gap:
Soap tut mesh gap 01.jpg

Image of inner mesh and gap:
Soap tut mesh gap 02.jpg

And here a render only from the inner shell:

Soap tut render 09.jpg

You will notice that the inner one has different material preset. The difference to the outer shell is that I replaced the 'glossy' with a 'glass' material and disabled some diffuse, reflection and transmission texture channels.

Here an image of the final material preset of the outer and inner mesh:

Material preset of the outer mesh:
Soap tut mat preset 02.jpg

Material preset of the inner mesh:
Soap tut mat preset 03.jpg

Final RENDER, with both meshes:

Soap tut render 10.jpg


This tutorial should not cause people to end further tests: there are still a lot of things which could be tweaked and adjusted. But based on the result of working on this scene, I can say that it is almost possible to fake sub-surface-scattering. I'm saying 'almost' because I don't think you are able to fake all kinds of SSS effects.

A big disadvantage of this technique is that you have to use inner meshes for the scattering, and if we want to simulate more complex organic materials we must add a lot more subsurfaces which will reduce the render speed heavily. For materials where one inner mesh is enough, it will be difficult creating materials where a lot of light is shining through the object, because you will see the inner mesh and in most cases this not look too good.

Although this is a nice technique with appropriate results, I'm still looking forward for the SSS implementation in LuxRender.

I hope you enjoyed my tutorial and/or learned something! Any further questions can be asked in the thread of my soap scene!

Cheers, xray