Juan Linietsky | 22 Jun 2011 05:12
Picon

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
Sweng-Gamedev <at> lists.midnightryder.com
http://lists.midnightryder.com/listinfo.cgi/sweng-gamedev-midnightryder.com
Gregory Junker | 22 Jun 2011 05:41
Favicon

Re: Question about large worlds and foating point precision.

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-bounces <at> lists.midnightryder.com [mailto:sweng-gamedev-bounces <at> lists.midnightryder.com] On Behalf Of Juan Linietsky
Sent: Tuesday, June 21, 2011 8:12 PM
To: sweng-gamedev <at> 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

_______________________________________________
Sweng-Gamedev mailing list
Sweng-Gamedev <at> lists.midnightryder.com
http://lists.midnightryder.com/listinfo.cgi/sweng-gamedev-midnightryder.com
Adrian Bentley | 22 Jun 2011 06:31
Picon

Re: 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). 

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

On Jun 21, 2011, at 8:12 PM, Juan Linietsky <reduzio <at> gmail.com> wrote:

> 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
> Sweng-Gamedev <at> lists.midnightryder.com
> http://lists.midnightryder.com/listinfo.cgi/sweng-gamedev-midnightryder.com
_______________________________________________
Sweng-Gamedev mailing list
Sweng-Gamedev <at> lists.midnightryder.com
http://lists.midnightryder.com/listinfo.cgi/sweng-gamedev-midnightryder.com

Gregory Junker | 22 Jun 2011 06:37
Favicon

Re: Question about large worlds and foating point precision.


> -----Original Message-----
> From: sweng-gamedev-bounces <at> lists.midnightryder.com [mailto:sweng-
> gamedev-bounces <at> lists.midnightryder.com] On Behalf Of Adrian Bentley
> Sent: Tuesday, June 21, 2011 9:32 PM
> To: sweng-gamedev <at> midnightryder.com
> 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
Sweng-Gamedev <at> lists.midnightryder.com
http://lists.midnightryder.com/listinfo.cgi/sweng-gamedev-midnightryder.com

Adrian Bentley | 23 Jun 2011 03:38
Picon

Re: Question about large worlds and foating point precision.

Yes. We didn't have any real issues, but we use our own physics engine atm.

Sent from my iPhone

On Jun 21, 2011, at 9:37 PM, "Gregory Junker" <gjunker <at> dayark.com> wrote:

> 
> 
>> -----Original Message-----
>> From: sweng-gamedev-bounces <at> lists.midnightryder.com [mailto:sweng-
>> gamedev-bounces <at> lists.midnightryder.com] On Behalf Of Adrian Bentley
>> Sent: Tuesday, June 21, 2011 9:32 PM
>> To: sweng-gamedev <at> midnightryder.com
>> 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
> Sweng-Gamedev <at> lists.midnightryder.com
> http://lists.midnightryder.com/listinfo.cgi/sweng-gamedev-midnightryder.com
_______________________________________________
Sweng-Gamedev mailing list
Sweng-Gamedev <at> lists.midnightryder.com
http://lists.midnightryder.com/listinfo.cgi/sweng-gamedev-midnightryder.com

James_Levick | 22 Jun 2011 11:50

Re: Question about large worlds and foating point precision.

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

sweng-gamedev-bounces <at> lists.midnightryder.com wrote on 22/06/2011 04:12:16:

> Juan Linietsky <reduzio <at> gmail.com>
> Sent by: sweng-gamedev-bounces <at> lists.midnightryder.com
>
> 22/06/2011 04:12
>
> Please respond to
> sweng-gamedev <at> midnightryder.com
>
> To
>
> sweng-gamedev <at> midnightryder.com
>
> 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
> Sweng-Gamedev <at> lists.midnightryder.com
> 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 postmaster <at> 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
_______________________________________________
Sweng-Gamedev mailing list
Sweng-Gamedev <at> lists.midnightryder.com
http://lists.midnightryder.com/listinfo.cgi/sweng-gamedev-midnightryder.com

Gmane