apply-fog.glsl 238 B

123456
  1. #ifdef dUseFog
  2. float depth = length(vViewPosition);
  3. // float depth = gl_FragCoord.z / gl_FragCoord.w;
  4. float fogFactor = smoothstep(uFogNear, uFogFar, depth);
  5. gl_FragColor.rgb = mix(gl_FragColor.rgb, uFogColor, fogFactor);
  6. #endif