## Re: [Algorithms] Huge world, little precision

 Re: [Algorithms] Huge world, little precision From: Pal-Kristian Engstad - 2007-03-01 19:04:47 ```George van Venrooij wrote: > It seems a scheme like that is unavoidable. Unfortunately it adds all kinds > of complications to the system. Since each "chunk" has its own > transformation, vertices on chunk edges need to be duplicated and it is not > unimaginable that the "seams" will need some "stitches" to fix additional > cracks due to inaccuracies during this transformation step. > All that is required is a little care. You just need to define what is the smallest unit. Say you define it to be S = 1/1024 meters (which is less than a millimeter). Then you just make sure that all of your vertex data is rounded to the closest unit. Notice, that this arrangement means that all your positions are on a uniform 3D grid. When you chop up your world, you also make sure that the relative coordinates are on the same grid, and that the transform matrix has no rotation. In other words - all of your data for position are essentially integer numbers. By using this setup, it is very unlikely that you'll ever have cracks. Using 64 bits, your world grid size in one direction is 2^64 * S = 2^64 * 2^(-10) meters = 2^54 meters = 18 * 10^15 meters or approximately 1.9 light-years (9.461 Pm) or 0.58 parsec. Local coordinates may not need that many bits. For instance, 32 bits with S = 1/1024 corresponds to a range of 2^32 * S = 2^32 * 2^(-10) meters = 2^20 meters = 1,048,576 meters = 1,048 km. Earth's mean radius is 6,371 km I believe, so that'll give you fairly large chunks. Thanks, PKE. -- Pål-Kristian Engstad (engstad@...), Lead Programmer, ICE team, Naughty Dog, Inc., 1601 Cloverfield Blvd, 6000 North, Santa Monica, CA 90404, USA. Ph.: (310) 633-9112. "Most of us would do well to remember that there is a reason Carmack is Carmack, and we are not Carmack.", Jonathan Blow, 2/1/2006, GD Algo Mailing List ```