Sign in to follow this  
akira32

PS show the pixel' transparency is equal to half

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
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

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