Jump to content
  • Advertisement
Sign in to follow this  
KevArnold

Way to draw only alpha channel without pixel shader?

This topic is 2922 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 have a full color RGBA texture used to draw my 2d character. I draw his shadow currently by flipping the texture, squishing it a little and applying a pixel shader that lets me replace the contents with a single color.

I am wondering if its possible to do this without a pixel shader using a texture state or a different setting? I've been reading through the DirectX documentation and testing the different states with no success.

Share this post


Link to post
Share on other sites
Advertisement
You can modify a texture in the CPU, you check the current pixel color and replace it the black.

Which version of DirectX are you using? Why do you want to do that without the pixel shader?

Share this post


Link to post
Share on other sites
Quote:
Original post by Aqua Costa
Which version of DirectX are you using? Why do you want to do that without the pixel shader?


I am using DirectX 9.

I would like to do it without pixel shaders first to see if its possible and then to test its speed against the pixel shader version.

Share this post


Link to post
Share on other sites
Quote:
Original post by KevArnold
Quote:
Original post by Aqua Costa
Which version of DirectX are you using? Why do you want to do that without the pixel shader?


I am using DirectX 9.

I would like to do it without pixel shaders first to see if its possible and then to test its speed against the pixel shader version.


Your results aren't going to be meaningfully different, but using your own shaders is preferable. All rendering is done with pixel shaders behind the scenes anyway. If you don't supply a shader, it uses its own under the hood.

Locking the texture, updating its color information, unlocking it, then sending it to the GPU is going to be slower than just writing a pixel shader that returns the alpha value.

Share this post


Link to post
Share on other sites
Also, you should try not to use the fixed function pipeline because when you move to DirectX 10 you will have to write your own shaders for everything...

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!