How to make a pixel shaded surface transparent?

Posted By: BionicHero

How to make a pixel shaded surface transparent? - 10/08/05 12:29

Hi!
I was wondering: How you would make a surface that's being rendered by a pixel shader transparent. Is it enough to just set the "out" color's .a value to 0.5? Or do you need to use some entity parameters or set some FFP stuff correctly? I'd be glad if someone could help me.
Posted By: Rhuarc

Re: How to make a pixel shaded surface transparent - 10/08/05 16:22

In the FFP, make sure you set AlphaBlendEnable to TRUE. Then it will use the alpha channel.
You will might want to change the blending mode through SrcBlend and DestBlend as well. (check the directx documentation for possible values).

-Rhuarc
Posted By: BionicHero

Re: How to make a pixel shaded surface transparent - 10/08/05 20:34

Ok, first thanks for pointing me into the right direction. However I'm still a bit confused. I guess the "Dest" color is the color which is already in the framebuffer, the "Src" color is the value that gets computed by the pixel shader.
I want to do a transparent water surface with a terrain underneath. But when I use
Code:
 
AlphaBlendEnable=True;
SrcBlend=SRCALPHA;
DestBlend=INVSRCALPHA;


with out.a set to 0.5, I don't see any of the terrain under the water surface. The surface appears to be like without the code.
Posted By: ello

Re: How to make a pixel shaded surface transparent - 10/09/05 17:44

you need to set BlendOp=1; if you want the src/destBlend parameters to take affect. BlendOp can be set to 1-5, look up those values in your dx9 c++ documentation, search for states..

and maybe you try different values for the blends to see if another combination fits more what you want
Posted By: Matt_Aufderheide

Re: How to make a pixel shaded surface transparent - 10/09/05 20:18

Blendop is set to 1 by default.. usually if this problem is happening it's becuase of some Z-buffer error. Transparent polygons cant write to the zbuffer.. if they do nothing behind them will be visible. So, make sure your entity in A6 has the my.transparent flag on, and in your shader set renderstates:

zenable=true;
zwriteenable=false;
alphablendenable=true;

You shouldnt need to set any blend ops or blend modes..if you just want a plain alpha transparency
© 2024 lite-C Forums