Jump to content
  • Advertisement

Archived

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

lun123

D3D shadow mapping

This topic is 5654 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is it possible to implement basic shadow mapping - one light only - *without* using VS/PS in D3D? If yes, sample code would be very helpful.

Share this post


Link to post
Share on other sites
Advertisement
1) Yes. You just render the occluder to a texture from the point of view of the light - i.e. the view and projection matrices describe the light. Then you render the things which recieve shadows with the render target texture and texture projection from the light source.

2) I''m 90% certain I saw an old sample over on the nVidia developer site (developer.nvidia.com). And there is also an example in Game Programming Gems 1 (albeit OpenGL, but its pretty simple to convert).

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
Suppose I have set the shadow map as a 2D texture at the stage 0,
and:

SetTextureStageState(0, D3DTSS_TEXCOORDINDEX, D3DTSS_TCI_CAMERASPACEPOSITION);

pD3DDevice->SetTransform( D3DTS_TEXTURE0, &matProjLight );
// matProjLight is the transformation from camera space to light view*proj space

SetTextureStageState(0, D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTF_PROJECTED | D3DTTFF_COUNT4);
// divide the first 3 elements with the 4th

What I actually don''t know is: what will happen with those projected 3D texture coordinates on a 2D shadow map texture?

Share this post


Link to post
Share on other sites
S1CA, could you explain a bit more, please? The technique you describe sounds interesting, but I can't understand it fully (some pseudo code would be great). Is it fast? I mean, is it something to do in real time (dynamic) or is it just to generate a static shadow map?

[edited by - Night Elf on January 29, 2003 12:25:31 PM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!