Sign in to follow this  

Creating renderable textures for shadow maps

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

This topic is 4245 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this