volmetrics
view 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 source
1 uniform sampler3D tex;
2 uniform float tmin;
3 uniform float tmax;
5 float transfer(float x, float tmin, float tmax)
6 {
7 float dt = 0.25 * (tmax - tmin);
8 return smoothstep(tmin - dt, tmin + dt, x) *
9 (1.0 - smoothstep(tmax - dt, tmax + dt, x));
10 }
12 void main()
13 {
14 float texel = texture3D(tex, gl_TexCoord[0].xyz).x;
15 float val = transfer(texel, tmin, tmax);
17 gl_FragColor = vec4(val, val, val, 1.0);
18 }