glviewvol

view sdr/fast.p.glsl @ 8:fb6d93471352

main thing done
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 30 Dec 2014 20:03:32 +0200
parents 04330eb80b36
children 931a6b35f1cd
line source
1 uniform sampler3D vol_tex;
2 uniform sampler1D xfer_tex;
4 void main()
5 {
6 vec3 tc = gl_TexCoord[0].xyz;
7 float max_manh_dist = max(tc.x, max(tc.y, tc.z));
8 float min_manh_dist = min(tc.x, min(tc.y, tc.z));
9 float border = step(0.0, min_manh_dist) * (1.0 - step(1.0, max_manh_dist));
11 vec4 voxel = texture3D(vol_tex, gl_TexCoord[0].xyz);
12 vec4 color = texture1D(xfer_tex, voxel.a);
14 float alpha = color.a * border;
15 if(alpha < 0.001) discard;
17 gl_FragColor.rgb = voxel.rgb;
18 gl_FragColor.a = alpha;
19 }