Jump to content
  • Advertisement
Sign in to follow this  
akira32

PS show the pixel' transparency is equal to half

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

PS show the pixel' transparency is equal to half(0.5f) Why can I see the piexel has transparency(0.5f)? Do I lose define some variable in effect file? //Programminbg Vertex and Pixel Shaders\Chapter 4 - Ambient
float4 PS() : COLOR
{
  float Aintensity = 0.8f;
  float4 Acolor =  float4(1.0f, 0.075f, 0.075f, 0.5f);
  return Aintensity * Acolor;
}


Share this post


Link to post
Share on other sites
Advertisement
Can you be a bit clearer? I don't really understand your question unfortunately.

For debugging you can do something like:

if(a - 0.5f <= 1e-5f)
return COLOUR_IF_EQUAL_HERE;
else
return COLOUR_IF_NOT_EQUAL_HERE;


To see which pixels are equal to 0.5f...

hth
Jack

Share this post


Link to post
Share on other sites
Use the following to enable alpha blending.

device->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);

Share this post


Link to post
Share on other sites
Quote:
Original post by ET3D
Use the following to enable alpha blending.

device->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);


Thank you. But how to write the three lines in shader file?
I had seen the syntax, but now I forgot where they are.
Could somone tell me how to write the three line in shader file and the place describe the syntax in MDSN?

Share this post


Link to post
Share on other sites
Quote:
Original post by ET3D
Check out "Effect States" in the dx docs.

Thank you a lot.

AlphaBlendEnable=TRUE;
SrcBlend=SRCALPHA;
DestBlend=INVSRCALPHA;

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!