The question is answered
Fog effect not working in built exe
Hi, I use a blue fog when camera is underwater.. It works all OK if I run the game from within unity. But if i create a windows .exe and run the game from there, the fog is not seen anymore. Any pointers?
Thank You.
A few things it might be, are you sure your scene is in the build with the fog.
Is your performance choice for running the game effecting it?
Performance doesn't affect it.. same with good or beautiful.. I don't get "scene is in the build with the fog". Do we have separate renderer (or lighting.. as in the new unity) settings for making a standalone .exe than executing within unity? (It works O$$anonymous$$ if i run from unity)
This is a very vaguely formulated question.
There are hundreds of reasons and possibilities what you are doing and what doesnt work and why.
You "use a blue fog" when a "camera is underwater".
What kind of fog are you using. Billboards, custom vertex/fragment shaders, etc. How do you apply it. Is the script set to execute normally and not only in the editor. Are you manipulating the editors rendering with shadermodel emulation settings. Are your quality settings allowing the fog to render. The editor will preview the currently edited quality setting in the quality settings tab.
I could continue this list, but I won't because it wouldn't help the situation. ;)
When asking a question please be concise and tell us exactly what you did and what you have tried already to solve your problem, so we have a base to begin with.
Please edit your question to suit the above points. Otherwise this is a guessing game. ^^
PS: What jmgek was asking is: Is your scene with the fog included in the list of scenes in the "build settings"? Is the build definitely starting with that same scene?
Nothing fancy. Not billboard or custom shader or particles or anything. Just the fog.
RenderSettings.fog = true;
RenderSettings.fogColor = new Color(0,0.4f,0.7f,0.6f);
RenderSettings.fogDensity = 0.04f;
Of course, the scene is included in the build scene list.. (Otherwise i won't be able to execute that scene right?) But No, i don't start in that scene. (This is the second scene actually.. ) In the quality settings it is set to "good", and in the standalone also I tried "good". (Actually, tried all quality settings in standalone). I don't see any setting in quality settings that refer to fog. Only in the per-scene "lighting" menu.
Answer by TSRajesh · Jan 11, 2016 at 07:47 AM
Okay, what worked for me is the solution I saw in the stackoverflow forum.. Changing the changing the "Shader Stripping" fog modes, in Graphics settings, to manual. This apparently is some sort of workaround, but works..
http://stackoverflow.com/questions/23541146/no-fog-after-build
Answer by jmgek · Jan 11, 2016 at 06:28 AM
Try to set the fog to 'Linear'. Linear fog will show a consistent experience between the editor and devices/screens.
I already tried that, before posting the question. (After soem googling) In Windows->Lilghting-> Fog->Fog $$anonymous$$ode = Linear.. Still the same. Woks in Unity run, doesn't work in standalone executable..
Follow this Question
Related Questions
How to do a fog effect on Android devices ? 0 Answers
Volumetric glow from emissive material in HDRP? 0 Answers
Sprites do not work with global fog 0 Answers
Change fog density between cameras?,Changing the density of fog 0 Answers
Unity3D Fog Bug Please Help 0 Answers