Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 831 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
How to make a pixel shaded surface transparent? #57326
10/08/05 12:29
10/08/05 12:29
Joined: Aug 2003
Posts: 183
BionicHero Offline OP
Member
BionicHero  Offline OP
Member

Joined: Aug 2003
Posts: 183
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.

Re: How to make a pixel shaded surface transparent [Re: BionicHero] #57327
10/08/05 16:22
10/08/05 16:22
Joined: Mar 2001
Posts: 3,298
Beverly, Massachusetts
Rhuarc Offline
Expert
Rhuarc  Offline
Expert

Joined: Mar 2001
Posts: 3,298
Beverly, Massachusetts
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


I no longer post on these forums, keep in touch with me via:
Linkedin.com
My MSDN blog
Re: How to make a pixel shaded surface transparent [Re: Rhuarc] #57328
10/08/05 20:34
10/08/05 20:34
Joined: Aug 2003
Posts: 183
BionicHero Offline OP
Member
BionicHero  Offline OP
Member

Joined: Aug 2003
Posts: 183
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.

Re: How to make a pixel shaded surface transparent [Re: BionicHero] #57329
10/09/05 17:44
10/09/05 17:44
Joined: Oct 2002
Posts: 8,939
planet.earth
ello Offline
Senior Expert
ello  Offline
Senior Expert

Joined: Oct 2002
Posts: 8,939
planet.earth
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


www.earthcontrol.de
quoted: We want to maintain a clean, decent, American family suited forum look... which means you may post zombies or chainsaw massacres, but no erotic.
Re: How to make a pixel shaded surface transparent [Re: ello] #57330
10/09/05 20:18
10/09/05 20:18
Joined: Oct 2003
Posts: 4,131
M
Matt_Aufderheide Offline
Expert
Matt_Aufderheide  Offline
Expert
M

Joined: Oct 2003
Posts: 4,131
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


Moderated by  Blink, Hummel, Superku 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1