12.07.2015 Views

4D Volume Rendering - Nvidia

4D Volume Rendering - Nvidia

4D Volume Rendering - Nvidia

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Pass 2– Draw on-screen quadInvoke raycast fragment shaderuniform sampler3D volumeTex; //texture unit 0uniform sampler1D transferFuncTex; //texture unit 1uniform sampler2D backfaceTex; //texture unit 2uniform sampler2D frontfaceTex; //texture unit 3uniform float stepInc; //inc for each samplevoid main() { //back to front ray accumulationvec3 startPos = texture2D(frontfaceTex, gl_TexCoord[0].st).rgb;vec3 endPos = texture2D(backfaceTex, gl_TexCoord[0].st).rgb;vec3 ray = endPos - startPos;float rayLength = length(ray);vec3 step = stepInc*normalize(ray);for (int i=0; i=rayLength)) //out of volumebreak;if (dest.a>0.99) {dest.a = 1.0;break;}curSamplePos += step;} //end of forgl_FragColor = dest;}<strong>Volume</strong> Data

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!