PDA

View Full Version : 3D Models from Image Slices



Microfunguy
07-18-2003, 12:33 PM
I have a greyscale bitmap that has the values 0 to 20 at each pixel position.
These refer to one of 21 bitmaps (of same proportions) that contain the 'sharp' pixel to use at that position.
So, for each level I have a bitmap image of just the sharp pixels, the rest being black.

I can see that I have to render each image bitmap on a quad, from back to front with depth-testing enabled, at a certain distance corresponding to it's depthmap value (or 'slice number').

What is the best way to do this ?

I will have to make the black transparent, can I copy the depthmap to z-buffer ?

David Sykes

Relic
07-21-2003, 02:57 AM
If the final combined image is a flat 2D composite of the 21 images here's one solution:
- glDrawPixels of the index image into the stencil buffer.
- for each image
+ set stencil reference value to image id (0 to 20), set stencil test to GL_EQUAL, set stencil ops to GL_KEEP.
+ draw image (e.g. download all images as textures before and render textured quad, or draw pixels)

That is for each image only the pixels corresponding to their id in the index image are drawn.