Not logged in, Join Here! or Log In Below:

Home / Game Design & Programming / Techniques used for large 3D environments and limited precision coordinates  Account Manager 

I'd like to know what techniques people use to deal with limited precision problems. For example, if you have a virtual space that is hundreds of kilometers in size, movement and interaction in the environment can get a little shakey because of limited coordinate precision. 

Basically, what you want to do is always use your current viewing position as the origin. Everything else is rendered relative to this, so the closer you get to an object, the more accuracy the object gets. Its explained in detail in the paper from the link below. Check out article 3. 

Thanks, that is the sort of thing I was looking for. 

No problem, its not really common in the game world for this problem (unless you're doing a space shooter). Its more of a GIS issue. Let me know if you have any more questions on it, latas. 



I can't recall per say, but i'll enlighten you on the method I typically use for maintaining object accuracy while still being able to use vertex buffers. I think they are similar, if not the same. I don't have sample code to show this, but i'll explain my theory a little. 

Yes that helps, thanks. So you do this translation, perform your rendering each time your render each visible object  is that, like N frames per second where N could be in the 100s? 

storing 16bit coordinates (or even 8bit in some cases) and doing the tnl in full 32bit is quite common in ie mobile 3dstuff where you have to save memory on the vertexdata. just normalize your meshes to the precision you're using (so that every mesh span over the entire range in x, y and z), and compensate in the matrix. ofcourse, store translation etc in full precision. 

"tnl"  translation? 

just scale the mesh to fit in 16bit integer coordinates while preserving as much precision as possible, yes. i guess you could try to do something fancy, like float packing in some way (like, storing a common exponent for x, y and z, and using 8/16bit mantissas or something), but i doubt it'll be effective enough sizewise to justify the extra vertexprocessing. I might be wrong here, though. 

Just a note on that: scaling does not actually solve the problem I was speaking of. As Oneil pointed out, scaling down loses accuracy at the finer detail. The intent behind moving things close to the origin, in a floating point coordinate system, is to gain the high fidelity that is available from fp in the vicinity of the origin. 

uhm, i'm not sure if you understood what i meant ;) 

If I have a 2m avatar and want 1mm accuracy from (0,0,0) to radius of the earth then single precision floating point gives me accuracy to 1mm up to about 2km from the origin. at the radius of the earth it is about 0.7m. But I need 1mm everywhere. This is the problem this thread is about and although I know how to deal with it mathematically I wanted to know how others deal with it in games. 

Why not add an additional integer vector to all your floating point coordinates, then slice the space into cubes, similiar to an octtree? 

so, you're looking for LODschemes? then say that ;) 

Yes, the translation is done every frame, and N can get that high. 



Don't know about games, but I use it in 3D GIS applications (which is similar to games). Most of the time, we are focused on accuracy, so some of the other game tweaks we might not be useful. I use both methods whenever possible. In the case I don't do any spatial subdivision, I use the first method I told you. In the case where I have spatial subdivision, I use the latter version whenever possible. The concept in both are the same though. 

In flight sims we have to deal with this all the time. Some of the suggestions here are righton. 

>>> 

Using a scene graph 



Arne Rosenfeldt wrote:
Using a scene graph
nearby objects have coordinates relative to the same node as the viewer
=> high precision Only true if the viewpoint is close to origin (or you perform the subtraction we are talking about first), and and I think only for floating point coordinates. Also, your scenegraph would have to be constructed with this in mind, e.g. bintree or quadtree fashion. I dothis all the time with terrains. However, using a scenegraph does not automatically give you this local coordinate system  two nodes adjacent in the scenegraph could have parent transforms that place them kilometers apart (but I agree you would not normally do this). Therefore, the problem is independent of whether you are using a scenegraph. 

Erik FayeLund wrote:
so, you're looking for LODschemes? then say that ;) Because this is nothing to do with LOD  it is entirely to do with positional accuracy: the gap between one representable coordinate and the next. With single precision floats for coords (most common on modern commodity hardware) this gap increases with coordinate size because the precision stays the same (24 bit). ... the 1mm accuracy stuff is still possible with scaling the meshes, you just need to split the world into a set of meshes that makes sense. make 1mm become one unit in your coordinate system, and subdivide your scene into meshe until you have all polygons within the range you need. also remember that the precision of floatingpoint depends on the size of the number. so, small values have high precision, while big numbers have lower precision.[/i] yep  I understand u can break it all up into a set of local reference frames. I'm just trying to find out if this is what most people are doing. 

Lennox wrote:
Don't know about games, but I use it in 3D GIS applications (which is similar to games). Most of the time, we are focused on accuracy, so some of the other game tweaks we might not be useful. I use both methods whenever possible. In the case I don't do any spatial subdivision, I use the first method I told you. In the case where I have spatial subdivision, I use the latter version whenever possible. The concept in both are the same though. Ah that is interesting. Can you please email me on dragonmagi at gmail.com? I'd like to get a concrete reference relating to GIS for my phd survey. I have some already  mainly from the SRI research and work on terravision and geovrml. 

Sorry, I have not used anything. 
