Sign in to follow this  
Shawn1984

Use alpha channel to store the depth value

Recommended Posts

I read an article talking about toon shaing. The article uses a vertex shader to fill in alpha channel with the depth value of the pixel for later edge detection. But I tried it myself and I found that my alpha channel is alway 0 even I have set the clear value to (0,0,0,1). I do not know why. And one thing I'm confused is that the articel uses alpha channel to store depth ,but will the alpha channel value get interpolated when the final image is produced? Thanks a lot in advance!

Share this post


Link to post
Share on other sites
What is the format of the surface that you are rendering to? Formats such as D3DFMT_X8R8G8B8 (common for default back-buffer) default to 0 for all alpha. You should use a format such as D3DFMT_A8R8G8B8 (or any of the higher-precision ones).

Share this post


Link to post
Share on other sites

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