Shadow Maps using Direct3D

Started by
10 comments, last by Lightrocker 22 years, 5 months ago
In OpenGL you can use the Hardware Shadow Maps feature of the Geforce 3. Is there a possibility to do this in Direct3D 8.0 or 8.1? Maybe by using assembler? If it is impossible, what is the fastest way to calculate a scene with dynamic shadow or light maps on current high-end-systems? Can you recommend some source code for Direct3D 8? Thanks a lot.
Advertisement
DX8.0 - no...
DX8.1 - not that I''ve seen...

Shadow maps can be implemented fairly easily on the GF3, but it''s hard to find code on the web. Also, shadow volumes are pretty easy and more available...
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
I am already using Shadow Volumes extracted by Vertex Shaders, but this is terrible slow on detailed scenes. Another disadvantage is, that it cannot render the light at the transparent parts of a texture.
Shadow mapping is probably going to be slow for you as well. It requires two passes, so if you have alot of geometry...

Are you using shadow volumes with extruded silhouettes or are you computing the silhouettes?
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
I have one pass for all ambient light and one pass for every diffuse light to receive the correct shadow colors.
First the scene is drawn with ambient lighting. After that the shadow stencil is computed and non stencil areas are added with the diffuse lighted scene. Stencil and Diffuse calculations are done for every light.
For every body, which should throw shadow, another mesh is built only for the volume rendering by vertex shaders. These shaders extract the unlit triangles along current light rays.
I know, that the volume meshes can be optimized and reduced, but they cannot reach the performance I need.
Now I get between 40 to 90 frames per second (depends from view) at a resolution of 640x480 with Quincunx Antialiasing on an Athlon 800 Geforce 3, when the figure, which throws shadow, has got around 3700 triangles. The complete scene has got 11500 visible triangles without the volume mesh.
We use shadow maps with DX8 for spot lights
And stencil shadows for point light
The volume mesh has got six triangles for every triangle of the original mesh. I known, that edges between neighbor triangles, which are on a plane, do not need the shadow triangles. But a human mesh does not have much of those edges.
Should the volume mesh be built in another way?
Sorry - I don''t have any good answers, but here are a couple suggestions...

1. Check the ATI and nVidia shadow volume samples. Are they getting better performance? If so, why?

2. A long time ago I needed better performance from stencil shadows. I created two versions of the mesh. One was the version that was actually seen, the other was optimized to be a much lower poly count but still a decent shadow caster. I used the optimized version when doing the stencils. I heven''t tried it with volumes/maps, but that may be a possibility.

3. You mention light coming through the transparent parts of the texture. You could probably accomplish this with alpha testing, but that would mean you would have to enable textures for the stencil pass, which would make the pass slower. I think it would be the same or worse for maps. This is just off the top of my head - I haven''t really thought about it...
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
I heard about a game developing firm, that their 3D engine is able to render 200.000 polygons using shadow maps, but I do not know, if the number is a value per second or every frame.

Does anybody know some links to source code, tutorials or papers for shadow mapping with DirectX 8?

---
GrazedGenius, thanks for your time.
I was able to get fairly far at the nVidia site, also the nVidia guys are very friendly if you have questions. I haven''t really found any DX mapping samples (although there are opengl examples). I would share mine, but I can''t at the moment...
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials

This topic is closed to new replies.

Advertisement