AGI Components with Insight3D Alpha 2008 r8
View Frustum
Near and Far Planes

A view frustum is a truncated pyramid that determines what can be in view. Only objects within the frustum can appear on the screen. The viewer is at the tip of the pyramid. The pyramid extends out along the direction the viewer is looking as shown below.

The frustum starts at the near plane and ends at the far plane. These planes are parallel and their normals are along the direction the viewer is looking. The length of the frustum is determined by the distance from the viewer to the near plane and the distance from the viewer to the far plane as shown below.

These values can be set using the NearPlane and FarPlane camera properties as shown below.
CopyC#
scene.Camera.NearPlane = 10000;
scene.Camera.FarPlane = 10000000;

For best precision, it is usually recommended to place the near plane as far away from the viewer as possible.

Technical Details: This recommendation is due to the non-uniform precision of the depth buffer. See Learning to Love your Z-buffer.

Moving the near plane too far from the viewer can result in objects frequently getting clipped by the near plane as shown below.

Near Plane Distance: 1 meter

Near Plane Distance: 10,000 meters

Insight3D uses multiple view frustums to correct the precision problems of a close near plane but it can sometimes cost a performance hit. It is recommended to start with the default near plane distance of 1 meter and adjust it only if you need to.

Far to Near Plane Ratio

The camera's FarNearPlaneRatio property is used to compute the size and number of view frustums used for rendering. It is not recommended to modify this property unless you have a good reason. A low far-to-near ratio provides better depth buffer precision but may create more view frustums, which can adversely affect performance.

The view frustum closest to the viewer has a near plane distance defined by the NearPlane property. Its far plane distance is computed by multiplying its near plane distance by FarNearPlaneRatio. The next farthest view frustum has a near plane distance of the previous view frustum's far plane (ignoring a slight overlap). Its far plane distance is again computed using the far-to-near ratio. This process continues until the final view frustum has a far plane distance that satisfies the FarPlane property.

The following image (not to scale) shows an example where 3 view frustums are created based on the NearPlane, FarPlane, and FarNearPlaneRatio properties. Note that view frustums farther away from the viewer are larger.

Field Of View

Depending on the window's aspect ratio, the field of view is either the angle between the top and bottom view frustum planes, or the left and right planes. If the y dimension of the window is larger then the x dimension, then the field of view is the angle between the top and bottom planes, otherwise it is the angle between the left and right planes. Set the field of view using the camera's FieldOfView property.

CopyC#
scene.Camera.FieldOfView = Trig.DegreesToRadians(120);

Wider fields of view create bigger view frustums with more potentially visible objects and can look distorted.

35 degree field of view

120 degree field of view