Volume Rendering
Hi!
I wanna render a volumetric object using a 3d texture (slices), by DX9 and VC++!
I wanna see a source code!
Thanks!
So, I have a VolumeTexture and I wanna render it! I don't know how can I create the mesh from 3d texture information!
Thank You!
Thank You!
Quote:Original post by Larry91
Hi!
I wanna render a volumetric object using a 3d texture (slices), by DX9 and VC++!
I wanna see a source code!
Thanks!
Render a quad for each slice of the volume, texture it with a slice of your 3D texture, i.e. each slice uses a constant valve for the 3rd component of the UVW set.
An alternative approach would be to store your volume as a number of 2D textures, for each slice change texture and draw your quad. This is more draw calls sure (higher CPU load) but 2D texturing is faster than 3D on the GPU.
Source to texture a quad with a 2D texture is very very easy to find.
Is there a specific reason you want to render using slices instead of ray-casting? Do you intend to render surfaces or "cloudy" data? What about lighting and shadows? Rendering slices can be faster on current GPUs, but ray-casting is attractive for its flexibility and is becoming comparable in performance.
Any modern implementation will use 3D textures. 2D texturing is an old approach used before GPUs offered 3D texturing.
For slicing, you can generate view-aligned slices of a box, which involves intersecting a sequence of planes with the box to get a sequence of polygons with appropriate 3D tex coords. This intersection is equivalent to marching cubes for a voxel. Then you render the slices either back-to-front or front-to-back, depending on how you are compositing. In your pixel shader, you typically map a scalar texture value to RGBA using a transfer function implemented as a 1D texture. You can increase quality using pre-integration, which involves precomputing color/alpha composition for the space between slices.
I don't have any source code handy, but here are some links:
Slicing: http://www.cs.utah.edu/~jmk/sigg_crs_02/courses_0067.html
Ray-casting: http://medvis.vrvis.at/projects/gpuraycast/
Any modern implementation will use 3D textures. 2D texturing is an old approach used before GPUs offered 3D texturing.
For slicing, you can generate view-aligned slices of a box, which involves intersecting a sequence of planes with the box to get a sequence of polygons with appropriate 3D tex coords. This intersection is equivalent to marching cubes for a voxel. Then you render the slices either back-to-front or front-to-back, depending on how you are compositing. In your pixel shader, you typically map a scalar texture value to RGBA using a transfer function implemented as a 1D texture. You can increase quality using pre-integration, which involves precomputing color/alpha composition for the space between slices.
I don't have any source code handy, but here are some links:
Slicing: http://www.cs.utah.edu/~jmk/sigg_crs_02/courses_0067.html
Ray-casting: http://medvis.vrvis.at/projects/gpuraycast/
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement