I have a 3D array representing a 3D object (x,y,z). The values stored in the array are RGB colors. Is it possible to generate an image of the object from any given point of view?

有帮助吗?

解决方案

That is certainly possible. The keywords here are transformation and projection, basically you define a point for every (3D) Pixel inside your array. Then you multiply all the points with a bunch of matrices and get a 2-dimensional result.

Here is an article about how OpenGL does it's transformations: http://www.songho.ca/opengl/gl_projectionmatrix.html

You could mimic the whole pipeline in C++ to produce a bitmap on your CPU or use OpenGL directly which would be a thousand times faster. When using OpenGL you could also view your model in realtime from all sides, but that would essentially be a full 3D-Application.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top