PS show the pixel' transparency is equal to half

Started by
5 comments, last by akira32 16 years, 2 months ago
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;
}


akira32 編程之家 Yahoohttp://tw.myblog.yahoo.com/akira32-akira32
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

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

I want to see the 3d model with alpha blending.
Look like to be transparent.
akira32 編程之家 Yahoohttp://tw.myblog.yahoo.com/akira32-akira32
Use the following to enable alpha blending.

device->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
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?

akira32 編程之家 Yahoohttp://tw.myblog.yahoo.com/akira32-akira32
Check out "Effect States" in the dx docs.
Quote:Original post by ET3D
Check out "Effect States" in the dx docs.

Thank you a lot.
AlphaBlendEnable=TRUE;SrcBlend=SRCALPHA;DestBlend=INVSRCALPHA;
akira32 編程之家 Yahoohttp://tw.myblog.yahoo.com/akira32-akira32

This topic is closed to new replies.

Advertisement