Sign in to follow this  
jeftay

2D Mirror Blend

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

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