Putting it All Together: Method 2
using only Screen Space
Kenny Hoff
6/17/97
We have problems that we would like to simplify or remove entirely
from the previously techniques:
-
Necessity to convert between so many different coordinate systems through
the NDC system
-
The separate calculation stages for determining points inside the projected
sphere's circle and for evaluating the depth with the paraboloid approximation.
To avoid the expensive conversions from screen space to NDC space for computing
depth values, we can instead do the entire paraboloid fit in screen space
with (x,y,z) values being (x,y) pixel coordinates and z being the actual
fixed-point Z-values (already scaled, etc). At the same time, we would
like to combine the depth-evaluation with the scan-conversion by simply
performing the depth-evaluation and discarding pixels that are "too deep"
(beyond the sphere's center screen Z).
-
Like before, we need to transform the center and a point on the boundary
into eye space so that we can compute an eye space radius as the distance
between these transformed points.
-
We still need a silhouette point on the boundary relative to the viewer.
The viewer is assumed to be at the origin and a point EyeRadius distance
from the center along the direction perpendicular to the viewing direction
(-Z) is selected as the silhouette sample point (actually it should be
perpendicular to the direction from the eye to the sphere's boundary -
trickier, more expensive, and probably unnecessary). SilhouettePt =
EyeCenter + (0,1,0)*EyeRadius
-
We also need a point on the sphere in eye space that is closest to the
viewer (the origin in eye space). We should pick the point on the sphere
the farthest in the direction opposite of the direction from the eye to
the sphere's center; we will also approximate this with a point EyeRadius
distance from the center in the direction opposite of the viewing direction
(+Z). ClosestPt = EyeCenter + (0,0,1)*EyeRadius
-
The three eye-space points EyeCenter, SilhouettePt, and ClosestPt must
all be transformed into screen space.
-
Pixel radius is computed as the 2D euclidean distance between EyeCenter
and SilhouettePt pixel coordinates.
-
The Z-values of the EyeCenter and the ClosestPt in screen space is used
to know the range of Z-values to fit with the paraboloid approximation.
So in the XY-plane, we are fitting the pixel coordinates, but in Z we are
fitting the actual Z-values.
-
We can perform the scan-conversion in-out test using the paraboloid approximation.
Since we are only approximating the front hemisphere we can assume that
the sphere's center Z-value is the maximum Z for the sphere and the closest
point's Z-value is the minimum. This means that boundary pixels will contain
the largest Z-values; in fact, if the depth value of a pixel exceeds the
max Z-value as determined by the center, it cannot be inside the circular
projection.
-
Using on the depth-evaluation, pixels are disabled if the computed Z is
greater than the max Z (outside circle) or if it is greater than the depth
already in the Zbuffer.