Jump to content
  • Advertisement
Sign in to follow this  
flery

[Shader] Set Pixel Color to transparent ?

This topic is 4422 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
Advertisement
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
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!