Sunday, July 12, 2015

3D Rotations

Up until now I have used a 3D camera based on a tripod. Useful for FPS shooters and motor vehicle models. But jet fighter and space ship models require true 3D ZYX rotations. Before I show you the javascript code I have to explain how it works.
This diagram roughly shows the viewport pyramid. The camera or eye is situated at the near plane. At the back plane are three values, tx, rx, and lx. From these three points I can interpolate every co-ordinate within the pyramid. Here is the javascript code.

And here is the output in graph3d. I just made two voxel planes. And did some y and z rotations.

Note the viewing pyramid is 320 x 204 and has 256 slices.

No comments:

Post a Comment