Area Lights

2002-07-09: Naive computer-generated images are notoriously prone to harsh shadows due to using point sources. RenderMan has a nice general construct for "area lights", which allows you to make any arbitrary geometry you can think of into a light source. By picking a nice big light source, you can get soft, natural looking shadows. Larry Gritz has an example of using a big hemisphere to simulate light from the entire sky. I wasn't able to get that to work, but I was able to set up a big rectangle which more or less simulates having the entire ceiling glowing:

AttributeBegin
Surface "constant"
Attribute "light" "shadows" "on"
Attribute "light" "nsamples" [1000]
Surface "constant"
AreaLightSource "arealight" 1 "intensity" [150000] "lightcolor" [1 1 1]
Rotate 180.0 0 1 0
Patch "bilinear" "P" [200.0,-200.0,-300.0, 200.0,200.0,-300.0, -200.0,-200.0,-300.0, -200.0,200.0,-300.0]\n",
AttributeEnd
Illuminate 1 1

The nsamples attribute is an implementation-specific tuning factor which let you trade off time vs quality by controlling the number of rays spawned from each surface pixel on an object in order to estimate how well lit it is. I did a sequence of images with different nsamples values to explore this. In principle, rendering time should rise linearly with the nsamples setting, but this particular renderer appears to cut off further sampling when it becomes statistically clear that they are contributing nothing to the quality of the image: As a practical matter, this seems to mean that just setting the parameter to a very large value and forgetting about it should work fine.

As usual, click on the thumbnails to see the images at full resolution.

Image 1: nsamples=3. Spawning just three rays from each object surface pixel makes for very hit-or-miss estimation of how well lit the surface is, resulting in heavy speckling of both the shadow and the object surface:
.
(./glob --veinedmarble --lumpy=0.5.)

Image 2: nsamples=10. Noticably noisy shadow still:
.
(./glob --veinedmarble --lumpy=0.5.)

Image 3: nsamples=100. Now the shadow looks pretty good to me:
.
(./glob --veinedmarble --lumpy=0.5.)

Image 4: nsamples=1000. I don't see any improvement:
.
(./glob --veinedmarble --lumpy=0.5.)

Image 5: nsamples=10000:
.
(./glob --veinedmarble --lumpy=0.5.)

Image 6: nsamples=1000: Now I'm just having fun. Same object, shiny surface:
.
(./glob --shiny --lumpy=0.5.)

Image 7: nsamples=1000: Larry Gritz' very nice polished-oak surface shading:
.
(./glob --oak --lumpy=0.5.)

Image 8: nsamples=100000: Same object in glass. Glass is one of the few materials which look better with a spotlight rather than an area light, which just obscures the pretty reflections and refractions:
.
(./glob --glass --lumpy=0.5.)

Back to Cynbe's "Silly RenderMan Tricks" Page.


Cynbe ru Taren
Last modified: Fri Aug 9 22:28:44 CDT 2002