Shadow Instancing
eharetea

Using the vm_shadow attribute in light instancing to get instanced shadows.

Shadow instancing.

Date Created:Friday December 29th, 2006 03:41 AM
Date Modified:Thursday August 14th, 2008 07:11 PM

Shadow Instancing - www.3daet.com



Shadow instancing is in addition to light instancing, so we instance lights and shadows.

In addition to our light object, we have a points object that will become a series of lights that cast shadows.


Shadow Instancing - www.3daet.com



1) Check on the Light's Render tab to make sure "Point Instancing" is checked on and a path to the points object is set.



Shadow Instancing - www.3daet.com



Lets look in our points object:




Shadow Instancing - www.3daet.com



2) Add normals using a Point SOP, setting the values to the default $NX, $NY, $NZ

The direction of the light is the reverse direction of the normal)



Shadow Instancing - www.3daet.com



3) Add the vm_light attribute with an Attribute Create SOP.
something like:

opdef:/Shop/v_asadlight docone 1 atten 15 lightcolor `rand($PT)` `1-rand($PT)` 1 coneangle 15 conedelta 25



4) Add the vm_shadow attribute with an Attribute Create SOP.
something like:

opdef:/Shop/v_rayshadow shadowtype deep map "$HIP/shadow$PT.rat" spread 20




Shadow Instancing - www.3daet.com



5) Navigate back up to the Light object's Shadow tab and fill in the same values you used the map parameter in the vm_shadow attribute. The only difference you must note is to use $IPT instead of $PT.

6) Also check on "Auto-Generate Depth Map" and "Deep Shadow Generation" toggles.

7) Leave the SHOP Shadow blank.



Shadow Instancing - www.3daet.com



8) Turn off the "Auto-Generate Depth Map" when you are pleased with results.

Sometimes you can get clipped shadows. You can fix this by adjusting your focal length in the light you are referencing.

You also may need to turn up the Z-Depth Samples in the light shadow tab if you get jagged edges on your shadows.



Downloads:
Download: shadows.hip 378 KB

Please login or Click Here to register for downloads
Creative Commons License
Shadow Instancing by Dan Lynch
is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
Based on a work at www.3daet.com
Permissions beyond the scope of this license may be available at http://www.3daet.com