volmetrics
diff data/shaders/transfer.f.glsl @ 24:c4662d60cd93
foo
author | Eleni Maria Stea <elene.mst@gmail.com> |
---|---|
date | Thu, 24 Apr 2014 21:33:26 +0300 |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/data/shaders/transfer.f.glsl Thu Apr 24 21:33:26 2014 +0300 1.3 @@ -0,0 +1,18 @@ 1.4 +uniform sampler3D tex; 1.5 +uniform float tmin; 1.6 +uniform float tmax; 1.7 + 1.8 +float transfer(float x, float tmin, float tmax) 1.9 +{ 1.10 + float dt = 0.25 * (tmax - tmin); 1.11 + return smoothstep(tmin - dt, tmin + dt, x) * 1.12 + (1.0 - smoothstep(tmax - dt, tmax + dt, x)); 1.13 +} 1.14 + 1.15 +void main() 1.16 +{ 1.17 + float texel = texture3D(tex, gl_TexCoord[0].xyz).x; 1.18 + float val = transfer(texel, tmin, tmax); 1.19 + 1.20 + gl_FragColor = vec4(val, val, val, 1.0); 1.21 +}