invisible

diff data/shaders/invisible.v.glsl @ 24:8b81571dd4dd

fooo
author Eleni Maria Stea <eleni@mutantstargoat.com>
date Sun, 17 Nov 2013 00:15:04 +0200
parents b50ad2711f5f
children 61d593076c56
line diff
     1.1 --- a/data/shaders/invisible.v.glsl	Sat Nov 16 23:29:15 2013 +0200
     1.2 +++ b/data/shaders/invisible.v.glsl	Sun Nov 17 00:15:04 2013 +0200
     1.3 @@ -1,10 +1,15 @@
     1.4  uniform sampler2D depth_tex;
     1.5 +varying float mask;
     1.6  
     1.7  void main()
     1.8  {
     1.9 -	float depth = texture2D(depth_tex, gl_MultiTexCoord0.xy).r;
    1.10 +	const float threshold = 0.8;
    1.11 +	const float scale = 4.0;
    1.12 +
    1.13 +	float texel = texture2D(depth_tex, gl_MultiTexCoord0.xy).r;
    1.14  	vec4 vpos = gl_Vertex;
    1.15 -	vpos.z = depth;
    1.16 +	mask = 1.0 - step(threshold, texel);
    1.17 +	vpos.z = texel * mask * scale;
    1.18  
    1.19  	gl_Position = gl_ModelViewProjectionMatrix * vpos;
    1.20  	gl_TexCoord[0] = gl_MultiTexCoord0;