I have a volume of data that respresents spatial intensity.
The individual values of the volume are accessable as float val = V[z][y][x];
I need to render this as a cube with all but one ‘quadrant?’ of the cube rendered so that I can see values to the center of the volume.
How do I go about doing this?
Well it isn’t exactly a plane its more like a volume of the volume that I want to clip.
Image if you will a volume that is made of 8
volumes. 1 of the volumes is to be clipped out…
Is this simply 3 clipping planes?
Is each pixel in the volume a vertex of a voxel? How are voxels filled?
Actually, after running some tests, I realize I was wrong. It appears it will only clip outer portions of the bounding clip planes. So, if you try to clip say x > -4 and x < 4 then it clips everything.
Another possibility is glTexSubImage, which replaces the stored portion of your texture with other texture data (black with 0 alpha and do blending to see what is behind it). Of, course, you then have to reload your texture or portions of it when you need it all again. Not sure how expensive it is or if you processing time is important to you.
Sorry. Didn’t mean to lead you astray.
No problem… I’m still designing.
Perhaps I just shouldn’t build verticies for the cube that I don’t want to render, and only define verticies for the voxels I do want to render.
But how do you define the list of vertecies for a single voxels (8 points) such that you could pass a plane through it diagonally and get an interpolated cross section?
Here’s how I draw my volumes, I think it’s a pretty general way, so maybe it’ll help you.
Limit the drawing frustum into the volume’s area by clipping planes. Set up texgen to automatically generate texture coordinates into your volume data. Then unproject your screen corners so that you can draw a quad that covers the entire screen. Start with a quad at far plane, and draw lots of quads, moving it’s vertices slightly towards the eye after each one, until you’re at the near plane. If you need draw front-to-back, just start from the near plane instead.
In your case, you could divide your volume into three boxes and draw them one at a time.