I am currently writing a simple 3D space visualisation program. Things get loaded into it from a simple XML file, which contains positions and sizes of objects in space, so you can put basically any numbers into the XML and it will show you what the things look like in 3D.

My problem is that when I try view for example a solar system, using real numbers as they really are in space (e. g. earth-moon distance = 3.844e8 m), my objects loose their form and textures get detached from faces due to limited floating position precision. I simply can't make users to scale the scene themselves, because with 10 planets or so it's too much work, and sometimes calculations little bit more complex.

Because of this, I decided to add an option that would make it possible for one to scale whole scene automatically.

My question is rather simple: If I want to scale world/scene, which matrix should I use? Projection matrix, view matrix, or a completely new matrix (please, not this one, I'm running out of uniforms)?

Thank you.

  • \$\begingroup\$ Scaling (as well as other transformation operations) is usually done with the world matrix. If you're using separate uniforms for position, rotation, and scale, you can combine them all into a single world matrix. \$\endgroup\$ – fastinvsqrt Jan 6 '15 at 22:20

You can make objects appear smaller or larger simply by moving the camera further or closer to them, so you will need to change the view matrix.

However, since the numbers you are dealing with are potentially large, be sure to also fix the projection matrix for the near and far clipping plane values.

Finally, note that astronomy pictures are often taken with a very small field of view. This is also set up in the projection matrix.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.