Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- uniform sampler3D tex, texIndex;
- uniform int depth;
- varying float sphIndex;
- void main()
- {
- vec3 coord3, coord3Index;
- vec4 lastColor, currColor, color;
- color = vec4(0, 0, 0, 0);
- float currIndex = 0.0;
- float lastIndex = 0.0;
- float deltaIndex = 0.0;
- coord3.xy = gl_TexCoord[0].st;
- coord3Index.xy = coord3.xy;
- float zIndex;
- color = vec4(0.0, 0.0, 1.0, 1.0);
- for(int i = 0; i < depth; i++) {
- zIndex = (i*1.0)/(depth*1.0);
- coord3Index.z = zIndex;
- vec4 vCurrIndex = texture3D(texIndex, coord3Index);
- currIndex = vCurrIndex.r;
- if ( sphIndex <= currIndex) {ยจ
- if ( currIndex < 0.5) {
- color = vec4(0.0, 0.0, 1.0, 1.0);
- } else color = vec4(0.0, currIndex, 0.0, 1.0);
- if ( sphIndex < 0.5) {
- color = color + vec4(sphIndex, 0.0, 0.0, 1.0);
- }
- i = depth +1;
- } else {
- lastIndex = currIndex;
- }
- }
- gl_FragColor = color;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement