Sign in to follow this  

[Shader] Set Pixel Color to transparent ?

This topic is 4110 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, a quick question (at least i hope so), to set an output pixels alpha value i tried using OUT.color.a = (any number) but no matter what value i set it stays the same. do i have to give the backbuffer into the pixelshader as a texture and calculate the color of the pixel with the background ? or am i missing something ? mfg flery

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Please post your shader code. It sounds like something is going wrong with it, but its hard to tell.

Share this post


Link to post
Share on other sites

//PIXEL SHADER
void ps( in v2p IN, out p2f OUT )
{
float2 tex1 = IN.tex0;

float2 projcoord = (IN.project.xy / IN.project.z);
IN.tex0.x += Timer / 20;

float4 normal = tex2D(texSampler1, IN.tex0.xy*2) - 0.5;

projcoord = projcoord + (normal * 0.1);
float4 reflect = tex2D(texSampler0, projcoord.xy);
reflect.a = 0.5;


OUT.color = reflect;
}


Share this post


Link to post
Share on other sites
pd3dDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
pd3dDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
pd3dDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);

sry problem solved stupid me forget to set the states ...

mfg
flery

Share this post


Link to post
Share on other sites

This topic is 4110 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.

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