Coordinate Systems for the Sphere Rasterizer
Kenny Hoff
6/17/97
Given the center and radius of a sphere in world coordinates, we have three
distinct stages in rasterizing the sphere that involve different coordinate
systems:
-
Find visible pixels in screen space: this must obviously be done
is screen or pixel coordinates. So we require the center and the radius
in pixel coordinates. The center is easy to compute since we can simply
do a complete tranformation of the center "vertex"; the resulting value
will be a pixel location and an associated depth. The radius is significantly
more complex and will require several stages to compute.
-
First compute radius in NDC space (described later)
-
Perform NDC-to-Viewport scaling to obtain radius in pixels
-
Evaluating depth-values for visible pixels in NDC: the paraboloid
approximation to depth must be performed in NDC space where the Z-values
are first computed. This is the space after the perspective divide, but
before any range-fitting of the Z-values; so Z is in [-1,1] like x and
y. We must find the center and radius in NDC space:
-
Perform composite transformation and divide through by w to obtain center
-
Compute radius scale factor using one of the previously described techniques.
-
Compute radius as WorldRadius * RadiusScaleFactor
-
Calculating 2D and 3D texture coordinates in world space