0

Unity Shader Graph Fog node shows density inverted when using Linear Fog. Also not properly showing the color of the fog on far objects.

enter image description here enter image description here enter image description here enter image description here

Iroqas
  • 65
  • 9

1 Answers1

0

Seems we are missing one step in the fog calculation. This custom node fix the issue.

Custom node body:

fogIntensity = 0;

#if defined(FOG_EXP)
    fogIntensity = 1 - saturate(exp2(-fogFactor));

#elif defined(FOG_EXP2)
    fogIntensity = 1 - saturate(exp2(-fogFactor * fogFactor));

#elif defined(FOG_LINEAR)
    fogIntensity = 1 - fogFactor;

#endif

Custom node Settings:

enter image description here.

Custom node usage:

enter image description here

Results:

enter image description here

enter image description here

enter image description here

Iroqas
  • 65
  • 9