Sha256: 600aba0d494cf55d8abf7a1941503f8406803a749d4e64844217b23bc10c831f
Contents?: true
Size: 864 Bytes
Versions: 13
Compression:
Stored size: 864 Bytes
Contents
#version 330 uniform vec3 color; uniform sampler2D map; uniform float opacity; uniform int fogType; uniform vec3 fogColor; uniform float fogDensity; uniform float fogNear; uniform float fogFar; uniform float alphaTest; in vec2 vUV; layout(location = 0) out vec4 fragColor; void main() { vec4 texture = texture( map, vUV ); if ( texture.a < alphaTest ) discard; fragColor = vec4( color * texture.xyz, texture.a * opacity ); if ( fogType > 0 ) { float depth = gl_FragCoord.z / gl_FragCoord.w; float fogFactor = 0.0; if ( fogType == 1 ) { fogFactor = smoothstep( fogNear, fogFar, depth ); } else { const float LOG2 = 1.442695; float fogFactor = exp2( - fogDensity * fogDensity * depth * depth * LOG2 ); fogFactor = 1.0 - clamp( fogFactor, 0.0, 1.0 ); } fragColor = mix( fragColor, vec4( fogColor, fragColor.w ), fogFactor ); } }
Version data entries
13 entries across 13 versions & 2 rubygems