creXALBO
creXALBO

Reputation: 317

Using a "spherical frustum" for 3D projection

I am currently writing a transformation from model space to clip space for use in OpenGL. From what i have seen, programmers typically use a traditional rectangular frustum to define the clipping boundaries in their model space. I personally had in mind a shape like a frustum, except the near and far planes are spheres centered at the apex of the frustum (the camera). So something that looks like this:

Circular sector

The yellow region corresponds to OpenGL's clip space, and the two spheres (depicted as circles in this cross-section image) correspond to OpenGL's z=-1 (inner sphere) and z=1 (outer sphere).

Is this a more realistic way to model the projection, or should i stick with the traditional rectangular frustum when designing my projection matrix?

Upvotes: 7

Views: 2049

Answers (2)

Glib
Glib

Reputation: 304

The region defined in this way seems to be more logical than usual frustum for the next reason: in the wide-angle projection (let's say 90-120 degrees) the objects those are close to far plane may disappear and suddenly reappear after just rotating the camera. This happens if the distance (euclidean) from the eye to the object is between the distances from the eye to the center of flat frustum's far plane and it's corner.

Spherical sector should remove this problem. However a new one appears: after projection on the screen surface flat polygons may become warped because of changes in depth calculations. Although I am not sure how exactly that will look like.

Upvotes: 0

user3125280
user3125280

Reputation: 2829

No. I'm not sure what you mean to be completely honest, but in either case no.

  • Do you mean that the view coordinates (view frustum usually) should be bounded by spheres?

Well in many (all?, most?) large polygons that intersect the clip plane are actually broken in to smaller triangles that don't - otherwise a single big polygon that had one vertex outside would simply be ignored. This is what clipping actually involves.

Remember when you played old games and walked into objects, only to have them disappear if you got too close? Wouldn't it suck if when the corner of a polygon was just outside the view the hole thing vanished? see this for clarification.

  • On the other hand you may have meant the view space should be projected onto a sphere instead of a flat plane.

Well a screen is flat, so the objects in a 3d scene are projected onto a flat surface, equivalent to tracing a ray of light from an object towards the camera and finding where it would intersect your monitor. The weird "unrealistic" 3d look is a result of the viewer's eyes being a) not a point camera and b) rarely if ever at the correct distance for the field of view.

Upvotes: 1

Related Questions