yanivber
yanivber

Reputation: 13

How can I create a 3D view of a grayscale depth map?

I've got a grayscale depth bmp image. How can I create a 3D model of it? In addition I've got a color bmp of the exact same image, which I would like to use as a texture for the model above.

I was thinking about creating GL_QUADS and assign texture to each vertex, but I'm not sure which coordinates to use for the vertexes and textures.

Upvotes: 0

Views: 1192

Answers (1)

Andreas Haferburg
Andreas Haferburg

Reputation: 5510

Create a regular grid in the xy plane, one vertex per pixel, with texture coordinates going from 0 to 1, then set the z value of each vertex to the grayscale value (you probably want to scale it by a constant factor). The vertex coordinates don't really matter, as long as they form a regular grid.

Upvotes: 1

Related Questions