This topic is now archived and is closed to further replies.

Katie Bentley

OpenGL voxel commands?

Recommended Posts

Katie Bentley    122
hi there, I have a 3D array of values called GRID[x][y][z], I would like to plot a grid of voxels such that voxel (x,y,z) has a colour relating to the value of GRID[x][y][z]. When I used vertex3f(x,y,z) there were large gaps between the dots so I deffo need voxels, is there a similar command for voxels or a set of functions someone could give me? Will be very much appreciated!!! Cheers, Kate

Share this post

Link to post
Share on other sites
JuNC    236
OpenGL doesn't have any direct methods for volume rendering, it's quite a large field of graphics anyway. Several techniques exist, including 'splatting' and 3D texture slicing.

Splatting is a sort of extension to the individual point method (that you tried and found simply isn't good enough ) which is pretty good, but it depends on what hardware you're attempting to run on.

Another technique is called Marching Cubes which extracts a surface from the dataset by laying a regular (3D) grid over the data and working out at each grid point whether it should be inside or outside, then constructing triangles for each cube of the grid based on those tests and interpolation between them.

I did some quick searching and came up with a few links to get you started (various techniques):
Advanced OpenGL techniques course notes
Looks like a fast splatting method
Some good google hits

If you don't want to implement from first principles, I'm sure there are some free (and definitely some not free) volume rendering libraries, but I don't know any offhand. Perhaps if you can narrow down the kind of imaging you need (e.g medical? landscape?) there will be a library you can just drop in.

Hope that helps.

[edited by - JuNC on September 2, 2003 5:09:23 PM]

Share this post

Link to post
Share on other sites
vincoof    514
You can change the size of the points thanks to the glPointSize command, and thus reduce the gap between points.
The problem with that methode is that all points have the same size, and unless you''re in orthographic view it''s not the desired result. So, if you''re in perspective view you may use the ARB_point_parameters extension which modulates the point size depending on the distance bewteen the point and the camera.

Share this post

Link to post
Share on other sites