Jump to content
  • Advertisement
Sign in to follow this  
kobe bryant

Creating renderable textures for shadow maps

This topic is 4526 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

I'm trying to bring in my shadow mapping shader in to my DX application, however i'm unsure how to create a renderable texture for the shadow map, how do I go about doing this. I'm using DX 9.0c by the way. Thanks for any help.

Share this post


Link to post
Share on other sites
Advertisement
Thanks, do I have to use this funciton also?

Device->CreateTexture(shadowMapSize, shadowMapSize, 1, D3DUSAGE_RENDERTARGET,
D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT, &shadowMapRenderTargetTexture);

Share this post


Link to post
Share on other sites
ofcourse, this will create the texture, where dx can draw the screen on. next thing you have to do, will be to render everything that needs to cast a shadow onto this texture, but with it's z coord as the color of every pixel.
i dunno any tutorials, because i learned this from my book, but you should find some on the net :)

Share this post


Link to post
Share on other sites
yes, sorry about that.
CreateTexture with D3DUSAGE_RENDERTARGET flag is what you want to do, of course.
And then SetRenderTarget(that_texture) when you want to render to it.

You can use your regular z-buffer, if you want, when you render to the texture.
With some restrictions, check out SetRenderTarget in DX docs

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!