Jump to content
  • Advertisement
Sign in to follow this  
jeftay

2D Mirror Blend

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

First time post.

Basically I am traying to render a texture that already contains an alpha and also supply an alpha value.

I then need to render a second texture on top of it with its own alpha values.

Here is what I have so far.

Direct3DDevice.SetTexture(0, background);
Direct3DDevice.SetTexture(1, bordertexture);

// This renders my transparent background with an alpha transparency of 50%.
Alpha := Round(255 * (1 - (50 / 100)));
Direct3DDevice.SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
Direct3DDevice.SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
Direct3DDevice.SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
Direct3DDevice.SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
Direct3DDevice.SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_CONSTANT);
Direct3DDevice.SetTextureStageState(0, D3DTSS_CONSTANT, (Alpha SHL 24) OR $FFFFFF);

// This is where It messes up.
// I want to render my border ontop of the background with a 10% transparency on the border only.
Alpha := Round(255 * (1 - (10 / 100)));
Direct3DDevice.SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_ADD);
Direct3DDevice.SetTextureStageState(1, D3DTSS_COLORARG1, D3DTA_CURRENT);
Direct3DDevice.SetTextureStageState(1, D3DTSS_COLORARG2, D3DTA_TEXTURE);
Direct3DDevice.SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_BLENDTEXTUREALPHA);
Direct3DDevice.SetTextureStageState(1, D3DTSS_ALPHAARG1, D3DTA_CONSTANT);
Direct3DDevice.SetTextureStageState(1, D3DTSS_CONSTANT, (Alpha SHL 24) OR $FFFFFF);

This renders the border with a 10% transparency ontop of the background but instead of the background bleeding through the border, the item below the background is bleeding through, totally ignoring the background color.

Sorry, I am so confused.

Jeff.
Thanks.

Share this post


Link to post
Share on other sites
Advertisement
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!