Archived

This topic is now archived and is closed to further replies.

Lightrocker

Shadow Maps using Direct3D

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites