|
|
pixelshader for overlays without border seams
#17217
09/20/03 00:13
09/20/03 00:13
|
Joined: May 2002
Posts: 7,441
ventilator
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2002
Posts: 7,441
|
i wrote a pixelshader which avoids the disadvantages of d3d_autotransparency.
you have to use a 32bit tga texture. all pixels with alpha values above 0.5 will be rendered completely opaque and all other pixels will be rendered completely transparent. it's possible to enable the z-buffer then, so you won't have any sorting errors!
currently it can't be used for sprites because shaders don't seem to work with them...
in my opinion it looks better than overlays looked in a5.24 because there are no jagged edges!
Code:
...
ZWriteEnable=true;
AlphaTestEnable=true;
...
PixelShader=
asm
{
ps.1.3
def c0,1,1,1,1
def c1,0,0,0,0
tex t0 // sample t0
mov r0,t0
cnd r0.a,r0.a,c0,c1 // if(r0.a>0.5){r0.a=1;}else{r0.a=0;}
mul r0.rgb,r0,v0 // modulate with diffuse vertex lighting
};
entities using this shader should have my.flare=off; and my.transparent=off; so that the engine won't unnecessarily sort them!
here is a screenshot:
|
|
|
Re: pixelshader for overlays without border seams
[Re: ventilator]
#17219
09/27/03 05:53
09/27/03 05:53
|
Joined: Jul 2003
Posts: 82 Southern California
lucidman
Junior Member
|
Junior Member
Joined: Jul 2003
Posts: 82
Southern California
|
Which version of A6 are you using to do this?
Vision is mind Mind is emptiness Empty is clear light Clear light is union Union is great bliss
|
|
|
Re: pixelshader for overlays without border seams
[Re: ventilator]
#17222
10/01/03 08:00
10/01/03 08:00
|
Joined: Oct 2001
Posts: 678 Alabama
Cameron_Aycock
Developer
|
Developer
Joined: Oct 2001
Posts: 678
Alabama
|
What type of FPS hit is there for 30-50 of these polys using this technique, vs normal overlays?
Popular media is the opiate of the masses.
Think for yourself.
|
|
|
Re: pixelshader for overlays without border seams
[Re: Matt_Aufderheide]
#17225
12/04/03 16:10
12/04/03 16:10
|
Joined: May 2002
Posts: 7,441
ventilator
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2002
Posts: 7,441
|
i don't have much experience with multipass rendering but you could try to add the cnd line
def c0,1,1,1,1
def c1,0,0,0,0
...
cnd r0.a,r0.a,c0,c1 // if(r0.a>0.5){r0.a=1;}else{r0.a=0;}
to both passes? (of course you have to modify it so that it uses the correct alphachannel in both passes...)
|
|
|
|