Clipping Planes


Clipping Planes

We mentioned in the previous section that Partiview draws data inside a pyramid and the location of the triangular sides of that pyramid (your peripheral vision) are determined by the field of view. In this section we will discuss the apex and the base of the pyramid. These are called clipping planes in computer graphics and are set using the clip command.

When we said the view is specified by a pyramid, we were telling a slight white lie. In reality, the tip of the pyramid has been removed, leaving the pyramid with a flat top. This flat plane, parallel to your screen, is called the near clipping plane, while the base of the pyramid is called the far clipping plane.

The clip command takes the floating point arguments nearplane and farplane. The nearplane argument is the distance from your screen to the near clipping plane, the top plane of the pyramid. Nothing will be drawn between your screen and this near clipping plane, so you will want this to be a small value. farplane is the distance from your screen to the base of the pyramid. Beyond this plane, nothing is drawn. You want this value to be large enough to include your data. The units of these arguments are in the units of your data set. For example, if we're looking at stars, the units might be in parsecs (1 parsec = 3.26 light-years).

Experimenting with the clipping planes

To experiment with setting the clipping planes, let's start the Sample Data. If we assume the units of these data are in meters, then typing
clip
will report the current values of 0.1 meters and 100,000 meters for the near and far clipping planes, respectively. This means the height of our pyramid is 100,000 meters minus 0.1 meters. These values are set in the sample.cf file and are reasonable values based on the scale of these data. However, let's change these values and see the effects.

Watch the data as you change the near clipping plane to 10 meters by typing:

clip 10
(Notice that we did not specify the farplane argument. Partiview assumes the current value if the argument is not specified.)

Upon typing this command, the Point of Interest and a few nearby points disappear. They are within 10 meters from your vantage point.

Now fly forward or backward from your current location using the right mouse button. Notice how data appear if you're flying backward, or disappear if you're flying forward. If you increase the near clip to some large value, you would expect more and more data to disappear as the near clipping plane approaches the far clipping plane.

Now perform a similar exercise for the far clipping plane. Let's change the clipping planes back to the original values of 0.1 and 100000 so that we recall the original view, then change the far clip plane to 100 using these commands:

clip .1 100000
clip .1 100
A significant number of data points have disappeared since we have brought the far clipping plane closer to us. Here, our pyramid is very flat, with a height of only 100 meters.

Note, we can also change the far plane without having to know the near plane. If you substitute a non-numeric character for the nearplane argument, it will remain the same. For example, change the far clipping plane to 10000 using this command:

clip - 10000
This leaves the near clipping plane at 0.1 meters and changes the far clipping plane to 10,000 meters.

Clipping and your computer

OpenGL output behaves differently for different graphics cards and operating systems. Without being experts on this subject, there are a few issues that have been noted with Partiview. One is that on some computers, any near clipping value under 1 produces unpredictable results. If data or polygons aren't being drawn as you expect, try setting the near clip to 1. Also, if the ratio of farplane to nearplane exceeds 10000, this may produce unwanted effects, such as the blinking of distant particles.

© 2002-2005 American Museum of Natural History
Last Modified: 2006-04-28 by Brian Abbott