Advanced Shadows.......

Started by
2 comments, last by Raptor 21 years, 7 months ago
Hi, Well, what do u think is the best way to drawing shadows? Well, Shadow Volumes is accurate but shit expensive. Right now i just built another method which uses shaders for speed. I change rendertarget to another shadow surface, render the scene from the light source, transform the camera pixels to light space, and check depths and finally render shadows (done using pixel shaders). I get pretty good performance. Main advantage lies for static objects.....calculate the shadow map once and reuse it again and again. In case of shadow volumes, u can precalculate the shadow volume, but however, the cost involved in rendering the shadow volume twice and then, masking involves most of the rendering time, which happens each render cycle. Apart from these two methods, is there any other method in rendering fairly acurate shadows, for highly detailed scenes???? Your thoughts??? Raptor
Advertisement
No other ideas, but isn''t your method just using a shadow buffer, which is hardware-supported on GF3+? Though quite what this hardware support entails I don''t know, especially if you use shaders.


Read about my game, project #1
NEW (13th August): A new screenshot is up, plus diaries for week #3

John 3:16
Depending on your needs, you might want to try the following.

Store two copies of your models - a high resolution "visible" model and a lower resolution "shadow caster". Use the lower resolution model to generate the shadows, but use the visible one for actual rendering. You will introduce inaccuracies, but depending on your situation, it might be OK. I have done this with simple shadows on a plane and was able to improve performance considerably.

Also, make sure that texturing, pixel shaders, etc. are turned off when you render the stencil fillers. Performance can be good if you make sure you are doing the bare minimum.
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
Another good way to render shadow maps I've come up with is not to render to a depth buffer, but just render convex "chunks" to a surface with alpha, with the alpha value increasing (or decreasing if that floats your boat) with the distance of the chunks. So the closest chunk would have 0, the next one 1, etc. (obviously you'll have to clear with 255 first) and then you can render the shadow itself onto the chunks again with alpha-testing (less-than) set to whatever the chunk index is.
It's depth sensitive, it's fast and it's widely supported. Really nice

EDIT:
With a pixel shader, you can even render multiple shadows in one pass by doing a compare for each one and then blending them all together. That way you can even pull off rendering the mesh and the shadow in one pass.

- JQ
Full Speed Games. Coming soon.

[edited by - JonnyQuest on September 2, 2002 7:56:27 AM]
~phil

This topic is closed to new replies.

Advertisement