Why not describe the world space in integers? Where 1 is the Planck length of the simulation? Is there a “lossy compression” benefit to describing space with floats?
Integers will improve your range somewhat, but not that much. If you set 2^16 to be a meter, then you still can't go past 65km. And as a downside now you have to be extra careful your derived numbers don't go out of range.
Emulating double precision on the GPU to render large worlds
61–66 of 66 posts
Re: Emulating double precision on the GPU to render large worlds
#62Earlier quoted context omitted.
Integer definitely seems like the right fit here. The precision is translationally invariant, which is the property you want for a Cartesian coordinate system.
Depends on what you want. If you're rendering a 3D world (with perspective projection) and use a coordinate system where the camera is always at the origin or close to it (floating origin), then floats give you more precision where it matters (objects close to the camera) and less precision where it doesn't (faraway objects).
Re: Emulating double precision on the GPU to render large worlds
#63Earlier quoted context omitted.
Minecraft works like this. The camera is the world origin when rendering.
Don't all games do this? The camera is by definition the world space origin, (0, 0, 0). Translating the camera right actually means translating the world left. What does Minecraft do different?
Re: Emulating double precision on the GPU to render large worlds
#64Earlier quoted context omitted.
Integers will improve your range somewhat, but not that much. If you set 2^16 to be a meter, then you still can't go past 65km. And as a downside now you have to be extra careful your derived numbers don't go out of range.
If you set the unit to 1mm you can reach like 20% of the way to Proxima Centauri with Sol as origin.
Also a granularity of 1mm will make slow movement complicated to calculate correctly. Consider updating at 60Hz and having an object that moves 1 inch per second.
Re: Emulating double precision on the GPU to render large worlds
#65Re: Emulating double precision on the GPU to render large worlds
#66Earlier quoted context omitted.
These compute units are usually sliced - they can perform either four FP32 multiples or one FP64 multiply on the same die part. This trick was done as long ago as PA-RISC was developed, from what I remember it was HP who introduced sliced ALU, capable of doing one large or several smaller operations on the same hardware. I can be wrong about who did that first, but most FPUs now are done like that.
On GPUs, they're not sliced like this anymore since quite a long time to save die area.