Ray-Tracing Procedural Displacement Shaders

Ray-Tracing Procedural Displacement Shaders

Ray-tracing Procedural Displacement Shaders Wolfgang Heidrich and Hans-Peter Seidel Computer Graphics Group University of Erlangen fheidrich,[email protected] Abstract displacement shaders are resolution independent and Displacement maps and procedural displacement storage efficient. shaders are a widely used approach of specifying geo- metric detail and increasing the visual complexity of a scene. While it is relatively straightforward to handle displacement shaders in pipeline based rendering systems such as the Reyes-architecture, it is much harder to efficiently integrate displacement-mapped surfaces in ray-tracers. Many commercial ray-tracers tessellate the surface into a multitude of small trian- Figure 1: A simple displacement shader showing a gles. This introduces a series of problems such as wave function with exponential decay. The underly- excessive memory consumption and possibly unde- ing geometry used for this image is a planar polygon. tected surface detail. In this paper we describe a novel way of ray-tracing Unfortunately, because displacement shaders mod- procedural displacement shaders directly, that is, ify the geometry, their use in many rendering systems without introducing intermediate geometry. Affine is limited. Since ray-tracers cannot handle proce- arithmetic is used to compute bounding boxes for dural displacements directly, many commercial ray- the shader over any range in the parameter domain. tracing systems, such as Alias [1], tessellate geomet- The method is comparable to the direct ray-tracing ric objects with displacement shaders into a mul- of B´ezier surfaces and implicit surfaces using B´ezier titude of small triangles. Unlike in pipeline-based clipping and interval methods, respectively. renderers, such as the Reyes-architecture [17], these Keywords: ray-tracing, displacement-mapping, pro- triangles have to be kept around, and cannot be ren- cedural shaders, affine arithmetic dered independently. This approach, however, defeats two of the reasons 1 Motivation for using procedural displacements in the first place: Procedural displacement shaders [7] are an impor- resolution independence and storage efficiency. The tant means of specifying geometric detail and surface storage requirements for representing a large number imperfections in synthetic scenes, which increases the of polygons (often hundreds of thousands or more), realism of computer generated images. Small surface as well as the spatial subdivision hierarchy required features, which would be tedious to model explic- for speeding up the intersection tests (often octrees) itly using a geometric modeling system, can often can be excessive, even for relatively simple shaders. be described by a few lines of code in a dedicated But tessellation-based methods also bear other, shading language, such as the RenderMan Shading more fundamental problems. Because the shader can Language [20, 10, 24]. only be evaluated at a discrete set of points, the ver- In contrast to simple surface shaders and bump tices of the output polygons, it is possible to miss maps [4], displacement shaders actually change the narrow features. This is particularly disturbing if geometry of the underlying surface. This allows for the displacements of those features are large. Most effects like self-occlusion and self-shadowing, and re- existing systems either disallow long and skinny dis- sults in more realistically looking images, in partic- placements, or require the user to explicitly specify ular in silhouette regions (see Figure 1). Procedural bounding volumes for them. As a final problem, numerical errors may oc- surface potentially passes through the cell, and the cur in intersection tests with many small polygons. cell is subdivided in an octree fashion, unless it is al- These can result in cracks between adjacent poly- ready small enough. Unlike Lipschitz bounds, inter- gons, which are difficult to avoid in implementations. val bounds can be automatically computed by spe- Given the potential benefits of displacement cific implementations of the basic library functions. shaders, and the shortcomings of tessellation-based Comba and Stolfi [5] and Figueiredo and Stolfi [9] implementations, the question is whether there is a used a similar algorithm, but replaced interval arith- way to directly ray-trace procedural displacements. metic with affine arithmetic, which they developed Such an algorithm should work directly on the proce- for this purpose. They showed that affine arithmetic dural description, without generating any intermedi- produces significantly tighter bounds than interval ate geometry. This would prevent cracking and pre- arithmetic, although at a higher cost. serve resolution independence. The method should In [12], we used affine arithmetic to obtain con- also guarantee intersections, in the sense that if an servative bounds for the value of procedural surface intersection exists, it will be found, no matter how shaders over a given parameter interval. This can fine the feature is. Since intersections with procedu- be used to drive a hierarchical sampling process, for ral displacements cannot be determined analytically, example in hierarchical radiosity. the algorithm should use a numerical method to iter- In this paper we extend the above ideas to ray- atively compute the closest intersection along a ray. tracing displacement shaders. We use affine arith- metic to hierarchically enumerate the geometry gen- 2 Prior Work erated by procedural shaders. In Section 3 we de- Several related algorithms for finding intersections scribe the basic algorithm. In Section 4 we then with a variety of different geometric objects have briefly review affine arithmetic, and discuss the is- been published. Nishita et al. [16] developed B´ezier sues involved when applying it to procedural shaders. clipping to compute ray intersections with (ratio- Sections 5 and 6 contain refinements of the basic al- nal) B´ezier patches. The algorithm first determines gorithm. Finally, in Section 7, we present experi- parameter regions that cannot contain intersection mental results obtained with our method. points. The surface is the re-parameterized over the remaining parameter range. This process is recur- sively repeated until the intersection point has been 3 Direct Ray-tracing of Displacement determined with a given precision. Shaders Barr [2, 3] computed ray intersections with de- Our iterative method for intersection tests with dis- formed objects by solving an initial value problem. placement shaders is based on the idea of hierarchi- This method works for both parametric and implicit cally subdividing the parameter domain of the sur- surfaces, but only for relatively simple global defor- face. Parameter regions, in which intersections might mations such as twists. It does not directly translate occur, are identified, and those regions in which in- to complex procedural deformations. tersections are not possible are discarded. Parameter Later, Kalra and Barr [13] developed a method ranges containing potential intersections are recur- for finding guaranteed intersections with implicit sur- sively refined, until the intersection has been deter- faces. Lipschitz bounds (global bounds on the deriva- mined within a pre-defined accuracy. The pseudo- tive of the implicit function) are used to spatially code in Figure 2 summarizes this algorithm. subdivide 3-space into cells, each of which contains at In order to detect potential intersections in a given most one intersection of the surface with the ray. The parameter range, we compute a bounding box for the exact intersection point is then found using the New- value of the displacement shader over this range. The ton method or regula falsi. Unfortunately, the com- recursion is terminated if the bounding box is small putation of Lipschitz bounds cannot be automated, enough. For primary rays this means that the projec- and thus the use of this algorithm is limited to cases tion of the box onto the screen is smaller than some where it is acceptable for the user to specify them. fraction of a pixel. As we will show in Section 3.1, Snyder [22, 23] and Duff [6] used interval arith- the bounding boxes can be obtained with the help of metic to recursively enumerate implicit surfaces with affine arithmetic. a hierarchical data structure. For each cell, the im- Figure 3 shows an example of this method. On plicit function is evaluated using interval arithmetic. the left side, you see the hierarchically subdivided This yields bounds for the value of the function in parameter domain for the intersection of a ray with this cell. If these bounds include the value zero, the the simple shader from Figure 1. On the right side, intersect(ray,shader,u1,u2,v1,v2) The displacement shader communicates with two f other parts of the rendering system, the geometry bBox= computeBBox(shader,u1,u2,v1,v2); processing stage and a surface shading stage. The if( intersects(ray,bBox) ) data flow between those parts is depicted in Figure 4. if( isSmallEnough(bBox) ) return bBox; u,v,du,dv implicit implicit params params else Geometry Displacement Surface f Processing Shader Shader ll= intersect(ray,shader, u1,(u1+u2)/2,v1,(v1+v2)/2); Figure 4: The data flow between selected parts of lr= intersect(ray,shader, the rendering system. (u1+u2)/2,u2,v1,(v1+v2)/2); ul= intersect(ray,shader, Given a parametric position (u; v) and sampling u1,(u1+u2)/2,(v1+v2)/2,v2); rate (du; dv), the geometry processing stage com- ur= intersect(ray,shader, putes a set of purely geometric terms for a given (u1+u2)/2,u2,(v1+v2)/2,v2); parametric surface. This includes the point in 3- return closest(ll,lr,ul,ur); space, as well as the geometric and the shading nor- g return NONE; mal in this point. g This set of geometric terms is then passed on to the displacement shader, which is allowed to change the Figure 2: The basic intersection algorithm. position of the point, as well as the shading normal. The most important parameters of a displacement shader are listed in Table 1. The shader does not have direct access to the underlying geometry of the surface.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    9 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us