- Home /
The question is answered, right answer was accepted
Simple shader fog functionality issue
Hi good people of Unity and beyond,
I have a headache inducing issue with UnityCG.cginc functions and it boils down to this:
If I use this code snippet in my shader:
UNITY_APPLY_FOG_COLOR(i.fogCoord, col, _FogColor);
And it works perfectly, as it should be. But if I use this code instead:
float fogFac = (i.fogCoord) * unity_FogParams.z + unity_FogParams.w;
UNITY_FOG_LERP_COLOR(col, _FogColor, fogFac);
Is not working remotely the same. It should give exact same identical results because that's literally what the former function does (according to UnityCG documentation). But why it doesn't it is beyond me. Keep in mind I am new to GC and shaders but I my initial conclusion is that documentation is not up to date or is old or something else.
What am I missing here? Please help.
Bojan Franzee Brankov
UPDATE: Never $$anonymous$$d. Documentation was outdated. I opened UnityCG.cginc and found the new formula.
Follow this Question
Related Questions
Water Shader Reflection & Transparency Distance 0 Answers
Is merging this two shaders possible? 0 Answers
Global fog doesn't work? 0 Answers
Default-Sprite with fog 1 Answer