polysmooth(3G) polysmooth(3G)
polysmooth - specify antialiasing of polygons
void polysmooth(long mode)
mode Expects one of the symbolic constants:
PYSM_OFF: do not antialias polygons. (default)
PYSM_ON: compute coverage values for all perimeter polygon pixels
in such a way as to not change the size of the polygon.
PYSM_SHRINK: Compute coverage values for all perimeter polygon
pixels in such a way as to shrink the polygon slightly.
polysmooth specifies one-pass antialiasing of polygons. Unlike pntsmooth
and linesmooth, it is available only in RGB mode. Also, unlike pntsmooth
and linesmooth, its use in complex scenes requires attention to primitive
drawing order if acceptable results are to be achieved. Thus polysmooth
use is somewhat more complex than that of pntsmooth and linesmooth.
Like points and lines, polygons are antialiased by computing a coverage
value for each scan-converted pixel, and using this coverage value to
scale pixel alpha. Thus, for RGB antialiased polygons to draw correctly,
blendfunction must be set to merge new pixel color components with the
previous components using the incoming alpha. In the simplistic case of
adding a single, antialiased polygon to a previously rendered scene, the
same blendfunction as is typically used for point and line antialiasing
can be used:
blendfunction(BF_SA, BF_MSA).
Pixels in the interior of the polygon will have coverage assigned to 1.0,
and will therefore replace their framebuffer counterparts. Pixels on the
perimeter of the polygon are blended into the framebuffer in proportion
to their computed coverage.
A more typical case, however, is that of antialiasing the polygons that
comprise the surface of a solid object. Here the standard blendfunction
will result in 'leakage' of color between adjacent polygons. For
example, if the first polygon drawn covers a sample pixel 40%, and the
second (adjacent) polygon covers the pixel 60%, the net coverage of %100
still leaves %24 background color in the pixel.
If the solid object is to be correctly antialiased, with no leakage
through interior edges, and with proper silhouettes, the following rules
must be followed:
Page 1
polysmooth(3G) polysmooth(3G)
1. Polygons must be drawn in view order from nearest to farthest. (Not
farthest to nearest as is done with transparency.)
2. Polygons that face away from the viewer must not be drawn. (Use
backface(TRUE).)
3. The special blendfunction(BF_MIN_SA_MDA, BF_ONE) must be used to
blend polygons into the framebuffer.
4. Polysmooth mode PYSM_ON must be used.
The special polysmooth mode PYSM_SHRINK specifies a coverage algorithm
that includes only pixels that would have been scan-converted had the
mode been PYSM_OFF. (PYSM_ON includes pixels that are outside that range
of those point-sampled by the PYSM_OFF algorithm.) PYSM_SHRINK
necessarily leaks background color between adjacent polygons, but does
this in a way that resembles antialiased lines. Thus, PYSM_SHRINK can be
used in conjunction with blendfunction(BF_SA, BF_ZERO), and with no
sorting of polygons (use the z-buffer), to generate solid images
tesselated with black, antialiased lines.
linesmooth, pntsmooth, blendfunction, subpixel
IRIS-4D G, GT, and GTX models, as well as the Personal Iris, Iris Entry,
Indy, XL, XS, XS24, XZ, Elan, and Extreme systems do not support
polysmooth. Use getgdesc to determine whether polysmooth is supported.
subpixel mode should always be enabled while polysmooth is used.
On the IRIS-4D RealityEngine pixels that are outside of the perimeter of
the polygon may be drawn. However, their coverage values will be 0.0.
IRIS-4D VGX models reveal their decomposition of 4+ sided polygons into
triangles when PYSM_SHRINK is selected. This behavior is not intended,
and may not be duplicated by future VGX software releases, or by future
models.
PPPPaaaaggggeeee 2222 [ Back ]
|