Jump to content
  • Advertisement
Sign in to follow this  
unforgiven12

DX10 Texture Transperency

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

Hi,

Just wondering if anybody has any examples of how to control the transperency of a texture in the .cpp file rather than in the effects .fx file.
For example I am trying to create a texture that has a 50% opacity so the background behind it would still be visiable. By the way, I already set up the blend state to remove the black background on my texture.

Thanks Unforgiven

Share this post


Link to post
Share on other sites
Advertisement
You would create a global shader constant variable that symbolizes the opacity value.

-In the shader logic, you would use that variable to modulate your output alpha value
-and-
-In the host program (your game/engine), you would set the constant value via the device context so that the shader can see it.

In D3D10 and up, shader constants are uploaded to the GPU in constant buffers. If you do this without FX files (as in using raw shader methods), it can be tedious to update a whole constant buffer just to update a single float (this requires almost the same work as updating a whole lot of constants).

The Effect framework simplifies the process greatly by abstracting the shader constants into simple to use effect variables backed with a metadata-based reflection system. This way, you don't have to worry about how the core API expects your shader parameters to be uploaded.

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!