Live data from Hacker News

Emulating double precision on the GPU to render large worlds

godotengine.org

61–66 of 66 posts

Re: Emulating double precision on the GPU to render large worlds

#61

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.

If you set the unit to 1mm you can reach like 20% of the way to Proxima Centauri with Sol as origin.

Re: Emulating double precision on the GPU to render large worlds

#62
post #56

Earlier 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).

As seen in their video (the fact that movement is choppy, but not the rendering. Indicates they are already doing that

Re: Emulating double precision on the GPU to render large worlds

#63
post #60
post #35

Earlier 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?

Camera is not be definition the world space origin.

Re: Emulating double precision on the GPU to render large worlds

#64
post #61

Earlier 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.

That's 64 bit. If you were using 64 bit floats you didn't have problems in the first place.

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

#66
post #58
post #41

Earlier 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.

The slicing was introduced to save die area. Not to slice is to have slightly smaller computation delay traded for greater die area.
Post reply on HN