Making Bubbles with Cycles and Luxrender

28 Mar 2014

On the HtoA (Houdini to Arnold) mailing list I found a new Arnold shader, which can create a thin film interference, which is common in soap bubbles. See documentation and example renderings there.

I was interested if someone has tried to render soap bubbles in Cycles (the GI renderer within Blender) and found two forum entries on blenderartists.org:

Here is a little scene I created using the NanometerColor node group:

Rendered with Cycles

I modified my Blender multi-exporter to detect HDR lighting within Blender and the first renderer to pick that up is Luxrender. I haven't used the thin film parameter of the Luxrender glass material yet, but the HDR lighting works fine now:

Rendered with Luxrender

To improve the image above I added a couple of things (by hand for now). First, the part where both bubbles overlap in pixel space is too dark. This can be improved by raising the ray depth (which wasn't specified at all in the above example):

...
SurfaceIntegrator "bidirectional"
    "integer eyedepth" [16]
    "integer lightdepth" [16]
    "integer lightraycount" [1]
    "string lightpathstrategy" ["auto"]
    "string lightstrategy" ["auto"]
WorldBegin
...

Similar to the Cycles node graph I use some noise to perturb the thinfilm nano meter setting:

...
Texture "Material.002::Distorted Noise Texture" "float" "blender_distortednoise"
    "string noisebasis" ["original_perlin"]
    "string type" ["original_perlin"]
    "float noisesize" [0.25]
    "float distamount" [0.37]
    "float nabla" [0.025]
    "float bright" [1.0]
    "float contrast" [1.0]

Texture "Material.002::Scale" "float" "scale"
    "texture tex1" ["Material.002::Distorted Noise Texture"]
    "float tex2" [384.0] # 2 * 192

MakeNamedMaterial "Material"
  "string type" [ "glass" ]
    "bool architectural" ["false"]
  "float index" [ 1.33 ]
  "float filmindex" [ 1.33 ]
  "float film" ["Material.002::Scale"] # [ 192.0 ]
  "color Kr" [ 0.8 0.8 0.8 ]
  "color Kt" [ 1.0 1.0 1.0 ]
...

That make's it look a bit more like the Cycles counterpart:

Noise based film nano variations

I have problems using the same bubble model with Arnold using the standard shader, because I end up with internal reflections and refractions, but I will post an update in case I find a solution.