- Home /
Unity 5 Global fog with transparency issues
Lately I have been trying out the new lighting system of Unity 5 as well as the fog system. So far I've looked up quite a bit and tried many different things yet I can't get this one solved. When working with transparent shaders the global fog gives a very annoying result as you can see below in the windows
And as well for the skybox/fog transistion, I can't seem to get a good looking effect as objects far away show a pretty harsh transition between being fogged and the skybox.
The transparency issue is obviously also occurring when using decals as shown below.
I have no experience writing shaders and this probably is my roadblock to making proper use of the global fog. So if anyone knows a solution for this issue or has the same issue please let me know. Thanks !
Dunno about the windows, but for the fog, i'd try to simply match the fog's color to the skybox.
Yeah, that is probably the best way to get around that, but the windows and decals are the main issue :/ Thanks for the reply though !
It looks as if the main thing is with the shader on the window pane is transparent. Perhaps not writing on the zbuffer or something. (I know less than you for shaders most probably.) Perhaps use a shader on the windows that isn't transparent from afar, and add a trigger at a point that you know the fog is gone, to change the shader into the one you want. It's a bit of a "ghetto" solution i know.
Answer by mikelortega · Apr 21, 2015 at 02:44 PM
You have to match the skybox and fog's color. Actually, if there is fog you cannot see the sky. For the windows issue, I had to make sure to check Lighting -> Fog active before building the scene (even if density is 0). I hope it helps.
I believe that did the trick ! can't believe that I didn't stumble on that myself.Though there should be a little density as it seems to be the same value used for global fog. Thanks a lot :)
This worked for us also, although our assets were downloading via asset bundles. For this we had to make sure to turn on fog in the scene prior to building our asset bundles.
Answer by 14ercooper · Aug 14, 2015 at 03:52 AM
Method 1 - Simple and easy:
Window --> Lighting
Scroll down and check fog
Edit settings to your liking
Method 2 - Slightly faster, more customization:
Remove Global Light
Add a point light, child to player
Create a material for skybox color
Window --> Lighting
Set skybox material to newly created material
Make sure Sun says None
Set Ambient Source to color
Set the ambient source color
Edit the point light, skybox color material, and ambient source color to suit your needs
I think you are using method 1, so try method 2