Shader messes with the transparency

All topics about ZGameEditor goes here.

Moderator: Moderators

Post Reply
jinxtengu
Posts: 122
Joined: Wed Oct 14, 2009 2:05 pm
Contact:

Shader messes with the transparency

Post by jinxtengu »

Hey Iv'e been trying out an old shader code, I can post a link to it later but i’m on another computer right now.

Anyway the shader makes objects fade into the distance, but I’ve found when applied to models with a transparent "Black rgb 000" background the transparency stops working and I get a black box visible around the model. any idea how to might be able to resolve this problem?
jinxtengu
Posts: 122
Joined: Wed Oct 14, 2009 2:05 pm
Contact:

Re: Shader messes with the transparency

Post by jinxtengu »

Here's an example of the glsl shader Iv'e been trying to use.

http://www.revengeofthesunfish.com/fog_ ... ng.zgeproj

When I run the example I see the images disappear suddenly rather than fade.
Is there a fix to get this shader to fade gradually and keep transparency with flat models?
User avatar
Kjell
Posts: 1876
Joined: Sat Feb 23, 2008 11:15 pm

Re: Shader messes with the transparency

Post by Kjell »

Hi jinxtengu,
jinxtengu wrote: Thu Dec 06, 2018 12:29 amIs there a fix to get this shader to fade gradually and keep transparency with flat models?
It's because your alpha test is set to "greater than 0.5". Any pixel that fails that test won't get rendered. Either adjust the threshold value ( why not use greater than 0 ) or mix with "vec4(0,0,0,1)" instead of "vec4(0,0,0,0)" in your fragment shader .. depends a little on how you want things to work.

K
jinxtengu
Posts: 122
Joined: Wed Oct 14, 2009 2:05 pm
Contact:

Re: Shader messes with the transparency

Post by jinxtengu »

Thanks. I got it working now. I was adding the alpha test without even realising it could be edited. I just assumed it was either on or off, I see now it works with a threashold, which makes sense.
Post Reply