Scivis Rendering Example 2

In this post, my second on using Scivis in ParaView, I thought I’d take a step back and examine lighting setups on a simple scene and look at the differences between positional and directional lighting.  To do this I’ve used a sample “room” that I’ve made up with ParaView geometric primitives, as shown below.  Specifically, in the scene I have:

  1. Four plane objects to create a set of floor and walls.
  2. A cone, base down on the floor
  3. A second cone, point down on the floor
  4. A large sphere sitting on the floor
  5. A smaller sphere floating in free space
  6. A cube floating in free space
Figure 1 – simple scene with five geometric primitives and ParaView’s default rasterization.
Figure 1 – simple scene with five geometric primitives and ParaView’s default rasterization.

As always, the first step is to simply turn on OSPRay and select the scivis renderer, as shown below.  Again, the default light kit is pretty good.  There are two main lights doing most of the work in this scene though:

  1. Key Light: which is providing the general illumination of the scene – think something similar to the sun
  2. Head Light: which is providing subtle highlights from the direction of the camera in this scene.
Figure 2 – Base scivis with the default light kit.

As I want to explore, the next step is to turn off the light kit and add in my key light, as shown below.  In this example the key light is still high and slightly to the right of my camera.  Here I’ve used a directional light so that the incoming rays are all parallel – again, think like the sun.  As a difference though I’ve change the light colour to represent the light on a more cloudy day – in RGB space I used (201, 226, 255).  Colour theory is a whole world in itself so I’ll try to get back to that in a future post.

Figure 3 – scivis render with a cool colour directional light in place.
Figure 3 – scivis render with a cool colour directional light in place.

Next I’m going to add in a positional light to provide some highlights for me.  I think of these lights as the equivalent of a spot light on a stage.  On a stage, they’d usually highlight an actor or point of interest. Here, I’m simply doing the same, as shown below.

Figure 4 – lit scene with added positional light.
Figure 4 – lit scene with added positional light.

The positional light I’ve just added is based on the default white colour but I’ve increased the radius of the light to 50 degrees in order to add “soft” shadows.  This can be observed with the shadow the sphere is casting on the floor of the scene.  Inside the light we have a nice sharp shadow that well defines the shape of the sphere.  Alternatively, on the outside of the highlight we have a more gradual change from light to shadow.  As with all lighting this is a personal choice and my thought is always to use the lighting to highlight your point of interest.

To digress a little, the trick that use when setting lights is to use ParaView’s custom viewpoints dialog, shown below.  I set the current viewpoint to where I want my camera to be.  That way, if I move the scene or need to pan around to check a detail, I can quickly return to the camera location.

Figure 5 – custom viewpoint dialog in ParaView
Figure 5 – custom viewpoint dialog in ParaView

This trick is particularly handy because one of the simplest methods to set the position of a light is to move your viewpoint to where you want, then add the light and use the “move to camera” button, shown below, to move the light source to your camera position.  The custom viewport then allows me to quickly jump back to my camera position and view the results.

Figure 6 – move to camera dialog.
Figure 6 – move to camera dialog.

From here, the final setting is to render the scene, which you’ve actually already scene above in Figure 4.  When it comes to rendering though there are two key points to consider

  1. Number of ambient samples
  2. Number of samples per pixel

My rule of thumb is that the more samples the “better” the image will look but it will also take more time to render.  I’ve not really found a sane method to estimate the values for each of these parameters in advance, so I usually just pick a representative scene and play with the sample rates until I get what I’m after.  The only real rule of thumb that I have is that as the scene complexity goes up, you’ll need more samples.  To illustrate that process there is a set of images below that illustrate the differences.  In the first set I fixed the ambient samples at 20 and then varied the samples per pixel from 1 to 1000.  For this scene there is really no need to move beyond 10 samples and certainly 1000 is just a waste of time.

Figure 7 – 20 ambient samples, 1 sample per pixel.
Figure 7 – 20 ambient samples, 1 sample per pixel.
Figure 8 – 20 ambient samples, 10 samples per pixel
Figure 8 – 20 ambient samples, 10 samples per pixel
Figure 9 – 20 ambient samples, 100 samples per pixel
Figure 9 – 20 ambient samples, 100 samples per pixel
Figure 10 – 20 ambient samples, 1000 samples per pixel
Figure 10 – 20 ambient samples, 1000 samples per pixel

For the next set I fixed the samples per pixel at 20, which seemed OK from above and varied the ambient samples from 1 to 100.  Again for this scene the diminishing returns kicked in between five and 10 and I couldn’t see a difference moving to 20 or 100.

Figure 11 – 1 ambient sample, 20 sample per pixel
Figure 11 – 1 ambient sample, 20 sample per pixel
Figure 12 – 5 ambient samples, 20 sample per pixel
Figure 12 – 5 ambient samples, 20 sample per pixel
Figure 13 – 10 ambient samples, 20 sample per pixel
Figure 13 – 10 ambient samples, 20 sample per pixel
Figure 14 – 20 ambient samples, 20 sample per pixel
Figure 14 – 20 ambient samples, 20 sample per pixel
Figure 15 – 100 ambient samples, 20 sample per pixel
Figure 15 – 100 ambient samples, 20 sample per pixel

Finally, thanks for reading this article and please leave a comment below. If you are interested in being updated when similar items are posted then either subscribe via RSS or sign up to my mailing list below.

Site Footer