0
\$\begingroup\$

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.

\$\endgroup\$
1
  • \$\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\$ Jan 6, 2015 at 22:20

1 Answer 1

1
\$\begingroup\$

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.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .