depthmap

Blitz3D Forums/Blitz3D Programming/depthmap

fuzzy(Posted 2004) [#1]
would it be possible to render a 2d depthmap from a
mesh in 3d space? The reason for this being to read the pixels from the 2d depthmap.


Rob Farley(Posted 2004) [#2]
Perfectly possible just do a bunch of line picks at the meshs you want to create the depthmap with, and move your linepicks in a grid the size of the image you want to create. Job done.


John Pickford(Posted 2004) [#3]
Perhaps if you manually set the vertex colour of each vertex to a shade of grey depending on how far away from the camera it is? You'd need to turn off lighting and render full bright.


fuzzy(Posted 2004) [#4]
great input, thanks a lot


sswift(Posted 2004) [#5]
Use black fog, with a white model?


fuzzy(Posted 2004) [#6]
sswift, could you elaborate a bit on the black fog, white
model?


TeraBit(Posted 2004) [#7]
That's fiendish thinking Mr. Sswift 8D


sswift(Posted 2004) [#8]
fuzzy:
Fog is distance based. The farther away your model is, the more it will be fogged.

If you set the near fog value to be in front of your object, and the far fog value to be in back of it, and you set the object to be fullbright and white, then the pixels in the object's polygons will be darker the farther away from the camera they are.

Fog is linear as well, so if the color ends up being grey than you are halfway between the near and far fog planes.

The limitation of this is that if you are in 32bit color mode, you will only get 256 different levels of distance. You could however render several passes and improve the accuracy but how that works is for you to figure out. :-)

Fog may not give you a perfect depth map though. It may work like goraud shading, so the depth would be interpolated between the vertices, which might not result in true depth. But if you do not need a highly precise depth map it may be good enough.


fuzzy(Posted 2004) [#9]
well, I'll start boiling the brain on that
thanks a lot