Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 9 of 9

Thread: GPU-based volume raycasting

Threaded View

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2012
    Location
    Beijing
    Posts
    13

    Question GPU-based volume raycasting

    hello, i have download an source code of GPU-based volume raycasting,which is based on Qt. And i upload it to my google code as below:
    http://code.google.com/p/qt-color-de...downloads/list
    I have read several times of the source code, but in some place i still cannot understand.
    in frag_shader
    Code :
    vec2 intersectBox(vec4 texel_zero, vec4 texel_dir_norm)
    {
    	float t1,t2;
    	t1=(0.0-texel_zero.x)/texel_dir_norm.x;
    	t2=(1.0-texel_zero.x)/texel_dir_norm.x;
    	float tminX=min(t1,t2);
    	float tmaxX=max(t1,t2);
    	t1=(0.0-texel_zero.y)/texel_dir_norm.y;
    	t2=(1.0-texel_zero.y)/texel_dir_norm.y;
    	float tminY=min(t1,t2);
    	float tmaxY=max(t1,t2);
    	t1=(0.0-texel_zero.z)/texel_dir_norm.z;
    	t2=(1.0-texel_zero.z)/texel_dir_norm.z;
    	float tminZ=min(t1,t2);
    	float tmaxZ=max(t1,t2);
    	float largest_tmin = max(max(tminX, tminY), max(tminX, tminZ));
    	float smallest_tmax = min(min(tmaxX, tmaxY), min(tmaxX, tmaxZ));
    	vec2 result=vec2(largest_tmin,smallest_tmax);
    	return result;
    }
    Can somebody tell me how this function get the near and far .
    Last edited by qlizhi; 10-15-2012 at 01:53 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •