View Full Version : Cache Arealight Shadows. How do I?.

11 November 2005, 08:00 PM
Hi! its not hard to cache shadowmaps and finalgather, its just to write a "filename" and it caches automaticly...

But how about Arealight/raytrace shadows?? anyway?

11 November 2005, 10:05 PM
I'm not certain you can cache raytraced shadows. They're not a physical map thats being written out. (ie, Depth Map Shadows or MR Shadow Maps) ... You can BAKE the shadows into a file texture with the MR Baking, but then if anything flys around or the camera moves too much, it really won't work..


11 November 2005, 11:02 PM
ok, i see =)
thnx for your answer.

11 November 2005, 03:57 AM
Camera movement shouldn't be a problem as long as the elements in the scene are static relative to the shadow casting light sources, so for things like walkthroughs or turntable type animations baking illumination is just fine.

11 November 2005, 01:06 AM
Let me re-iterate. Yes, the camera movement should be fine.. If objects are animating through the scene, and are physically moving, these shadows would not work being baked, you'd have to bake an animation of the object moving, and then not move the object again (or they'd be inaccurate)

Does that make sense?


11 November 2005, 01:39 AM
Didn't I just say that....? :)

11 November 2005, 09:14 AM
Two ways.
a) Already mentioned. Bake the diffuse illumination into texture maps for each object in your scene. This will take a long time to bake, but afterwards, you should be able to move your camera thru your scene. Obviously, if you have animated objects, those object's shadows cannot be baked in.

b) Just bake a diffuse pass, but from the pov of the camera. That is, create a render pass that is just a diffuse white pass with shadows. Apply a lambert shader, set it to white and render a frame (or sequence) from the camera pov (if you have reflection/transparency/refraction, you should also mimic this in your diffuse white shaders).
From then on, you can just map those images, linking the projection to the camera, onto all surfaces, usually onto the incandescence or diffuse of the shader. If you have to render multiple passes that would require re-calculating the area lights, this should help. This will also work properly in animation but it will not allow you to do a walkthru. This will be mainly of use when if you are rendering multiple render passes that use those shadows (or your scene is very complex and want to do faster updates for testing).
Also, it is not without problems. Whenever your animation changes, you will be forced to repeat the whole process from the beginning, as your images on disk will be out of sync. Plus the first time you do it, you will be needing to spend some time setting up the diffuse image attachment to all your shaders (you should probably write a mel script to do it automatically for you).

CGTalk Moderation
11 November 2005, 09:14 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.