Conference Room: Results for Arnold showing Radiance Patterns

04 Jul 2014

The Conference Room is a very famous scene, originally created for and rendered by Radiance. The room does (or at least did) exist in reality and was painstakingly measured and re-created in a text editor (vi). See README file and credits in the repository, where I keep my test scenes in various formats. Here are the (current) results for Arnold:

Camera
'current' rendered by Arnold

Camera
'door1' rendered by Arnold

Camera
'door2y' rendered by Arnold

Camera
'shaft' rendered by Arnold

Camera 'xY'
rendered by Arnold

To render the Radiance patterns (basically 3D textures based on a position in space and some parameters), I wrote Arnold shaders, which are currently not publicly available, but checked in into a shader repository.

The pinboard (visible in the third and forth picture) uses for example two (pattern) shaders, called rad_dirt and rad_bwave and this is how it looks like in an .ass file:

...
polymesh
{
 name MEpinboard
...
 shader "MAwhite_mat"
 opaque on
 declare Pref_matrix constant MATRIX
 Pref_matrix 
 1 0 0 0
 0 1 0 0
 0 0 1 0
 0 0 0 1
}

rad_dirt
{
 name MAwhite_pat1
 Kd_color 0.515999973 0.449999988 0.340000004
 dirtiness 0.4
 scale 0.0009144 0.0009144 0.0009144 # 0.003 * 0.3048 (feet to meters)
 rotation 0 0 0
}

rad_bwave
{
 name MAwhite_pat2
 Kd_color MAwhite_pat1
 scale 0.006096 0.006096 0.006096 # 0.02 * 0.3048 (feet to meters)
 rotation 90 0 0
}

standard
{
 name MAwhite_mat
 Kd 1
 Kd_color MAwhite_pat2 # 0.515999973 0.449999988 0.340000004
 Ks 0
 Ks_color 1 1 1
}
...

The parameters of rad_dirt are:

node:         rad_dirt
type:         shader
output:       RGB
parameters:   6
filename:     ./rad_dirt.so
version:      4.2.0.5

Type          Name                              Default
------------  --------------------------------  --------------------------------
RGB           Kd_color                          1, 1, 1
FLOAT         dirtiness                         0.5
BOOL          use_Pref_matrix                   true
VECTOR        scale                             1, 1, 1
POINT         rotation                          0, 0, 0
STRING        name                              

For rad_bwave they look like this:

node:         rad_bwave
type:         shader
output:       RGB
parameters:   5
filename:     ./rad_bwave.so
version:      4.2.0.5

Type          Name                              Default
------------  --------------------------------  --------------------------------
RGB           Kd_color                          1, 1, 1
BOOL          use_Pref_matrix                   true
VECTOR        scale                             1, 1, 1
POINT         rotation                          0, 0, 0
STRING        name                              

Basically all patterns manipulate the color (parameter Kd_color) of e.g. a standard shader and you can plug several patterns together before delivering the final color to the material shader. All patterns allow to scale and apply rotation angles (in degrees).

...
shader_evaluate
{
  AtColor Kd_color = AiShaderEvalParamRGB(p_Kd_color);
...
  bool use_Pref_matrix = AiShaderEvalParamBool(p_use_Pref_matrix);
  AtVector scale = AiShaderEvalParamVec(p_scale);
  AtPoint rotation = AiShaderEvalParamPnt(p_rotation);
  AtPoint P = sg->Po;
...
  // apply matrices
...
  if (use_Pref_matrix && AiUDataGetMatrix("Pref_matrix", &userMat)) {
    AiM4Mult(mat1, mat0, userMat);
  } else {
    AiM4Mult(mat1, mat0, sg->M);
  }
...
  AtPoint Pt = P;
  AiM4PointByMatrixMult(&Pt, mat5, &P);
  // see bwave.cal (e.g. export_multi/04_conference_room/rad/bwave.cal)
  sg->out.RGB = Kd_color * bwave(Pt.x, Pt.y, Pt.z);
}
...

Each pattern works more or less the same way (except calling different functions for the actual pattern generation). It retrieves from Arnold's shader globals the shading point in object-space (Po), calculates transformation matrices for the scale and rotation, and either applies a user matrix (based on the boolean parameter use_Pref_matrix and the existence of such a matrix called Pref_matrix), or applies the local-to-world matrix transform to calculate world coordinates, before using those transformed coordinates (Pt) for further calculations.

The user matrix allows for example to texture all the chairs in the same rest position (therefore the name Pref - see Pixar's Primitive Variables), but instead of defining the geometry in terms of a rest position (which can be used for deforming geometry), I decided to use a simple user matrix, which should involve less user data to store.

...
rad_upholstery
{
 name MAcloth1_pat
 Kd_color 0.980000019 0.182999998 0.165000007
 scale 0.0381 0.0381 0.0381 # 0.125 * 0.3048 (feet to meters)
 rotation 0 -45 0
}

standard
{
 name MAcloth1_mat
 Kd 1
 Kd_color MAcloth1_pat # 0.980000019 0.182999998 0.165000007
 Ks 0
 Ks_color 1 1 1
}
...
polymesh
{
 name MEseat
...
 matrix
 -0.082034491 -0.0144648636 0 0
 -6.32279284e-10 3.5858414e-09 0.0833000019 0
 -0.0144648636 0.082034491 -3.64115871e-09 0
 3.03261352 3.5615592 0 1
 shader "MAcloth1_mat"
 opaque on
 declare Pref_matrix constant MATRIX
 Pref_matrix 
 1 0 0 0
 0 -4.37113883e-08 1 0
 0 -1 -4.37113883e-08 0
 0 5.2578001 0 1
}
...
...
polymesh
{
 name MEseat_un2609
...
 matrix
 -0.0215596184 0.0804616362 0 0
 3.51708973e-09 9.42400824e-10 0.0833000019 0
 0.0804616362 0.0215596184 -3.64115871e-09 0
 3.11262894 4.03192377 0 1
 shader "MAcloth1_mat"
 opaque on
 declare Pref_matrix constant MATRIX
 Pref_matrix 
 1 0 0 0
 0 -4.37113883e-08 1 0
 0 -1 -4.37113883e-08 0
 0 5.2578001 0 1
}
...

Notice in the example above how the matrices differ for both seats, but the Pref_matrix defines the space the chair was textured in.

rad_speck
{
 name MAcurtain_pat
 Kd_color 0.600000024 0.600000024 0.600000024
 brightness 0.2
 use_Pref_matrix false
 scale 0.006096 0.006096 0.006096 # 0.02 * 0.3048 (feet to meters)
 rotation 0 0 0
}

There exists a shader parameter called use_Pref_matrix in case you want to use the matrix of the primitive (e.g. of a polymesh) instead of the user matrix, which is in this case ignored.