SketchUp Cornell Box tutorial - part 1

Introduction

The Cornell box is a test aimed at determining the accuracy of rendering software by comparing the rendered scene with an actual photograph of the same scene, and has become a commonly used 3D test model. It was created by Cindy M. Goral, Kenneth E. Torrance, Donald P. Greenberg, and Bennett Battaile at the Cornell University Program of Computer Graphics for their paper Modeling the Interaction of Light Between Diffuse Surfaces published and presented at SIGGRAPH’84. (source)

The cornell box data, including geometry and material properties, is available on the project web site.

In this tutorial, we propose to model the Cornell Box using SketchUp, define the materials and simulate pictures with Ocean 2017.

Tutorial

Modeling the scene with SketchUp

Geometry

../../_images/tuto2014cornell-1.png

Open a new scene in SketchUp. Delete the default character model if necessary.

The 3D position from the Cornell Box description will be mapped to the following SketchUp axis:

  • X : Red axis (left-right)

  • Y : Blue axis (down-up)

  • Z : Green axis (near-far)

../../_images/tuto2014cornell-2.png

Create the floor rectangle, 550mm wide along red axis and 560mm along green axis.

We will not reproduce the exact Cornell Box, which has non perfectly orthogonal walls, but make an ideal box instead.

../../_images/tuto2014cornell-3.png

Use the Push/Pull tool for turning the floor into a 550mm high box.

../../_images/tuto2014cornell-4.png

Then select the front face and delete it to open the box.

../../_images/tuto2014cornell-5.png

The original cube had the main face sides oriented outwards, but are interested by the inside of the shape. So the front side of the faces must be oriented inwards. Orienting properly the geometry front faces is mostly important for volumic materials, which will not be used in this tutorial, and for light source, as an emitting surface emits light on his front side only. Select all faces and reverse faces using the right-click “Reverse Faces” action.

../../_images/tuto2014cornell-6.png

Now draw the base of the two blocks on the floor. You may draw them exactly from the figures by placing each corner with the “Tape Measure Tool” and join them with the “Line” tool, or draw simple rectangles at an approximate position.

../../_images/tuto2014cornell-7.png

Use the Push/Pull tool to raise the blocks. The short one is 165mm high and the tall one is 330mm high.

../../_images/tuto2014cornell-9.png

Create the light source rectangle on the ceiling, as we did for the blocks base.

Assigning materials

../../_images/tuto2014cornell-10.png

Open the Bucket tool, go to “In Model” folder, and create three materials:

  • red : RGB values of 180,0,0

  • green : RGB values of 0,180,0

  • white : RGB values of 180,180,180

  • light : RGB values of 0,0,0

These values are only rough estimates of the real material color spectrum. We will enter the exact figures from the Cornell Box paper in Ocean later in this tutorial, as SketchUp cannot handle spectral data. The light source material is also a simple black material for now : the emission properties will be defined in Ocean.

You may remove the other unnecessary materials that were added by SketchUp in the blank scene, if you wish. You can also do this later in Ocean.

../../_images/tuto2014cornell-10.png

Select all faces and apply the “white” material to them. Then apply the “green” material on the left wall, the “red” material on the right wall, and the “light” material to the ceiling light rectangle.

As you may have noticed, the Cornell box we have modeled is flipped left-right compared to the original. This is because the basis of the Cornell Box data uses Y as up axis, while SketchUp uses Z(blue) as up axis, resulting in mirrored basis. Scale the whole model by a -1 factor along red axis, and translate it by 550mm along red axis to correct this.

Save the file in skp format.

../../_images/tuto2014cornell-11.png

You can see the final result in SketchUp here. The corresponding file may be downloaded here.

Working with Ocean 2019

Importing the SketchUp scene and first render

Start Ocean 2014, and load the scene. Launch the render using the “Start” toolbar button. You should see the result appearing:

../../_images/tuto2014cornell-12.jpg

Currently, the scene is lit by a uniform environment source, coming from an infinite distance. That kind of lighting is handled by “Environments” in Ocean, and is automatically added by default when loading a SketchUp file. We will now replace it by making the previously defined “light” material emissive.

Changing the light source

../../_images/tuto2019cornell-13.png

Stop the render using the Stop Stop button. In the Objects toolbox, double click on the default object. The object properties editor opens in the central view. The default setup opens as a tree of properties. Right click on the “environment” element, and change its type to “Black”. This will remove environment light.

../../_images/tuto2017cornell-14.png

Then double click on the “light” material object to edit it. The materials open as a tree of properties. Right-click on the grayed “Emitter” element, and choose Add > Lambertian. This enables light emission for this material.

../../_images/tuto2017cornell-15.png

You can now select the base spectrum element of the emitter, which controls the emission spectrum. Right-click on it, and choose Change type > Tabulated.

../../_images/tuto2017cornell-16.png

You can edit below the spectrum tabulated values. Just change the number of rows or spectrum points, then set the values : first column is wavelength in meters, second column is source irradiance in W.m-3, or watts per surface unit per wavelength unit.

It is actually more simple to copy the following data, and paste it with the paste tool button Paste, just above the table. It corresponds to the actual Cornell Box data, with the wavelength values converted to meters:

400E-9

0.0

500E-9

8.0

600E-9

15.6

700E-9

18.4

Click on the “Apply” button for saving light material changes, then go back to the Render tab. Start the render, you should see the following image:

../../_images/tuto2014cornell-17.jpg

Editing materials

../../_images/tuto2017cornell-18.png

The light is now working as expected, but the materials are definitely too saturated, as we used pure red and green RGB colors. We will use the spectral reflectance from the original Cornell Box data.

Stop the render and double click on the red material in the Objects toolbox. Click on the RGB spectrum diffuse element in the tree, and change its type to Tabulated. Copy the text data from the text file below, and paste it using the paste button Paste. Click on Apply, and do the same for white and green materials.

Start the render. The result is now calculated from actual measured material spectra:

../../_images/tuto2014cornell-19.jpg

Customizing render

../../_images/tuto2017cornell-20.png

As you can see, the white parts of the box are looking orange-brown. This is due to the default white balance used by Ocean for generating images. It is set to a white point of x=0.3127 and y=0.3290, which corresponds to the D65 illuminant. On a digital camera, this is equivalent to setting the white balance to “Daylight” or “6500K”.

The light source spectrum of the Cornell Box looks like a tungsten source. In the real world, it would be necessary to change the white balance of the camera to a warmer setting, in order to match the eye adaptation to the illuminant. Or better, some cameras have a “Measure” mode for the white balance, in order to precisely match the illuminant.

We can do both in Ocean. You may find values in wikipedia’s standard illuminants page. For instance, tungsten has a white point of x=0.44757, y=0.40745. During the render, go to the output toolbox. Look for the xyztorgb filter, and set these values in the xwhite and ywhite fields.

You can see the result below:

../../_images/tuto2014cornell-21.jpg

The white balance is much better, but we could also measure a light value directly on the image to then set as white point value. Open the Pixel Info toolbox (if it is hidden, you may find it in the Tools menu. Then click on the white point selection pipet (1), and draw a rectangle on the image inside the light source (2), as below. The white point values to set are visible in (3). You can copy the values by right clicking on it, and selecting “Copy”.

../../_images/tuto2017cornell-23.png

In the output toolbox, a white point pipet tool simplify this process. As previously, click on the pipet and draw a rectangle on the image (4). The values extracted in the image are directly copied to the output toolbox’s white point value definition.

../../_images/tuto2019cornell-25.png

You now have a perfect white balance for your image:

../../_images/tuto2014cornell-21.jpg

You can save the scene for the next tutorial.

Next steps

In the next tutorial, you will see how to:

  • Improve your workflow by editing geometry while keeping your material and light settings in Ocean

  • Define a metallic material and use Ocean libraries

  • Choose the best rendering algorithm

SketchUp Cornell Box tutorial - part 2

Conclusion

This is it! You may try the many materials and light options, and read the Reference manual

There are other material examples in the “examples” folder of the Ocean installation directory. Don’t hesitate to contact us for more help in testing the software.