uniform vec4 Color; varying float LightIntensity; varying vec3 MCposition; uniform sampler3D Noise3; uniform float Min, Max; uniform float Scale; #undef WANT_RED_AT_EDGES void main() { vec4 nv = texture3D( Noise3, Scale*MCposition ); float sum = nv[0] + nv[1] + nv[2] + nv[3]; // .5 -> 1.5??? sum = ( sum -.5 ); // 0. -> 1. if( sum < Min ) discard; if( sum > Max ) discard; gl_FragColor = vec4( LightIntensity*Color.rgb, 1. ); #ifdef WANT_RED_AT_EDGES if( sum < Min + .05 ) gl_FragColor = vec4( LightIntensity*vec3(1.,0.,0.), 1. ); #endif }