
Graphics Hardware (2006) M. Olano, P. Slusallek (Editors) Minimum Triangle Separation for Correct Z-Buffer Occlusion Kurt Akeley and Jonathan Su Microsoft Research Asia Abstract We show that, and how, window coordinate precision (the representations of xwin and ywin), field of view, and error accumulated by single-precision mapping arithmetic contribute to, and sometimes dominate, effective z- buffer resolution. Our results are developed analytically, then verified through simulation. Using our approach system designers can allocate numeric precision more efficiently, and programmers can more confidently predict the minimum triangle-to-triangle separation required to ensure correct z-buffer occlusion. Categories and Subject Descriptors (according to ACM CCS): I.3.1 [Computer Graphics]: Graphics Processors 1. Introduction trary orientation to ensure correct occlusion (Smin). We first considered systems with ideal precision for all calculations, Because z-buffer values (zbu f ) are represented with finite precision, occlusion fails for triangles that are too close to- errors due only to finite-precision representations of xwin, gether, resulting in visual artifacts (punch-through). Fixed- ywin,andzbu f . We then considered the additional effects of point z-buffers using traditional projection arithmetic require finite precision projection, viewport, and rasterization arith- separation that increases as the square of the distance from metic, hereafter referred to as mapping. the viewer [Ake90]. For large ratios of distances to the far f and near eye-coordinate clipping planes (large n )andlow- 2. Window Coordinate Representations precision z representations (e.g., 16-bit fixed-point), the bu f Graphics processors typically represent xwin and ywin in result is extremely poor z-buffer resolution throughout much fixed-point, with four to twelve fractional bits (e.g., 10.8, of the eye-coordinate frustum. Graphics programmers have 10 integer and 8 fraction bits). Triangle vertexes are forced been instructed to move n as far from the viewer as possible, to fixed-point representation prior to rasterization, causing and to utilize atmospheric scattering effects (fog) to roll-off their positions to be perturbed. The plane containing a trian- visibility prior to a pulled-in f [Ake90]. gle changes, and rasterized zbu f values are affected. While More fundamental solutions include changing the pro- Smin could be analyzed in terms of the direct effects of xwin jection arithmetic (e.g., w-buffering) and using floating- and ywin precision on zbu f values, we find it instructive to point zbu f representations with the depth mapping reversed consider spatial and depth-related precision separately. We (zbu f = 1.0near,0.0far)[AF98, LJ99], which we and Lapi- ask not when zbu f values along a sample ray can intersect, dous et al. refer to as complementary z-buffering. Analyses but rather under what circumstances parallel triangles of ar- of these improved approaches have concentrated on error bitrary location and orientation can exchange their ordering. due to finite-precision z-buffer representation, ignoring er- To answer this, we form an uncertainty cuboid for each ror due to the finite resolutions of other values, especially precise 3-D location in window coordinates (Figure 1a). The of the spatial window coordinates xwin and ywin. As a result, depth of an uncertainty cuboid is the numeric distance be- these analyses approximate the required separation only for tween the representable zbu f values nearest its location. If fronto-parallel triangles. zbu f is fixed-point all uncertainty cuboids have the same We asked the more general question of the minimum depth. If zbu f is floating-point, the uncertainty depth is van- object-space separation required between triangles of arbi- ishingly small for uncertainty cuboids near zbu f = 0.0, and c The Eurographics Association 2006. Kurt Akeley & Jonathan Su / Minimum Triangle Separation for Correct Z-Buffer Occlusion z 3 fov 120 x 2.8 fov 90 fov 60 2.6 fov 30 y 2.4 z x 2.2 2 1.8 Window Eye coordinates Eye coordinates coordinates (center screen) (corner screen) 1.6 (a) (b) (c) fov separation factor (Kfov) 1.4 Figure 1: An uncertainty cuboid in (center screen) window 1.2 coordinates (a) reverse maps to a frustum in eye coordinates 1 −2 −1 0 1 2 (b). Reverse mapping a dimensionally equivalent cuboid lo- 10 10 10 10 10 Frusta depth/spatial aspect ratio cated at the upper-right corner of the screen yields a highly sheared frustum (c). Perspective is exaggerated. Figure 2: f ov separation factor (Kfov), which scales the re- quired triangle separation, relates the longest diagonal of a sheared eye-coordinate uncertainty frustum (Figure 1c) to the same diagonal of the unsheared, center-screen frustum = . equivalent to fixed-point for cuboids near zbu f 1 0. (In this (Figure 1b). This factor is a strong function of the aspect work we conservatively treat floating-point uncertainty as a ratio of the unsheared uncertainty volume, computed as the piecewise-continuous function, so that similar values have ratio of its depth to its x,y diagonal, and of the (side-to-side) similar uncertainty.) The widths and heights of all uncer- field of view angle (assuming a square viewport). tainty cuboids are the same, determined by b, the fractional precision of xwin and ywin. To evaluate S in eye coordinates, we invert the pro- min pairs are rasterized at multiple depths and orientations, the jection and viewport transformations and reverse map the model is confirmed if punch-through errors occur at separa- uncertainty cuboids. Under this mapping each cuboid be- tions up to but not exceeding the predicted S . comes a frustum, albeit one with nearly parallel sides due to min its small size. Parallel triangles may swap their order if and We ran the simulation for many combinations of parame- only if any of their uncertainty frusta overlap. Thus Smin for ters and visually confirmed correspondence with predicted a location in eye coordinates is the length of the longest di- behavior. Figure 3 illustrates our visualization approach. agonal of that location’s uncertainty frustum. And the worst- Four line plots indicate required separation for zbu f error case triangle orientation at that location is perpendicular to alone (as though the uncertainty frusta had no width or the longest diagonal. height), for xwin and ywin error alone (as though the frusta had no depth), for center-screen uncertainty frusta, and for Assuming (without limitation) a symmetric viewing frus- frusta projecting to screen corners. Punch-through errors, re- tum, center-screen uncertainty frusta are symmetric (Fig- sulting from the rasterization of many randomized triangles ure 1b), but frusta in screen corners are highly sheared (Fig- clustered at ten discrete z values, are plotted with points. ure 1c). Shear increases the length of the longest diagonal, eye These points cluster beneath, but tightly fitted to, the pre- so, for a given z value, S is greatest for extreme val- eye min dicted corner-screen separation plot. ues of xeye and yeye. We define the magnitude of this field of view ( fov) separation factor, Kfov, as the ratio of corner- The significance of both window-coordinate precision and screen to center-screen diagonal length for uncertainty frusta fov in determining required triangle separations is clearly on a given zeye plane. Kfov increases super-linearly as fovis demonstrated. For the traditional z-buffer modeled in Fig- increased, corresponding to the larger maximum shear. The ure 3 the 90-deg fov nearly doubled Smin in the far field shape of the uncertainty frusta also affects Kfov. Diagonals (where the uncertainty frusta become over-deep). Likewise, of shallow frusta are almost unaffected (left side of Figure 2). any analysis that ignored the effects of xwin and ywin repre- Kfov is maximized for slightly over-deep frusta, and remains sentation would substantially underestimate Smin in the near substantial as the depth/spatial ratio further increases. field. The observation by Lapidous et al. that applications have not fully utilized traditional z-buffer precision in the We confirmed our analysis with a simulation implemented near field [LJZW01], which was based on a depth-only anal- using double-precision arithmetic, forcing only x , y , win win ysis, is therefore explained: this precision was almost cer- and z to their nearest representable values. Triangle sepa- bu f tainly not available to be utilized. ration at the average of the zeye values was reported for each pixel punch-through error. When large numbers of triangle Assuming a square viewport, the separations in Figure 3 c The Eurographics Association 2006. Kurt Akeley & Jonathan Su / Minimum Triangle Separation for Correct Z-Buffer Occlusion −4 −4 10 10 Zbuf (0.24) Zbuf (float32) Xwin, Ywin (10.8) Xwin, Ywin (10.8) Combined (center) Combined (corner) −6 Combined (corner) −6 Simulated (corner) 10 Simulated (corner) 10 Simulated (worst−case) −8 −8 10 10 = wxeye + w = wxeye + w −10 xwin fix fov −10 xwin fix fov 10 2tan z 2 10 2tan z 2 2 eye 2 eye f fn n nf zbu f = fix − − zbu f = − − Required separation (eye coordinates) f n ( f −n)zeye Required separation (eye coordinates) n f (n− f )zeye −12 −12 10 10 −3 −2 −1 0 −3 −2 −1 0 10 10 10 10 10 10 10 10 Zeye Zeye Figure 3: Required triangle separation, log-log plotted as Figure 4: Required triangle separation, log-log plotted as afunctionofzeye, for a traditional z-buffer with f = 1, afunctionofzeye, for a complementary z-buffer with f = 1, n = 0.001,fov= 90, and a square viewport (w = h = 1024). n = 0.001,fov= 90, and a square viewport (w = h = 1024). Plots indicate the separations required for uncertainty due Plots indicate the separations required for uncertainty due to spatial representation (10.8 fixed-point), depth represen- to spatial representation (10.8 fixed-point, with mapping er- tation (0.24 fixed-point), and the combination of the spatial ror), depth representation (32-bit floating-point, with map- and depth uncertainties, at both the center and the corner of ping error), and the combination of the spatial and depth the screen.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages4 Page
-
File Size-