Haunted Hallway - Luxrender and PRMan

28 Aug 2015

In a previous blog post from 25th of August 2015 we talked about the Haunted Hallway scene already and showed images rendered with Blender’s global illumination renderer Cycles. Today I would like to talk about Luxrender and Pixar’s RenderMan implementation PRMan (version 20).

Let’s start with Luxrender. On the forum I asked for help how to achieve god rays as in the Cycles renderer. I got a response and the resulting file renders like this:

Using Luxrender's
'VolumeIntegrator' for god rays.

Right now my own exporter does not support volumes (yet), so let’s summarize what was added to the exported .lxs file by hand.

# Camera
LookAt ...
Film "fleximage"
  "integer outlierrejection_k" [ 1 ] #changed
VolumeIntegrator "single" # new
Accelerator "qbvh" # new

I don’t know why the outlierrejection_k value changed, but we need a VolumeIntegrator for sure.

  MakeNamedVolume "dusty air" "homogeneous" # new
	"float fresnel" [1.000000000000000]
	"color g" [0.00000000 0.00000000 0.00000000]
	"color sigma_a" [0.00000000 0.00000000 0.00000000]
	"color sigma_s" [0.00853225 0.00853225 0.00853225]
  MakeNamedMaterial "dusty air"	# new
	"string type" ["null"]

The volume dusty air will be used later. You can raise or lower the color sigma_s values for the volume to get more or less scattering.

  AttributeBegin # "dust box" # new
  Transform [...]
  NamedMaterial "dusty air"
  Interior "dusty air"
  Shape "mesh" ... "string name" ["dust box"]

A cube called dust box, big enough to contain all objects in the hallway, was added to the scene. Everything inside is filled with dusty air (therefore the Interior).

  # light_bulb
    Transform [...]
    NamedMaterial "light_bulb"
    LightGroup "light_bulb"
    Exterior  "dusty air" # new
    AreaLightSource "area" ...
    Shape "mesh" ...

The volume dusty air is used as an Exterior for the light bulb.

  Exterior "dusty air" # new

The volume dusty air is used as an Exterior for the camera (which is defined before WorldBegin).

What’s interesting in regard of finding good values for the light sources for other renderers is the ability of Luxrender to use light groups. While the renderer is rendering you can turn those light groups on or off to see the effect of a single light, here the light bulb, emitting red light:

Luxrender's light groups to separate red light from the light bulb.

Here the daylight system (sun and sky), emitting green light, which is unusual for a daylight system, but you can do that:

Luxrender's light groups to separate green light from the daylight

Actually I defined the colors while running Luxrender and stored the settings (tonemapping values and light group colors) in a file called hallway.ini:


You can load that file (during rendering) via File->Load Panel Settings….

Let’s have a look at the result we got from Pixar’s PRMan 20.0 renderer:

Using Pixar's 'PxrVolume' for god rays.

There are two Blender files for this scene in the download section (via the Cycles link). Beside the changes regarding using a volume for the god rays I replaced the sun light (using PxrEnvDayLight) by a spot light. This was mainly done for Cycles which currently can’t use a daylight system for volumetric lighting, but I kept this change for RenderMan as well. So I replaced this piece of the RIB file:

  # Sun
  Attribute "identifier" "string name" ["Sun"]
    AreaLightSource "PxrEnvDayLight" "Sun"
      "float intensity" [0.001]
      "vector direction" [...]
      "float haziness" [2.0]
      "color sunTint" [0.382 1.0 0.34]
    Sides 1
    Opacity [1 1 1]
    Bxdf "PxrLightEmission" "visibleToCamera"
    Rotate 180 0 1 0 # right handed
    Scale -1 1 1 # right handed
    Geometry "envsphere"

The direction of the spot light is pretty similar (moving the light along the same vector), but the resulting bright spot on the floor is still not exactly the same (because a spot light has a position):

  # Spot
    Attribute "identifier" "string name" ["Spot"]
    Transform [
      -0.9844222068786621 -0.17582131922245026 -1.4901162970204496e-08 0.0
      0.13712269067764282 -0.7677489519119263 0.6259064078330994 0.0
      -0.11004770547151566 0.6161562204360962 0.7798981070518494 0.0
      -12.677900314331055 126.31094360351562 120.90076446533203 1.0
    AreaLightSource "PxrStdAreaLight" "Spot"
      "string rman__Shape" ["spot"]
      "float exposure" [22.0]
      "color lightColor" [0.3819217383861542 1.0 0.3401939868927002]
      "float coneAngle" [10.0]
      "float penumbraAngle" [0.0]
    Bxdf "PxrLightEmission" "Spot_emit"
    Disk 0 0.5 360

Now let’s talk about the god rays and how to define a volume to create those. The volume contains the whole scene, including camera’s and lights (in this case the spot light outside the building), not just geometry:

    Bxdf "PxrVolume" "volume"
      "color diffuseColor" [0.8 0.8 0.8]
      "float densityFloat" [0.01]
      "int multiScatter" [1]
    Volume "box"
      [...] # bounding box for the whole scene
      [0 0 0]

Nothing else is needed for PRMan to make the light scatter in a homogeneous volume (using a single density value).