overview | prman render package | shadows | attributes/options | sloargs

PhotoRealistic RenderMan® Extension


Supplemental documentation for the shadow map generation feature of the "prman" render package.

Shadows

Automatic shadow generation is supported for the standard light source shaders and new shadow lights can be defined. However, in order to get the best results, image specific "tweaking" will still have to be performed by the user.

Figure 1 shows 3 gprims rendered with shadows. Figure 2 shows the same scene, but casts-shadows is used to demonstrate the 3 available behaviors described below; specifically, the sphere does not cast a shadow and the torus casts a shadow "only."
fig.1fig.2

Shadow Lights

Shadow lights is a term describing the light source shaders that AL can automatically produce shadows for. Support is provided for a limited (but extendable) set of shadow lights.

The light-shadows gop is used to specify which light sources produce shadows. (Light sources don't produce shadows by default.)

   ...
   (light "distantlight")   ;; doesn't cast shadows
   (light-shadows #t)
   (light "distantlight")   ;; does cast shadows
   ...
Note that for the distant light which casts shadows, the same shader "distantlight" is specified. The only difference is that the distant light which casts shadows takes additional parameters necessary for various aspects of shadow map generation and use.

All shadow lights support the following parameters when producing shadows:

standard shadow light parameters
(light-shadows = #t only)
shadow-map-resreal256shadow map resolution
shadow-map-dirstringcurrent directoryshadow map directory
optionslist of uneval'd optionssee belowlight-source specific shadow map rendering options


distantlight

(light "distantlight" paramlist)

nametypedefaultdescription
intensityreal1.0intensity
lightcolorvec3#<1 1 1>color
fromvec3#<0 0 0>position
tovec3#<0 0 1>center of interest

light-shadows = #t only
shadownamestring"shadowdistant~s"shadow map filename
samplesreal16sampling resolution
widthreal1sampling filter width


pointlight

(light "pointlight" paramlist)

nametypedefaultdescription
intensityreal1.0intensity
lightcolorvec3#<1 1 1>color
fromvec3#<0 0 0>position

light-shadows = #t only
sfpxstring"shadowpoint~spx"shadow map filename +X axis
sfnxstring"shadowpoint~snx"shadow map filename -X axis
sfpystring"shadowpoint~spy"shadow map filename +Y axis
sfnystring"shadowpoint~sny"shadow map filename -Y axis
sfpzstring"shadowpoint~spz"shadow map filename +Z axis
sfnzstring"shadowpoint~snz"shadow map filename -Z axis
samplesreal16sampling resolution
widthreal1sampling filter width


spotlight

(light "spotlight" paramlist)

nametypedefaultdescription
intensityreal1.0intensity
lightcolorvec3#<1 1 1>color
fromvec3#<0 0 0>position
tovec3#<0 0 1>center of interest
coneanglereal(radians 30)cone angle
conedeltaanglereal(radians 5)cone fuzziness angle
beamdistributionreal2drop off

light-shadows = #t only
shadownamestring"shadowspot~s"shadow map filename
samplesreal16sampling resolution
widthreal1sampling filter width

How Objects Cast Shadows

You can specify how gprims cast shadows using the casts-shadows gop.

(casts-shadows #t)

Subsequent gprims will cast shadows. (The default.)

(casts-shadows #f)

Subsequent gprims will not cast shadows.

(casts-shadows "only")

Subsequent gprims will only cast shadows. That is, their shadows will be visible, but the geometry itself will not.

Shadow Map Names

Note that the default shadow map filenames all contain "~s". The "~s" is replaced by an integer index which is unique for each map. You may exclude the "~s" as long as the shadow map filename is unique from other shadow lights.

Shadow Map Tweaking

The things that need to be tweaked:

Adding New Shadow Lights

Coming Soon!

Shadow Map Rendering Options

The default value for "shadow-map-options" is

     '((ri-pixel-samples 1 1)
       (ri-pixel-filter "box" 1 1)
       (ri-hider "hidden" 'jitter 0))

Note: This single option specifies all rendering options for the generation of shadow maps. (Its use may be improved in the future.) You generally will want to retain the settings for the shadow map options show above. Therefore, if you need to specify an additional rendering option for the shadow map (e.g. "zthreshold"), you should include that option and those shown above. For example,

(render 
	...

 	'shadow-map-options
	'((ri-pixel-samples 1 1)
	  (ri-pixel-filter "box" 1 1)
	  (ri-hider "hidden" 'jitter 0)
	  (ri-option "limits" 'zthreshold '(0 0 0))
	  )

	...
	)


AL: The Animation Language is Copyright © 1995,1996, Stephen F. May

Last updated: 4/15/96 / Steve May ( smay@cgrg.ohio-state.edu )
Any comments or suggestions appreciated.