I am only a beginner but Beginners forum could not provide an answer.
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 ?
I don’t know if I understand you fully but you might want to do what I am doin with My IBR demo. Do you mean that you have depth info in one texture and you want to recreate the 3D geometry ?
In that case you can search for IBR (Image Based Rendering). In my demo and in the topic “Simple IBR Demo” i do just that. recreate a 3D geometry out of images + depth info… This is not trivial. Most people do something called relief rendering but then you can do concave objects easily.
I use something that can resemble displacement mapping and that might be the best solution for you.
If you are not doing any scew of your object you can replace the depth values in OpenGL with e.g. a poixel shader.
Yes, I have a depth-map that specifies which of the 21 image-slices (from a microscope) contains the sharpest pixel at any particular screen x,y position.
Image-slice ‘1’ (there is no ‘0’) contains ONLY the sharp pixels at that depth, the rest being black.
The same goes for the other slices.
When I know how to stack these in OpenGL, the resulting 3D models will appear rather ‘blocky’, as if layered from plywood cut-outs.
That will need a rasp and sandpaper to smooth the model .
Then, I want to rotate the model about 10’ left and capture an image and then 10’ right to capture another.
Hopefully we then have a stereo-pair suitable for viewing with my cordless (Infra-red) shutter-glasses.
The result is extended depth-of-field stereo images of microscopic objects.
Next step is to check your link.
Well, I have run the .bat file and just get a white circle moving left to right on a blue background.
Am I doing something silly ?
Will check again.