Friday, October 29, 2010

Scales again

I've been thinking a lot about scales recently, once again, and those thoughts driving me nuts slowly.

Space is a very very very large thing. Our planet is about 6'300 km in radius, that is 12'600 km in diameter, and that is 12'600'000 meters, 8 digits. Assuming one world unit in the close distance is 1 meter of the planet, I have only 100 more sized object to be able to handle in close distance. So if I will be crazy enough to fly close to the sun (so that is should be rendered in real scale), I would have an float overflow because the radius of the sun is abou 110 times bigger, that the Earth's radius. We can ask why do we need such big numbers to store if we are 10 meters from the surface? Well, even if the part of a surface if 10 meters from you, you still have to take in mind that the center point of an asteroidal body is way far away from you and it is needed to make a proper curvature of a planet. To solve this somehow I have only 3 options in my mind:
  1. Store vertex coordinates in doubles and apply exponential space transformations before converting them to floats.
  2. Store vertex coordinates in doubles and cull vertexes that are very far away.
  3. Make up something else.
And in my opinion, the only reasonable option is the last one..

There are couple of planetary engine demos around the web, I wonder how they solve this problem.

No comments:

Post a Comment