
EUROGRAPHICS 2020/ F. Banterle and A. Wilkie Short Paper First Order Signed Distance Fields Róbert Bán and Gábor Valasek Eötvös Loránd University, Hungary {bundas,valasek}@inf.elte.hu Abstract This paper investigates a first order generalization of signed distance fields. We show that we can improve accuracy and storage efficiency by incorporating the spatial derivatives of the signed distance function into the distance field samples. We show that a representation in power basis remains invariant under barycentric combination, as such, it is interpolated exactly by the GPU. Our construction is applicable in any geometric setting where point-surface distances can be queried. To emphasize the practical advantages of this approach, we apply our results to signed distance field generation from triangular meshes. We propose storage optimization approaches and offer a theoretical and empirical accuracy analysis of our proposed distance field type in relation to traditional, zero order distance fields. We show that the proposed representation may offer an order of magnitude improvement in storage while retaining the same precision as a higher resolution distance field. CCS Concepts • Computing methodologies ! Ray tracing; Volumetric models; 1. Introduction and previous work 2. Preliminaries Signed distance fields (SDF) are discretizations of continuous The approximation of a continuous function from samples has two signed distance functions. They store the signed distance to the main components: (i) the actual data to represent the samples and closest geometry at every sample. By applying a reconstruction fil- (ii) a reconstruction scheme that combines the samples to form a ter, i.e. by blending the sampled values, they convey global geo- globally defined approximation. metric information about the scene at every point in space. In case of traditional distance fields, such as in [Gre07], a uni- Distance fields mostly serve as auxiliary data structures in three- form grid stores the fi signed distances of the grid points to the dimensional real-time computer graphics to provide effects like scene geometries. Our main insight is that we can consider these soft shadows from area lights, ambient occlusion, or sky visibil- distance samples as zero order Taylor approximations to the global 3 ity [Wri15]. In addition, they can be also used as a primary ge- signed distance function f : E ! R. This allows us to general- ometric representation on current generation hardware, as shown ize the construction and to quantify the increase of accuracy due to in [Aal]. SDF representations proved to be especially efficient for storing higher order derivative data at sample points. font rendering [Gre07]. Advances were also made in decreasing Let a = (a1;:::;an) denote a multi-index where jaj = a1 +···+ storage requirements [FPRJ00] and increasing accuracy [KDB16]. a a1 an a a1 an an, x = x1 · ::: · xn , ¶ f = ¶1 :::¶n f , a! = a1! · ::: · an!. The Our paper shows that both of the above improvements can be degree k multivariate Taylor polynomial about x0 is achieved by treating the reconstruction of a continuous signed dis- a ¶ f (x0) a tance function from samples as an approximation problem. In Sec- Tk;x (x) = (x − x0) ; (1) 0 ∑ a! tion 2, we use Taylor’s approximation theorem to justify the incor- ja|≤k poration of higher order derivatives of the signed distance function that is, indeed T0;x0 = f (x0). In general, the approximation proper- in the distance field samples. The order of the highest derivative ties of Tk;x0 (x) are characterized by is referred to as the order of the distance field in this paper. Sec- n k+1 Theorem 1 (Taylor’s theorem). Let f : R ! R such that f 2 C tion 3 discusses how such representations can be filtered. Section 4 n on an S ⊂ R convex set. Then 8x0 2 S : 8x 2 S : provides a practical construction algorithm for first order distance ¶a f (x˜) fields. In Section 5, we show that these are simultaneously more f (x) = T (x) + (x − x )a k;x0 ∑ a! 0 accurate and, as a result, more efficient in terms of storage than the jaj=k+1 classic, zero order uniform distance fields. Examples are presented where x˜ = (1 − c) · x + c · x for some c 2 (0;1). that this storage gain can be over an order of magnitude, at the ex- 0 pense of an up to 10% performance hit in direct visualization. If all derivatives are bounded by some constant M > 0, then c 2020 The Author(s) Eurographics Proceedings c 2020 The Eurographics Association. DOI: 10.2312/egs.20201011 https://www.eg.org https://diglib.eg.org 34 R. Bán, G. Valasek / First Order Signed Distance Fields f (x)−T (x) ≤ M jjx −x jjk+1 k;x0 (k+1)! 0 1 . Therefore, a single distance As such, merely taking the signed distance function of the closest sample has an approximation order of 1 at regular regions, i.e. out- triangle does not suffice, since it may convey locally too limited side the medial axes of the represented geometries. Note that this information about the SDF in relation to the grid size. approximation order is an actual bound on the maximum error, not Instead, we propose to use a finer grid about xi, denoted by si j = just a polynomial precision property. T 3 xi + [i · Da; j · Db;k · Dc] , j = (i; j;k) 2 {−H;:::;Hg . Once we 3 obtain an f (si j ) j 2 {−H;:::;Hg set of distance samples, we 3. Approximation with first degree polynomials fit a plane to them in the distance space as 2 3 2 3 2 3 In 3D, we can increase the local approximation order to 2 at ev- 1 x1 y1 z1 a f1 ery sample x by storing the T (x) = f (x ) + ¶ f (x ) · (x − x ) + 6 1 x2 y2 z2 7 6 b 7 6 f2 7 i 1;xi i x i i 6 . 7·6 7 ≈ 6 . 7 (3) ¶y f (xi) · (y − yi) + ¶z f (xi) · (z − zi) first degree Taylor polynomial 4 . 5 4 c 5 4 . 5 approximation of the signed distance function. 1 xN yN zN d fN | {z } | {z } | {z } However, there are multiple bases to represent a polynomial such X a f as (1). By stipulating that evaluation in the base should be invari- where we have flattened the three dimensional arrays si j and f j into ant under trilinear filtering, we show that the global power basis [x1;y1;z1];[x2;y2;z2];::: and [ f1; f2;:::], respectively. The extent is an adequate choice. Indeed, invariance under linear interpolation of the fine grid can be considered as a level-of-detail control. means that the order of evaluation and interpolation can be inter- a X + f X + changed. It trivially holds for the power basis: The least-squares solution to (3) is a = X · f , where X de- notes the Moore-Penrose pseudo-inverse of X . If the column vec- + (1 −t) · T1;xi (x) +t · T1;x j (x) = tors of X are linearly independent, it can be expressed as X = T −1 T (1 −t) · aix + biy + ciz + di +t · a j x + b j y + c j z + d j = (X · X ) · X . In addition, one could also incorporate weight- (1 −t)ai +ta j x + (1 −t)bi +tb j y+ ing into the fitting process to reduce the significance of far-away (1 −t)ci +tc j z + (1 −t)di +td j samples. Note that the samples need not be taken on a regular grid. + Invariance under bi- and trilinear interpolation follows immediately If the same fine grid structure is used for every si j , X only from the above. The ai;bi;ci;di coefficients are computed from the needs to be pre-computed in the origin centered configuration, de- + + signed distance function as noted by X o . Using X o at xi instead of the local matrices simply translates the world origin to xi in Equation (3). To obtain the global f (x ) + ¶x f (x ) · (x − x ) + ¶y f (x ) · (y − y ) + ¶z f (x ) · (z − z ) = i i i i i i i world space coefficients of the Taylor polynomials we merely have to factor a · (x − xi) + b · (y − yi) + c · (z − zi) + d in terms of the ¶x f (xi)·x + ¶y f (xi)·y + ¶z f (xi)·z + (2) | {z } | {z } | {z } global power basis as a · x + b · y + c · z + d − a · xi − b · yi − c · zi . ai b ci i Algorithm1 and Figure1 summarize the above construction. 3 + f (xi) − ¶x f (xi) · xi − ¶y f (xi) · yi − ¶z f (xi) · zi In : Input geometry; o 2 E origin; N;M;K 2 N | {z } resolution; Dx;Dy;Dz > 0 grid sizes; so j origin di centered fine grid with Da;Db;Dc > 0 sizes, j 2 {−H;:::;Hg3 H 2 + X + Note that the above construction can approximate arbitrary func- ; N ; o pseudoinverse a ;b ;c ;d i 2 [ ;N] × [ ;M] × [ ;K] tions, it is not restricted to signed distance functions. For our partic- Out: i i i i , 1 1 1 linear DF for all i 2 [1;N] × [1;M] × [1;K] do ular use case, the ai;bi;ci coefficients of the linear Taylor approx- T imation coincide with the partial derivatives of the signed distance 1. Compute sample location xi o + [i · Dx; j · Dy;k · Dz] 2. Sample distance function on translated fine grid function, i.e. they form a unit vector and only posses two scalar 3 degrees of freedom. f j f si j = f xi + so j , j 2 {−H;:::;Hg T 3.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages4 Page
-
File Size-