0

The global coordinate of WGS84 is too big, a float is not accurate enough. The only two ways I can come up with are using dmat replace for mat or transferring the modelview matrix rather than the model and the view matrices separately. The first method I thought it will bring efficiency problem and the second method which I'm using leads to some troubles such as doing some redundant matrix multiply on CPU.

I search the document of OSG-Earth, it seems to use double precision matrices which is the first method I mentioned, won't it bring efficiency problems?

Is there another way to deal with this problem? Or I should change my coordinate system. How can I design the new coordinate system for the earth-rending?

I'm working on a project which looks like OSG-Earth or Google Earth. Although the camera is near the land at most time, sometimes it will pull up from the land and could see the whole planet.

  • This is not a full answer but you should definitely change your co-ordinate system. This is not so easy and depends on the scope of your simulation (a few kilometers, or whole earth?) Check OSG-Earth for a full, open source example. – Jay Apr 24 '19 at 04:41
  • 1
    You might find this would get reasonable answers on https://gis.stackexchange.com/ – Tim Holt Apr 24 '19 at 04:59
  • You might also find this a good read about just what kind of precision you can get with floating point: https://en.wikipedia.org/wiki/Decimal_degrees – Tim Holt Apr 24 '19 at 05:10
  • @Jay Thank you, I will try to find the answer in OSG-Earth – Sheldon Wang Apr 24 '19 at 05:33
  • As described in this answer, if you're trying to describe a game scene the size of the Earth in a 32-bit floating point coordinate system, you'll typically have only half-metre precision to work with even in just your positions, before applying any transformations. So, if your application requires you to have the whole Earth in one coordinate system and you need fine detail, doubles might be your best option. Try telling us more about what your game is trying to do and what a typical view looks like for other solutions useful to that case. – DMGregory Apr 24 '19 at 11:08
  • I'm not sure why you're seeing redundant matrix multiplies on the CPU as an issue here. There will be a comparatively small number of these required and it will hugely save on redundant multiplies on the GPU. – Maximus Minimus Apr 24 '19 at 12:33
  • let imagine your code like hubert farnsworth's planet express engine(camera always placed at 0.0.0 and your code moves and rotates scene around it) does there is no precision problems, because in this case all near objects has small positions? – Stranger in the Q Apr 25 '19 at 07:32
  • @StrangerintheQ The precision problems are not only about the camera but also about the coordinate of objects on the land. In WGS84 coordinate system, the global coordinates are like 5577808.933368 which is too big for float. I don't know will your method can fix this problem? – Sheldon Wang Apr 28 '19 at 02:01

0 Answers0