Discussion:
Question about large worlds and foating point precision.
Juan Linietsky
2011-06-22 03:12:16 UTC
Permalink
Here's a doubt i've been having for a while. When developing games based on
large worlds (like Elder Scrolls, GTA, etc), i can imagine that physics and
rendering become more jittery the further away the camera moves from the
origin (due to floating point precision loss). Is this really a problem? If
so, how is this solved? I can imagine that increasing floating point
precision to doubles helps a enormously, but i'm not sure if that's enough
and if it's worth the extra processing/bandwidth cost.
Transforming the world to local coordinates (so the camera is always at
the origin) also seems to me like a solution, but sounds like a lot more
work and messy code.
So, how is this solved in most cases?

cheers!

Juan
Gregory Junker
2011-06-22 03:41:26 UTC
Permalink
It's most often solved by transforming the origin. Increasing precision is
*not* the answer; it simply delays the inevitable a little longer (while at
the same time halving your VPU throughput). Of course, at the last second,
you might be able to do intermediate host computations in increased
precision, but at the end of the day, your graphics hardware is rendering
with 32-bit floats (at most).



This is a well-known problem with well-understood solutions in practice.
That said, you can't just use (for example) the GPG4 solution in one system,
without your entire game engine using it. So "messy" is a relative term; if
you are developing a large-world game, chances are you are using a
large-world game engine. If not, you've probably licensed the wrong engine
for your game.



Floating-point precision issues are also well-defined (from a computer
science perspective), but often not really fully understood by most
programmers (myself included). The most commonly cited work is David
Goldberg's paper for ACM (1991). An edited version is here:



http://www.cse.msu.edu/~cse320/Documents/FloatingPoint.pdf



The original is here:



http://portal.acm.org/citation.cfm?id=103163


Greg



From: sweng-gamedev-***@lists.midnightryder.com
[mailto:sweng-gamedev-***@lists.midnightryder.com] On Behalf Of Juan
Linietsky
Sent: Tuesday, June 21, 2011 8:12 PM
To: sweng-***@midnightryder.com
Subject: [Sweng-Gamedev] Question about large worlds and foating point
precision.



Here's a doubt i've been having for a while. When developing games based on
large worlds (like Elder Scrolls, GTA, etc), i can imagine that physics and
rendering become more jittery the further away the camera moves from the
origin (due to floating point precision loss). Is this really a problem? If
so, how is this solved? I can imagine that increasing floating point
precision to doubles helps a enormously, but i'm not sure if that's enough
and if it's worth the extra processing/bandwidth cost.
Transforming the world to local coordinates (so the camera is always at
the origin) also seems to me like a solution, but sounds like a lot more
work and messy code.
So, how is this solved in most cases?

cheers!

Juan
Adrian Bentley
2011-06-22 04:31:50 UTC
Permalink
For Infamous (medium-small world 200k cm off origin?) we only had a few minor graphical problems far out. We ended up subtracting camera translation from our object matrices before submitting them to the gpu. There were only a few dozen places to edit and it took one guy a few days (including research).

There was one other feedback scenario where we manually split out the translation part M2 in M1 * Inv(M2) for precision, but that's it.

It was actually all pretty clean in the end.

Cheers,
Adrian
Here's a doubt i've been having for a while. When developing games based on large worlds (like Elder Scrolls, GTA, etc), i can imagine that physics and rendering become more jittery the further away the camera moves from the origin (due to floating point precision loss). Is this really a problem? If so, how is this solved? I can imagine that increasing floating point precision to doubles helps a enormously, but i'm not sure if that's enough and if it's worth the extra processing/bandwidth cost.
Transforming the world to local coordinates (so the camera is always at the origin) also seems to me like a solution, but sounds like a lot more work and messy code.
So, how is this solved in most cases?
cheers!
Juan
_______________________________________________
Sweng-Gamedev mailing list
http://lists.midnightryder.com/listinfo.cgi/sweng-gamedev-midnightryder.com
Gregory Junker
2011-06-22 04:37:31 UTC
Permalink
-----Original Message-----
Sent: Tuesday, June 21, 2011 9:32 PM
Subject: Re: [Sweng-Gamedev] Question about large worlds and foating
point precision.
For Infamous (medium-small world 200k cm off origin?) we only had a few
minor graphical problems far out. We ended up subtracting camera
translation from our object matrices before submitting them to the gpu.
There were only a few dozen places to edit and it took one guy a few
days (including research).
Were there physics/collisions involved at those distances?

Greg
Adrian Bentley
2011-06-23 01:38:42 UTC
Permalink
Yes. We didn't have any real issues, but we use our own physics engine atm.

Sent from my iPhone
Post by Gregory Junker
-----Original Message-----
Sent: Tuesday, June 21, 2011 9:32 PM
Subject: Re: [Sweng-Gamedev] Question about large worlds and foating
point precision.
For Infamous (medium-small world 200k cm off origin?) we only had a few
minor graphical problems far out. We ended up subtracting camera
translation from our object matrices before submitting them to the gpu.
There were only a few dozen places to edit and it took one guy a few
days (including research).
Were there physics/collisions involved at those distances?
Greg
_______________________________________________
Sweng-Gamedev mailing list
http://lists.midnightryder.com/listinfo.cgi/sweng-gamedev-midnightryder.com
J***@scee.net
2011-06-22 09:50:36 UTC
Permalink
Tom Forsyth wrote a post about this some years ago which might be worth
looking at:

http://home.comcast.net/~tom_forsyth/blog.wiki.html#
[[A%20matter%20of%20precision]]

James Levick
Sony Computer Entertainment Europe Limited
http://eu.playstation.com
22/06/2011 04:12
Please respond to
To
cc
Subject
[Sweng-Gamedev] Question about large worlds and foating point precision.
Here's a doubt i've been having for a while. When developing games
based on large worlds (like Elder Scrolls, GTA, etc), i can imagine
that physics and rendering become more jittery the further away the
camera moves from the origin (due to floating point precision loss).
Is this really a problem? If so, how is this solved? I can imagine
that increasing floating point precision to doubles helps a
enormously, but i'm not sure if that's enough and if it's worth the
extra processing/bandwidth cost.
Transforming the world to local coordinates (so the camera is
always at the origin) also seems to me like a solution, but sounds
like a lot more work and messy code.
So, how is this solved in most cases?
cheers!
Juan
_______________________________________________
Sweng-Gamedev mailing list
http://lists.midnightryder.com/listinfo.cgi/sweng-gamedev-midnightryder.com



**********************************************************************
This email and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed.
If you have received this email in error please notify ***@scee.net
This footnote also confirms that this email message has been checked for
all known viruses.
Sony Computer Entertainment Europe Limited
Registered Office: 10 Great Marlborough Street, London W1F 7LP, United
Kingdom
Registered in England: 3277793
**********************************************************************

P Please consider the environment before printing this e-mail
Loading...