Skip to main content
gamedev.net
🔒 Locked

RenderToTarget issue

Started by vinceextense 1 reply 700+ views
Original Post
vinceextense
vinceextense
Hello, I am currently developing some postprocessing effect using C# and DirectX9. Basically the scene is rendered in a texture by using RenderToSurface and next I render the texture in a quad and apply the post effect. For many effects like depth of field I need to store the depth so I decided to store the depth in the alpha. But unfortunalety when I try to get the alpha (depth) it's always 1. This is how the RenderToSurface is defined RTS_ = new RenderToSurface(device_, (int)BACKBUFFER_WIDTH, (int)BACKBUFFER_HEIGHT, Format.X8R8G8B8, true, DepthFormat.D24X8); and this is the code for the texture Texture(device_, (int)BACKBUFFER_WIDTH, (int)BACKBUFFER_HEIGHT, 1, Usage.RenderTarget, Format.X8R8G8B8, Pool.Default); Any idea why the alpha is always equal to 1 ? Thank you for your help Vince
MJP
MJP
X8R8G8B8 doesn't have an alpha channel you can write to, use A8R8G8B8 instead.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.