realXtend / tundra

realXtend Tundra SDK, a 3D virtual world application platform.
www.realxtend.org
Apache License 2.0
84 stars 70 forks source link

Use doubles instead of floats in Ogre and related code #521

Open peterclemenko opened 12 years ago

peterclemenko commented 12 years ago

Currently, Ogre (at least with the windows build script) is using floats, and doubles are disabled. Enabling doubles would allow for more precision and allow for things such as larger worlds. The problem with using floats is that in larger worlds, it can cause z-fighting. Using Doubles, combined with a logarithmic depth buffer, would allow for much larger worlds. It is common to use doubles and log depth buffers in things where large terrains are handled, such as virtual globes. Enabling this would help to allow for Tundra to be ready for larger scenes.

juj commented 12 years ago

Using doubles is not a direction or a solution we prefer to take to enable the use of larger scenes. Instead, for bigger worlds, the most prominent approach is to break them down into multiple smaller scenes, which each have a spatial map coordinate relation to each other. This "global coordinate relation" could then be addressed using doubles or int64s to allow for finer granularity, whereas the local coordinates in individual worlds are centered around the coordinate system origin.

peterclemenko commented 12 years ago

The problem is doubles is needed for things on a massive scale to prevent z fighting. For individual terrain pages, yes, floats work fine, but when working on a larger scale, doubles are needed. I suggest reading up on how I-Novae and Outerra handle their coordinate systems. Also, the book 3D Engine Design for Virtual Globes is a good resource as well.

Watch this video in HD and look at the mountains, this shows why double support is needed: http://www.youtube.com/watch?v=IUHvV80xEbQ