Volume Rendering

Started by
4 comments, last by slack 14 years, 1 month ago
Hi! I wanna render a volumetric object using a 3d texture (slices), by DX9 and VC++! I wanna see a source code! Thanks!
Advertisement
Maybe you should give some more details
and ask more kindly to get some answers.
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!
You just need to use 3D texture coordinates instead of 2D in your vertex format.
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.
Cheers,MartinIf I've helped you, a rating++ would be appreciated
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/

This topic is closed to new replies.

Advertisement