[x3d-public] ideal points in IndexedFaceSet

Michalis Kamburelis michalis.kambi at gmail.com
Mon Feb 19 17:40:17 PST 2018

2018-02-19 15:21 GMT+01:00 Andreas Plesch <andreasplesch at gmail.com>:
> Another option to consider is the infinite perspective projection:
> https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#infinite-perspective-projection
> AFAIK it favors precision at large distances at the expense of precision at
> zNear distances. Here is a discussion:
> https://github.com/mrdoob/three.js/issues/11755
> Infinite perspective could become a boolean field for Viewpoint:
> infinite='true'

View3dscene and Castle Game Engine are already using this projection
by default if you may have shadow volumes in the scene:) The loss of
depth precision was in practice never a problem.

There's a nice analysis of how this affects the depth precision in
http://www.nvidia.pl/object/robust_shadow_volumes.html , in the
"Practical and Robust Shadow Volumes (.pdf)" linked there (
http://www.nvidia.pl/attach/6831 ). Let me quote the relevant 2

It may be surprising, but positioning the far clip plane at infinity
typically reduces the depth buffer precision only marginally.
Consider how much we would need to shrink our window
coordinates so we can represent within the depth buffer an infinite
eye-space distance in front of the viewer. The projection P
transforms (0,0,-1,0) in eye-space (effectively, an infinite distance
in front of the viewer) to the window-space depth Far/(Far-Near).
The largest window coordinate representable in the depth buffer is
1 so we must scale Far/(Far-Near) by its reciprocal to “fit”
infinity in the depth buffer. This scale factor is (Far-Near)/Far
and is very close to 1 if Far is many times larger than Near which
is typical.

Said another way, using P inf instead of P only compresses the
depth buffer precision slightly in typical scenarios. For example,
if Near and Far are 1 and 100, then the depth buffer’s precision
must be squeezed by just 1% to represent an infinite distance in
front of the viewer.

(by Cass Everitt and Mark J. Kilgard, "Practical and Robust Stenciled
Shadow Volumes for Hardware-Accelerated Rendering", 2002 ).


More information about the x3d-public mailing list