The word frustum comes from the greek and translates literally to “Overly Frustrating”. Ok, that bit isn't true. But understanding it can be a touch confusing. Hopefully I can clear this up with a couple of illustrations.
Simple definition A frustum 1) is the width, height and depth that the camera can see. If an object sits outside of the frustum, it can no longer be seen. That's all it is.
Orx is a 2.5D engine meaning that you can use the Z axis much like in a 3D engine. This affects the “layering” of objects. Essentially: what object appears above or below another.
For example, you may have three alien objects at the following z-positions:
Having objects at various z-positions in the screen will mean you will need a frustum that is deep enough to enclose all those objects. In the case above, you need one that is 0.9 deep (-0.2 to 0.7).
Let's start by looking at a typical camera config:
[Camera] FrustumWidth = 800 FrustumHeight = 600 FrustumFar = 1.0 FrustumNear = 0.0 Position = (400, 300, -1.0)
The camera is placed at position 400, 300, -1.0 in the world.
In this case, the
FrustumFar is 1.0 and the
FrustumNear is 0.0. These two values are relative to the camera's z-position. That this means is, the camera can see near from it's z-position + the FrustumNear value, in this case: -1.0. And it can see into the distance, z-position + FrustumFar, which is 0.0.
Take a look at the following diagram to help visualise it:
The image above shows the frustum near and far values represented by the dotted lines. Only objects within it can be seen.
The thing to keep in mind is that a camera can move on all axis. The frustum moves with it at all times. This is why the
FrustumNear values are relative to the camera.
This also means that moving the camera up and down the z-axis can have the effect of making your objects appear and disappear. Just be aware of that effect.
General points to note:
FrustumNearcannot be strictly negative, as it cannot start behind the camera
FrustumFarneeds to be greater than
The width and height is a little easier to grasp. In the Camera example config above, the
FrustumHeight is 800 and 600 respectively.
This width and height is separate from the selected Display Width and Height, however, usually these are set the same.
Something to note is that the frustum is always in the center of the camera in the X and Y axis.
As per the depth, any object that appears outside the frustum boundaries, will not be visible.