Lossy geometry compression using interpolation normals for BVH construction and rendering
By generating a low-resolution version of a high-resolution mesh and projecting rays using interpolated normals, the problem of large data storage in BVH is solved, achieving a higher compression ratio and rendering efficiency, making it suitable for ray tracing in complex scenes.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ADVANCED MICRO DEVICES INC
- Filing Date
- 2024-06-11
- Publication Date
- 2026-05-05
AI Technical Summary
Existing technologies using bounding volume hierarchy (BVH) for ray tracing require large amounts of stored data, resulting in excessive memory consumption and difficulty adapting to the memory of accelerator processors. Furthermore, conventional compression techniques are inefficient and require extensive evaluation of vertex data of adjacent triangles, leading to increased power and time consumption.
By generating a low-resolution version of the high-resolution mesh, using interpolated normals to determine points on the surface patch, and projecting rays along the interpolated normals, a BVH structure is generated, reducing memory consumption and the need to evaluate adjacent triangle vertices, thus improving the compression ratio.
It improves the compression ratio and rendering efficiency of ray tracing without increasing memory consumption, while reducing power and time consumption, making it suitable for rendering more complex scenes.
Smart Images

Figure CN121986362A_ABST
Abstract
Description
[0001] Cross-reference to related applications This application claims priority to pending U.S. nonprovisional patent application No. 18 / 475,949, filed September 27, 2023, entitled “LOSSY GEOMETRY COMPRESSIONUSING INTERPOLATED NORMALS FOR USE IN BVH BUILDING AND RENDERING”, the entire contents of which are incorporated herein by reference. Background Technology
[0002] Ray tracing is a graphics rendering technique in which simulated rays are cast to intersect test objects and pixels are illuminated and shaded based on the results of the ray casting. Ray tracing is computationally more expensive than rasterization-based techniques, but yields physically more accurate results. Improvements to ray tracing operations are constantly being made. Attached Figure Description
[0003] A more detailed understanding can be obtained from the following description, which is given by way of example in conjunction with the accompanying drawings: Figure 1 It is a block diagram of an example device that can implement one or more features of this disclosure; Figure 2 Based on the block diagram of the example device, it illustrates the involvement in Figure 1 Additional details on the processing tasks performed on the accelerated processing equipment; Figure 3 This example illustrates a ray tracing pipeline for rendering graphics using ray tracing techniques. Figure 4 This is a diagram of the enclosing volume hierarchy based on the example; Figure 5 This is a flowchart illustrating an example method of rendering objects in a scene using ray tracing according to the features of this disclosure; Figure 6A An example object represented by a high-resolution mesh to be rendered according to the features of this disclosure is illustrated; Figure 6B An example is illustrated by a low-resolution version of a high-resolution mesh representing a feature according to this disclosure. Figure 6A The example object shown; Figure 6C Examples of features according to this disclosure are illustrated. Figure 6B The example object shown is represented using a low-resolution version of a surface patch of a high-resolution mesh; Figure 6D Examples of features according to this disclosure are provided for representing Figure 6A The example object 602 is represented by an approximation of a high-resolution mesh of the example object shown. Figure 7A This is an illustration of the surface of a high-resolution mesh and the sides of triangles in a low-resolution version of the high-resolution mesh, based on the example. Figure 7B It is a diagram of the surface of a triangular surface patch extending between the vertices of the base surface, based on the example; Figure 7C It is an illustration of the interpolated normals extending between points on the surface of a triangular surface patch and the surface of a high-resolution mesh, based on the example; and Figure 8 This is a flowchart illustrating an example method for rendering objects in a scene using ray tracing. Detailed Implementation
[0004] As mentioned above, each ray intersection test is complex and expensive in terms of processing resources. Therefore, accelerated hierarchies, such as bounding volume hierarchies (BVHs), are used to implement ray tracing more efficiently for accurate determination. While accelerated hierarchies (e.g., BVH structures) are more efficient for ray tracing, they typically require large amounts of data to represent each primitive (e.g., each node) of the BVH structure, and thus consume significant amounts of memory to implement the BVH structure for ray tracing. In fact, the BVH data used to represent more complex scenes is often too large to fit within the memory of accelerated processors (e.g., GPUs).
[0005] Some conventional techniques have attempted to reduce the amount of data stored for a high-resolution mesh (e.g., data representing triangles of a BVH structure) by compressing a portion of the high-resolution mesh into a quantized 3D offset (i.e., a displacement vector) between points on a low-resolution mesh (representing that portion of the high-resolution mesh) and points on a bilinear interpolation surface (i.e., a basal surface defined by four vertices). That is, because the low-resolution mesh contains fewer triangles than the high-resolution mesh, less connectivity data (e.g., vertex data of the triangles) is used (e.g., stored in memory) to represent the triangles of the BVH structure. Rays are then projected onto the locations determined by the quantized 3D offset. While these conventional techniques do reduce the amount of data stored, their compression ratios are inefficient (i.e., low) because they require storing the value of each offset in all three dimensions.
[0006] Other conventional techniques for converting high-resolution meshes to low-resolution meshes have attempted to achieve higher compression ratios by using the normal direction of the subdivision (e.g., cyclic subdivision) surface of the flat triangles of the lower-resolution mesh as the direction along which the one-dimensional (1D) offset is encoded (as opposed to encoding the three-dimensional offset). The 1D offset is applied from a point on each subdivision surface (i.e., a surface C1 continuous on the base edge of the triangles in the lower-resolution mesh) and along the normal of the subdivision surface.
[0007] In other words, to accurately project light onto a surface represented by a high-resolution mesh, the differences between the LR and HR meshes are determined based on 1D offsets. However, while these conventional 1D offset techniques achieve higher compression ratios than techniques that compress the mesh into 3D offsets, determining these differences requires evaluating each subdivision surface within the subdivision surface. This includes evaluating data for the vertices (e.g., the valence of the vertices) of adjacent triangles (i.e., triangles of other nodes in the BVH) (e.g., storing and retrieving data from memory). Therefore, this additional evaluation results in inefficient additional power and time consumption.
[0008] Furthermore, some conventional 1D offset techniques use the surface normal of a flat triangle to determine the position of the projected light ray, which typically results in large offset values. Therefore, these large offset values require a large amount of memory (i.e., to store the bits representing the large offset values).
[0009] The features of this disclosure provide apparatus and methods for compressing surface geometry and rendering objects in a scene using ray tracing. The features of this disclosure provide lossy compression techniques that reduce the amount of data stored for the geometry of a scene (and thus reduce the amount of memory used to store the data) while maintaining a higher compression ratio than conventional techniques. The techniques described herein compress data such that the geometry representing a larger scene (e.g., a more complex scene) is processed on an accelerated processor (i.e., using the memory of an accelerated processor such as a GPU).
[0010] The features of this disclosure generate low-resolution versions (i.e., low-resolution meshes) of high-resolution meshes (e.g., high-resolution meshes of triangles or bilinear quadrilaterals) representing objects in a scene. The low-resolution meshes include, for example, fewer triangles or bilinear quadrilaterals than the high-resolution meshes. For each polygon (e.g., triangle or bilinear quadrilateral) of the low-resolution mesh, compared to using subdivision surfaces with complex evaluation schemes (e.g., expensive and time-inefficient) or flat triangles implemented by some conventional techniques, a polygon surface patch (e.g., a surface-including triangle surface patch defined in the triangle parameter space (hereinafter referred to as a "triangle surface patch") or a surface-including bilinear quadrilateral surface patch defined in the bilinear quadrilateral parameter space (hereinafter referred to as a "quadrilateral surface patch") is generated for each corresponding triangle or bilinear quadrilateral of the low-resolution mesh.
[0011] For the purpose of simplification, the examples described herein include the use of a triangular surface patch defined in a triangle parameter space. However, as stated above, the features of this disclosure can be implemented using different polygon surface patches (e.g., bilinear quadrilateral surface patches) defined in different polygon parameter spaces (e.g., bilinear quadrilateral parameter spaces).
[0012] Interpolated normals (i.e., surface normals) are determined for points (e.g., positions) on the surface of the low-resolution triangular mesh. Each interpolated normal also defines the orientation at the corresponding point on the surface of the corresponding triangle. For each point on the surface, a one-dimensional (1D) offset (e.g., distance) value is determined between the corresponding point on the triangular surface patch and the surface of the triangle in the high-resolution mesh. The offset is determined by casting rays from each point on the surface along the corresponding interpolated normal. Each ray is cast along the interpolated normal to determine the offset between the corresponding point on the surface and the surface of the triangle in the high-resolution mesh. The 1D offset between the surface and the high-resolution triangle is stored and later used to render objects in the scene.
[0013] An accelerated structure (e.g., a BVH) is generated, which includes triangles of a low-resolution mesh determined using computed offsets to reduce the number of primitives required for BVH construction. For the purpose of illustrative simplicity, this document uses BVH as an example of a hierarchical accelerated data structure to describe the features of this disclosure. However, the features of this disclosure can be implemented for any type of hierarchical accelerated data structure used to represent objects within a scene (e.g., the volume of an object) to achieve ray tracing.
[0014] The object is rendered by: recalculating the points on the surface of each triangle surface patch for each triangle; moving the points on the surface to new points on the surface of the high-resolution mesh along the interpolation normal using stored 1D offset values; creating new triangles in the high-resolution mesh based on the new points determined by the offset, which approximate the original high-resolution surface; and performing a ray intersection test by casting rays at these new triangles in the high-resolution mesh, which approximate the original high-resolution surface. The object is then rendered based on the ray intersection test.
[0015] Furthermore, because the features of this disclosure encode the differences (i.e., offsets) along the interpolation normals starting from the surface (i.e., the surface of the triangular surface patch), the stored offset values between the surface and the surfaces of the triangles in the high-resolution mesh have a lower magnitude than those of conventional techniques (which encode differences along the normals from points on flat triangles), and therefore consume less memory than these conventional techniques. Moreover, the features of this disclosure encode the offsets without evaluating data of the vertices of adjacent triangles (e.g., storing and reading data from memory), resulting in less power and time consumption than conventional techniques.
[0016] A method is provided for rendering objects in a scene using ray tracing, the method comprising: generating a low-resolution version of a high-resolution mesh representing the objects in the scene; determining points on the surface of a surface patch defined by either a triangle or a bilinear quadrilateral for the low-resolution version of the high-resolution mesh; performing a ray intersection test by projecting rays toward the surface of the high-resolution mesh, the surface of the high-resolution mesh being approximated from new points calculated by offset values along interpolated normals from points on the surface of the surface patch; and rendering the objects in the scene based on the ray intersection test.
[0017] A method is provided for compressing geometry to render objects in a scene using ray tracing. The method includes generating a low-resolution version of a high-resolution mesh, the high-resolution mesh including at least one of triangles and bilinear quadrilaterals representing objects in the scene. The method further includes: generating a surface patch comprising a curved surface for one of the triangles and bilinear quadrilaterals of the low-resolution mesh; determining interpolated normals at points on the surface of the surface patch by interpolating the normals of the low-resolution mesh; and for each point, determining an offset value as the distance from the point on the curved portion to the surface of the high-resolution mesh. The method also includes: rendering objects in the scene using a ray tracing acceleration structure by projecting rays toward new points formed by points on the curved surface, at least one of the triangles and bilinear quadrilaterals offset along the interpolated normals, onto the surface of an approximate high-resolution mesh and performing a ray intersection test.
[0018] A processing apparatus is provided for rendering objects in a scene using ray tracing. The processing apparatus includes a memory and a processor. The processor is configured to: generate a low-resolution version of a high-resolution mesh representing the objects in the scene; determine points on the surface of a surface patch defined for one of triangles and bilinear quadrilaterals of the low-resolution mesh; perform a ray intersection test by projecting rays toward the surface of the high-resolution mesh, the surface of which is approximated from new points calculated by offset values along interpolated normals from points on the surface of the surface patch; and render the objects in the scene based on the ray intersection test.
[0019] Figure 1 This is a block diagram of an example device 100 that can implement one or more features of the present disclosure. Device 100 includes, for example, a computer, gaming device, handheld device, set-top box, television, mobile phone, or tablet computer. Device 100 includes a processor 102, memory 104, storage device 106, one or more input devices 108, and one or more output devices 110. Device 100 also optionally includes an input driver 112 and an output driver 114. It should be understood that device 100 includes... Figure 1 Other components not shown in the diagram.
[0020] In various alternatives, processor 102 includes a central processing unit (CPU), a graphics processing unit (GPU), a CPU and GPU located on the same die, or one or more processor cores, wherein each processor core may be a CPU or a GPU. In various alternatives, memory 104 is located on the same die as processor 102 or is located separately from processor 102. Memory 104 includes volatile or non-volatile memory, such as random access memory (RAM), dynamic RAM, or cache.
[0021] Storage device 106 includes fixed or removable storage devices, such as hard disk drives, solid-state drives, optical disks, or flash drives. Input device 108 includes, but is not limited to, keyboards, keypads, touchscreens, touchpads, detectors, microphones, accelerometers, gyroscopes, biometric scanners, or network connections (e.g., wireless LAN cards for transmitting and / or receiving wireless IEEE 802 signals). Output device 110 includes, but is not limited to, display device 118, display connectors / interfaces (e.g., HDMI or DisplayPort connectors or interfaces for connecting to HDMI or DisplayPort compatible devices), speakers, printers, haptic feedback devices, one or more lights, antennas, or network connections (e.g., wireless LAN cards for transmitting and / or receiving wireless IEEE 802 signals).
[0022] Input driver 112 communicates with processor 102 and input device 108, and allows processor 102 to receive input from input device 108. Output driver 114 communicates with processor 102 and output device 110, and allows processor 102 to transmit output to output device 110. It should be noted that input driver 112 and output driver 114 are optional components, and device 100 will operate in the same manner if input driver 112 and output driver 114 are not present. Output driver 114 includes an accelerated processing device (“APD”) 116 coupled to display device 118. APD 116 is configured to receive computation commands and graphics rendering commands from processor 102, process those computation and graphics rendering commands, and provide pixel output to display device 118 for display. As detailed below, APD 116 includes one or more parallel processing units configured to perform computations according to a single instruction multiple data (“SIMD”) paradigm. Therefore, although various functions are described herein as being performed by or in conjunction with APD 116, in various alternatives, the functions described as being performed by APD 116 may additionally or alternatively be performed by other computing devices with similar capabilities, which are not driven by a host processor (e.g., processor 102) and are configured to provide (graphics) output to display device 118. For example, it is conceivable that any processing system performing processing tasks according to the SIMD paradigm could be configured to perform the functions described herein. Alternatively, it is conceivable that a computing system performing processing tasks not according to the SIMD paradigm may perform the functions described herein.
[0023] Figure 2 This is a block diagram of aspects of device 100, illustrating additional details related to performing processing tasks on APD 116. Processor 102 maintains one or more control logic modules in system memory 104 for execution by processor 102. The control logic modules include operating system 120, driver 122, and application 126. These control logic modules control various features of the operation of processor 102 and APD 116. For example, operating system 120 communicates directly with the hardware and provides an interface to the hardware for other software executing on processor 102. Driver 122 controls the operation of APD 116 by providing, for example, an application programming interface (“API”) to software executing on processor 102 (e.g., application 126) to access various functions of APD 116. In some specific implementations, driver 122 includes a just-in-time (JIT) compiler that compiles programs for execution by processing units of APD 116, such as SIMD unit 138 detailed below. In other specific implementations, the just-in-time compiler is not used to compile the program, and the shader program is compiled normally by the compiler for execution on the APD 116.
[0024] APD 116 executes commands and procedures for selected functions, such as graphics and non-graphics operations suitable for parallel and / or out-of-order processing. APD 116 is used to perform graphics pipeline operations, such as pixel manipulation, geometric calculations, and rendering images to display device 118 based on commands received from processor 102. APD 116 also performs computational processing operations not directly related to graphics operations based on commands received from processor 102, such as operations related to video, physics simulations, computational fluid dynamics, or other tasks.
[0025] APD 116 includes computation units 132 (collectively referred to as “computation units” 202) that include one or more SIMD units 138 that perform operations in parallel at the request of processor 102 according to a SIMD paradigm. A SIMD paradigm is a paradigm in which multiple processing elements share a single program control flow unit and program counter and thereby execute the same program, but are able to execute the program with different data. In one example, each SIMD unit 138 includes sixteen channels, where each channel executes the same instruction simultaneously with the other channels in SIMD unit 138, but executes the instruction with different data. If not all channels need to execute a given instruction, channels can be shut down by prediction. Prediction can also be used to execute programs with divergent control flow. More specifically, for programs with conditional branches or other instructions where the control flow is based on computations executed by a single channel, channels corresponding to control flow paths not currently being executed are predicted, and the serial execution of different control flow paths can achieve arbitrary control flow. In one specific implementation, each of the computation units 132 may have a local L1 cache. In one specific implementation, multiple computing units 132 share an L2 cache.
[0026] The basic unit of execution in computing unit 132 is a work item. Each work item represents a single instantiation of a program to be executed in parallel on a specific channel. Work items can be executed simultaneously as wavefronts (also called “waves”) on a single SIMD processing unit 138. One or more wavefronts are included in a “workgroup”, which comprises a set of work items assigned to execute the same program. The workgroup is executed by executing each of the wavefronts that make up the workgroup. Alternatively, wavefronts may be executed sequentially on a single SIMD unit 138, or partially or completely in parallel on different SIMD units 138. Scheduler 136 is configured to perform operations involving scheduling various wavefronts on different computing units 132 and SIMD units 138.
[0027] The parallelism provided by computing unit 132 is suitable for graphics-related operations, such as pixel value calculation, vertex transformation and other graphics operations, as well as non-graphics operations (sometimes referred to as "computation" operations). Therefore, in some instances, graphics pipeline 134, which accepts graphics processing commands from processor 102, provides computational tasks to computing unit 132 for parallel execution.
[0028] The computing unit 132 is also used to perform computational tasks that do not involve graphics or are not part of the “normal” operation of the graphics pipeline 134 (e.g., custom operations performed to supplement the processing performed for the operation of the graphics pipeline 134). Application 126 or other software executing on processor 102 sends programs defining such computational tasks to APD 116 for execution.
[0029] Computation unit 132 implements ray tracing, a technique for rendering 3D scenes by testing the intersections between simulated rays and objects in the scene. Most of the work involved in ray tracing is performed by a programmable shader program running on the SIMD unit 138 within computation unit 132, as detailed below.
[0030] Figure 3An example of a ray tracing pipeline 300 for rendering graphics using ray tracing technology is illustrated. The ray tracing pipeline 300 provides an overview of the operations and entities involved in rendering a scene using ray tracing. The ray generation shader 302, the arbitrary hit shader 306, the intersection shader 307, the closest hit shader 310, and the miss shader 312 are shader implementation levels representing ray tracing pipeline levels, the functionality of which is performed by shader programs executing on the SIMD unit 138. Any of the specific shader programs at each concrete shader implementation level is defined by application-provided code (i.e., code provided by the application developer and pre-compiled by the application compiler and / or compiled by the driver 122). It should be noted that in variations, these stages can be implemented using dedicated, fixed-function, or programmable circuitry. The accelerated structure traversal level 304 performs ray intersection tests to determine whether a ray hits a triangle. Other programmable shader levels (ray generation shader 302, any-hit shader 306, closest-hit shader 310, and miss shader 312) are implemented as shader programs that execute on SIMD unit 138. Accelerated traversal levels can be implemented in software (e.g., as shader programs that execute on SIMD unit 138), hardware, or a combination of hardware and software. Ray traversal pipeline 300 can be coordinated partially or entirely in software or partially or entirely in hardware, and can be coordinated by processor 102, scheduler 136, a combination thereof, or partially or entirely by any other hardware and / or software unit. In the example, traversal through ray traversal pipeline 300 is performed partially or entirely autonomously by scheduler 136 or under the control of processor 102, or partially or entirely by shader programs (such as BVH traversal shader programs) that execute on one or more of the SIMD units 138. In some examples, testing rays for boxes and triangles (within the accelerated structure traversal level 304) is hardware-accelerated (meaning that fixed-function hardware units perform the steps of these tests). In other examples, such tests are performed by software, such as shader programs executed on one or more SIMD units 138. In this document, when the phrase "ray tracing pipeline performs [a task]" is used, it means that the hardware and / or software implementing the ray tracing pipeline 300 performs the task.
[0031] The ray tracing pipeline 300 operates as follows: A ray generation shader 302 is executed. The ray generation shader 302 builds ray data to test against a triangle and requests an accelerated traversal stage 304 to test the intersection of the ray and the triangle.
[0032] Accelerated structure traversal stage 304 traverses the accelerated structure and tests rays against triangles in the scene. An accelerated structure is a data structure describing the scene volume and objects within the scene. During this traversal, for triangles intersecting with rays, if any hit shader 306 and / or intersection shader 307 are specified by the material of the intersecting triangle, the ray tracing pipeline 300 triggers the execution of those shaders. Note that multiple triangles can intersect with a single ray. It is not guaranteed that the accelerated structure traversal stage will traverse the accelerated structure in order from closest to farthest from the ray source. Accelerated structure traversal stage 304 triggers the execution of the closest hit shader 310 for the triangle hit by the ray closest to the ray origin, or triggers the miss shader if no triangle is hit.
[0033] It should be noted that either the arbitrary hit shader 306 or the intersection shader 307 may "reject" an intersection from the accelerated structure traversal level 304, and therefore, if no intersection with the ray is found, or if one or more intersections are found but all are rejected by the arbitrary hit shader 306 and / or the intersection shader 307, the accelerated structure traversal level 304 triggers the execution of the miss shader 312. An example environment in which the arbitrary hit shader 306 may "reject" a hit is when the accelerated structure traversal level 304 reports that at least a portion of the triangle that was hit is completely transparent. Because the accelerated structure traversal level 304 only tests geometry and not transparency, the arbitrary hit shader 306, invoked due to an intersection with a triangle having at least some transparency, can determine that the reported intersection should not be counted as a hit because it "intersects" with the transparent portion of the triangle. The most typical use of the closest hit shader 310 is to shade the ray based on the texture of the material. The typical use of the miss shader 312 is to shade the ray with a color set by the skybox. It should be understood that various techniques for shading light and / or performing other operations can be implemented for the shader procedures defined for the closest hit shader 310 and the miss shader 312.
[0034] A typical way for the ray-generating shader 302 to generate rays is using a technique called backward ray tracing. In backward ray tracing, the ray-generating shader 302 generates rays whose origin is located at the point of the camera (i.e., the viewer's eye). The point where the ray intersects with a plane defined corresponding to the screen defines a pixel on the screen, and the ray is used to determine the color of that pixel. If the ray hits an object, the pixel is colored based on the nearest hit shader 310. If the ray misses an object, the pixel is colored based on the miss shader 312. Multiple rays can be cast to each pixel, and the final color of the pixel is determined by some combination of colors determined by each ray for that pixel.
[0035] Any of the hit shader 306, intersection shader 307, nearest hit shader 310, and miss shader 312 can generate their own rays, which enter the ray tracing pipeline 300 at the ray test point. These rays can be used for any purpose. A common use is to implement ambient lighting or reflections. In the example, when the nearest hit shader 310 is invoked, it generates rays in various directions. For each object or ray hit by the generated rays, the nearest hit shader 310 adds illumination intensity and color to the pixel corresponding to it. It should be understood that while some examples of how various components of the ray tracing pipeline 300 can be used to render a scene have been described, any of a variety of techniques may be used alternatively.
[0036] As described above, the determination of whether a ray intersects an object is referred to herein as a “ray intersection test.” A ray intersection test involves emitting a ray from the origin and determining whether that ray intersects a triangle, and if so, how far the point of intersection is from the origin. For efficiency, the ray tracing test uses a spatial representation called a bounding volume hierarchy (BVH). This BVH is the “acceleration structure” mentioned elsewhere in this paper. For example, in a BVH, each non-leaf node represents an axis-aligned bounding box (AABB), which defines the geometry of all its child nodes. In one example, a base node represents the maximum extent of the entire region for which the ray intersection test is performed. In this example, the base node has two children, each representing a mutually exclusive AABB that subdivides the entire region. Each of these two children has two child nodes, each representing an AABB that subdivides its parent space, and so on. Leaf nodes represent triangles or other geometries for which the ray intersection test can be performed.
[0037] Compared to not using such a data structure, where all triangles in the scene must therefore be tested against rays, the BVH data structure allows for a reduction in the number of ray-triangle intersections (ray-triangle intersections are complex and therefore expensive in terms of processing resources). Specifically, if a ray does not intersect a particular bounding box and that bounding box defines a large number of triangles, all triangles in that box can be eliminated from the test. Therefore, ray intersection testing is performed as a series of tests of the ray relative to the AABB, followed by tests relative to the triangles.
[0038] Figure 4 This is a diagram of the BVH from the example. For simplicity, the hierarchy is shown in 2D. However, extending it to 3D is straightforward, and it should be understood that the tests described herein are generally performed in 3D.
[0039] BVH spatial representation 402 in Figure 4The left side is an example, and the tree representation of BVH is 404. Figure 4 The example on the right is shown below. In both spatial representation 402 and tree representation 404, non-leaf nodes are represented by the letter "N", while leaf nodes are represented by the letter "O".
[0040] For the purpose of simplifying the explanation, Figure 4 In the example shown, triangles are represented as primitives. However, as described in more detail below, primitives may include capsules and capsule chains for rendering curves in the scene, and nodes of the BVH tree may include capsules.
[0041] The standard ray intersection test for tree representation 404 is performed by traversing tree 404, and for each non-leaf node tested, if the test for that non-leaf node fails, the branches below that node are eliminated. However, when a ray intersects AABB (i.e., if the test for a non-leaf node succeeds), the standard ray traversal algorithm continues traversing within AABB until the test reaches a leaf node. For example, if the ray intersects O5 but there are no other triangles, the standard ray intersection test will be performed on N1, determining that the ray intersects AABB (i.e., the test for N1 succeeds). This test will then be performed on N2, determining that the test fails (because O5 is not within N2), and this test will eliminate all child nodes of N2. Because the test for N1 resulted in determining that the ray intersects AABB, the traversal will continue to the child nodes of N1, and a test will be performed on N3, determining that the ray intersects AABB (i.e., the test succeeds). Because the test for N3 determines that the ray intersects with AABB, the traversal will continue to the child nodes of N3, and N6 and N7 will be tested, confirming that N6 succeeds but N7 fails. This test will then test O5 and O6, noting that O5 succeeds but O6 fails. Instead of testing eight triangles, two triangle tests (O5 and O6) and five box tests (N1, N2, N3, N6, and N7) are performed.
[0042] The ray tracing pipeline 300 projects rays to detect whether rays hit triangles and how such hits should be shaded during the rendering of the 3D scene (e.g., how to calculate the brightness and color levels of pixels representing objects). A material is assigned to each triangle, specifying which nearest-hit shader should be executed for that triangle at the nearest-hit shader level 310, whether an arbitrary-hit shader should be executed at the arbitrary-hit shader level 306, whether an intersection shader should be executed at the intersection shader level 307, and, if those shaders are to be executed, at which levels specific arbitrary-hit and intersection shaders should be executed.
[0043] Therefore, when a ray is emitted, the ray tracing pipeline 300 evaluates the intersections detected at the accelerated structure traversal stage 304 as follows: If the ray is determined to intersect a triangle, then if the triangle's material has at least an arbitrary hit shader or an intersection shader, the ray tracing pipeline 300 runs the intersection shader and / or the arbitrary hit shader to determine whether the intersection should be considered a hit or a miss. If neither an arbitrary hit shader nor an intersection shader is specified for a specific material, then the intersection with a triangle having that material reported by the accelerated structure traversal stage 304 is considered a hit.
[0044] Here are some examples of cases where the arbitrary hit shader or intersection shader does not count an intersection as a hit. In one example, if α is 0 (meaning completely transparent), the arbitrary hit shader does not consider the point where the ray intersects the triangle as a hit. In another example, the arbitrary hit shader determines that the point where the ray intersects the triangle is considered to be located in a “cut-out” portion of the triangle (where the cut-out “cuts out” the triangle by designating a portion of the triangle as a part that the ray cannot hit), and therefore considers the intersection not a hit.
[0045] Once the acceleration structure has been fully traversed, the ray tracing pipeline 300 runs the nearest hit shader 310 on the triangle closest to the hit ray. Similar to the arbitrary hit shader 306 and the intersection shader 307, the nearest hit shader 310 run on a specific triangle depends on the material assigned to that triangle.
[0046] In summary, the ray tracing pipeline 300 typically traverses the acceleration structure 304 to determine which triangle is the closest hit for a given ray. Arbitrary hit shaders and intersection shaders evaluate intersections (potential hits) to determine which intersections should be counted as actual hits. Then, for the closest triangle whose intersections are counted as actual hits, the ray tracing pipeline 300 performs a closest hit shader on that triangle. If no triangle is counted as a hit, the ray tracing pipeline 300 performs a miss shader on the ray.
[0047] Now for reference Figure 4 The example rays 1 through 4 are shown to illustrate the operation of a typical ray tracing pipeline 300. For each of the example rays 1 through 4, the ray tracing pipeline 300 determines which triangles (or other primitives, such as capsules described in more detail below) these rays intersect. The ray tracing pipeline 300 executes appropriate arbitrary hit shaders 306 and / or intersection shaders 307 as specified by the material of the intersecting triangles to determine the closest hit that is not a miss (and thus the closest hit triangle). The ray tracing pipeline 300 runs the closest hit shader of that closest hit triangle.
[0048] In the example, for ray 1, the ray tracing pipeline 300 runs the nearest hit shader for O4, unless the triangle has any hit shader or intersection shader that indicates ray 1 did not hit the triangle at execution. In that case, the ray tracing pipeline 300 will run the nearest hit shader for O1, unless the triangle has any hit shader or intersection shader that indicates ray 1 did not hit the triangle, and in that case, the ray tracing pipeline 300 will execute the miss shader 312 for ray 1. Similar operations will occur for rays 2, 3, and 4. For ray 2, the ray tracing pipeline 300 determines that it intersects with O2 and O4, and if specified by the material, executes any hit shader and / or intersection shader for those triangles, and runs the appropriate nearest hit shader or miss shader. For rays 3 and 4, the ray tracing pipeline 300 determines the intersections as shown in the figure (ray 3 intersects with O3 and O7 and ray 4 intersects with O5 and O6), executes the appropriate arbitrary hit shader and / or intersection shader, and executes the appropriate nearest hit shader or miss shader based on the results of the arbitrary hit shader and / or intersection shader.
[0049] Figure 5 This is a flowchart illustrating an example method 500 for compressing the geometry of scene objects for rendering, based on the features of this disclosure. Figures 6A to 6C and Figures 7A to 7C Method 500 is described below. The functions described in each box of Method 500 may be executed using an accelerated processor (e.g., APD 116) or by fixed-function hardware circuitry configured to perform a particular function (e.g., the function in box 508 described below may be executed using a fixed-function hardware circuitry system configured to calculate points on a surface).
[0050] As shown in box 502, method 500 includes generating a high-resolution mesh that includes multiple triangles representing objects in the scene. For example, Figure 6A An example object 602, represented by a high-resolution mesh (e.g., a high-resolution mesh including triangles), is illustrated according to the features of this disclosure and is to be rendered.
[0051] As shown in box 504, method 500 includes generating a low-resolution version of the high-resolution mesh (i.e., a low-resolution mesh). The number of triangles in the high-resolution mesh is reduced by using operations that fold the edges of the triangles in the high-resolution mesh, so that the high-resolution mesh is represented as a low-resolution mesh with fewer triangles than the high-resolution mesh, making the low-resolution mesh a less detailed version of the high-resolution mesh. For example, Figure 6B Examples Figure 6AThe example object 602 shown is represented by a low-resolution version of a high-resolution mesh. That is, an operation is performed to collapse the high-resolution mesh (in...). Figure 6A The edges of the triangles (represented in example 602) are used to generate a low-resolution mesh (in... Figure 6A The example shown is object 602, which is a less detailed version compared to a high-resolution mesh (e.g., using fewer triangles). Because the low-resolution mesh includes fewer triangles than the high-resolution mesh, less connectivity data (e.g., vertex data of the triangles) is used (e.g., stored in memory) to represent the triangles of the BVH structure.
[0052] use Figures 7A to 7C The example illustrations shown depict blocks 506 to 510 of method 500. Figures 7A to 7C This is an illustration showing an example of an encoded 1D offset according to the features of this disclosure. Figure 7A It is a surface (e.g., a slice) 702 of a high-resolution mesh (e.g., a surface representing multiple triangles of a high-resolution mesh) and triangles (e.g., a low-resolution mesh) of a low-resolution version of the high-resolution mesh (i.e., a low-resolution mesh). Figure 4 A diagram of side 704 of one of the triangles O1-O8 in the diagram. For the purpose of simplification, in... Figures 7A to 7C The image shows only a single edge 704 of the triangle in the low-resolution mesh. Arrows 706 and 708 are 2D representations of the 3D vertex normals at vertex 720 of edge 704. Figure 7B This is an illustration of a triangular surface patch 710, which has a curved surface 712 (i.e., a triangular curved surface patch) extending between vertices 720 of edge 704. Figure 7C This is an illustration of the interpolation normal 714 (i.e., surface normal) extending between a point 716 on the surface 712 of the triangular surface patch 710 and the surface 702 of the high-resolution mesh (e.g., representing a slice of one or more triangles). Figure 7A The shapes, sizes, and dimensions of the features shown are merely examples.
[0053] As shown in box 506, method 500 includes generating a triangular surface patch for each triangle in the low-resolution mesh. The surface of the triangular surface patch depends on the position of the corresponding triangle in the low-resolution mesh and its normals (e.g., quantized normals). For example, as... Figure 7B As shown, a triangular surface patch 710 is generated for triangles in a low-resolution mesh. As shown, the surface 712 of the triangular surface patch 710 extends between the vertices 720 of the edge 704. Figure 6C Example object 602 is shown, representing a surface patch using a low-resolution version of a high-resolution mesh.
[0054] Various high-order surface techniques can be used to generate surfaces (e.g., techniques implemented using Bézier surfaces constructed from Bézier curves). For example, surfaces (such as surface 712) can be generated using various surface patches with control points that can be derived solely from the vertices of triangles or bilinear quadrilaterals in a low-resolution mesh and the normals at those vertices.
[0055] As shown in box 508, method 500 includes determining an interpolation normal (i.e., a line perpendicular to the surface) for each of a plurality of points (e.g., locations in space) on the surface of the triangular surface patch. For example, as Figure 7C As shown, an interpolated normal 714 is determined for each point 716 (e.g., position) on the surface 712 of the triangular surface patch 710. The interpolated normal is, for example, a quantized normal, determined by a combination of three normals from one face of the corresponding triangle in the low-resolution mesh. The interpolated normal is determined at a point on the surface of the triangular surface patch by interpolating the normals of the low-resolution mesh. Each interpolated normal defines the direction at the corresponding point on the surface of the corresponding triangle.
[0056] For example, the interpolated normal of a point 716 (e.g., its position in space) on a surface 712 between vertices 720 is determined by: (1) calculating the vertex normal at each of the three vertices of the corresponding triangle of the low-resolution mesh (e.g., generating the vertex normal by calculating the average of the surface normals of adjacent faces sharing the corresponding vertex); (2) interpolating the three vertex normals by weighting each vertex normal with the corresponding centroid coordinates of each vertex normal (e.g., linear, quadratic, or cubic normal interpolation); and (3) summing the interpolated vertex normals. An example of two vertex normals of the three vertex normals of a face of a triangle in a low-resolution mesh is shown in... Figures 7A to 7C The vertex normals 706 and 708 are shown in the diagram.
[0057] The number of points for each triangle surface patch is determined, for example, by a factor that reduces the number of triangles from a high-resolution mesh to a low-resolution mesh. For example, if for every 1000 triangles in the high-resolution mesh, there is one triangle in the low-resolution mesh, then interpolated normals are determined at 1000 points on the surface of the triangle surface patch.
[0058] As shown in box 510, method 500 includes determining an offset (i.e., an offset value) for each point on the surface, representing the distance from the point on the surface to a surface point on the high-resolution mesh. Specifically, for each point on the surface, a 1D offset (e.g., distance) value is determined between the corresponding point on the triangular surface patch and the surface point of the triangle on the high-resolution mesh. The offset for each point is determined by projecting rays from the point on the triangular surface patch along the corresponding interpolated normal. The 1D offset is stored and later used to render objects in the scene.
[0059] For example, targeting Figure 7C For each point 716 on the surface 712 shown, an offset value is determined to represent the distance between the corresponding point 716 on the surface 712 and a surface (e.g., a slice) 702 of the high-resolution mesh. Each offset value is determined by projecting a ray from point 716 along an interpolation normal 714 and calculating the distance between the intersection point 718 of point 716 and the surface (e.g., a slice) 702 of the high-resolution mesh. In one example, rays are projected in both a first direction (in one dimension) and a second direction (in one dimension) opposite to the first direction to find the nearest point on the high-resolution surface. Alternatively, rays are projected in the first direction when they intersect the surface 702, but not in the second direction, and in the second direction when they do not intersect the surface 702 in the first direction. The 1D offset values are then stored in memory (e.g., the GPU's memory) and later used to render objects in the scene.
[0060] As shown in box 512, method 500 includes generating a ray tracing acceleration structure (e.g., BVH) that includes triangles of a low-resolution mesh and their 1D offsets (e.g., data representing the triangles of the low-resolution mesh). For example, triangles O1 to O8 are generated for a portion of the low-resolution mesh. Figure 4 The tree representation of BVH shown on the right is 404.
[0061] The operations that determine the offset values at boxes 502-510 are performed, for example, as a preprocessing step (e.g., offline) before rendering objects in the scene. That is, the operations at boxes 502-510 are not performed for rendering objects in each frame, but as a single preprocessing step before rendering frames of the scene (e.g., at runtime). As shown at box 514, method 500 includes rendering objects in the scene.
[0062] Figure 8 This is an example of using ray tracing to render objects in a scene (such as...). Figure 5 The flowchart of example method 800 (indicated by box 514).
[0063] As shown in box 802, method 800 includes calculating points on the curved portion of each triangular surface patch, which are used to determine the interpolation normal at box 508 during preprocessing. For example, point 716 is calculated on the curved portion 712 of triangular surface patch 710. As mentioned above, the number of points on each triangular surface patch is determined, for example, by a factor that reduces the number of triangles from a high-resolution mesh to a low-resolution mesh.
[0064] As shown in box 804, method 800 includes determining new points on the surface of a high-resolution mesh to project rays (e.g., new 3D points approximating the surface of the high-resolution mesh). Specifically, new points for approximating the surface of the high-resolution mesh are calculated by moving from a point on the surface of a triangular surface patch along the corresponding interpolated normal until an offset value (i.e., distance) is reached. For example, the surface of the high-resolution mesh (e.g., the triangular surface) is approximated from a new point 718 on surface 702 of the high-resolution mesh. Each new point 718 is determined by moving from point 716 along the interpolated normal 714 using the corresponding stored 1D offset value determined in box 510.
[0065] Figure 6D An example is given by an approximate high-resolution mesh surface (e.g., representing...). Figure 6A The object 602 is represented by a triangle of an approximate surface of a high-resolution mesh.
[0066] As shown in box 806, method 800 includes performing a ray intersection test by projecting rays toward a triangle of a high-resolution mesh, approximating the surface of the triangle of the high-resolution mesh using new points determined by offsets from points on a surface patch. For example, rays are projected onto... Figure 6D The triangle shown represents the approximate high-resolution mesh surface of object 602.
[0067] During the light intersection test, light rays are projected onto a triangle whose surface is used... Figure 7C The new point 718 shown is used to approximate and determine whether the triangles (representing objects or parts of objects) of the approximate high-resolution mesh are "hit" by the projected light rays. That is, at the new point determined by the offset along the direction of the interpolation normal, the approximate high-resolution mesh is resampled from points on the surface of each triangle surface patch.
[0068] As described above, ray traversal is performed using, for example, a ray tracing acceleration structure (e.g., BVH) generated at box 512.
[0069] As shown in box 808, objects in the scene are rendered based on a ray intersection test performed at box 806. For example, objects in the scene are rendered to be displayed on a display device (e.g., display device 118).
[0070] It should be understood that many variations are possible based on the disclosure herein. Although the features and elements described above are described in specific combinations, each feature or element may be used alone without other features and elements, or in various combinations with or without other features or elements.
[0071] The provided methods can be implemented in general-purpose computers, processors, or processor cores. Suitable processors, for example, include general-purpose processors, special-purpose processors, conventional processors, digital signal processors (DSPs), multiple microprocessors, one or more microprocessors associated with a DSP core, controllers, microcontrollers, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), any other type of integrated circuit (IC), and / or state machines. Such processors can be manufactured by configuring the manufacturing process using the results of hardware description language (HDL) instructions and other intermediate data, including netlists (such instructions capable of being stored on a computer-readable medium). The results of such processing can be masks, which are then used in semiconductor manufacturing processes to manufacture processors that implement aspects of the implementation scheme.
[0072] The methods or flowcharts provided herein can be implemented in a computer program, software, or firmware incorporated in a non-transitory computer-readable storage medium for execution by a general-purpose computer or processor. Examples of non-transitory computer-readable storage media include read-only memory (ROM), random access memory (RAM), registers, cache memory, semiconductor memory devices, magnetic media (such as internal hard disks and removable disks), magneto-optical media and optical media (such as CD-ROM disks), and digital multifunction disks (DVDs).
Claims
1. A method for rendering objects in a scene using ray tracing, the method comprising: Generate a low-resolution version of the high-resolution mesh representing the objects in the scene; Determine points on the surface of a surface patch defined for one of the triangles and bilinear quadrilaterals in the low-resolution version of the high-resolution mesh; A ray intersection test is performed by projecting rays toward the surface of the high-resolution mesh, the surface of which is approximated from a new point calculated by offset values along the interpolated normal of the point on the surface from the surface patch; and The objects in the scene are rendered based on the light intersection test.
2. The method of claim 1, wherein each offset value is the distance from a point on the surface of the surface patch to a new point on the surface of the high-resolution mesh.
3. The method according to claim 2, wherein The offset value is stored before the object in the scene is rendered, and The surface of the high-resolution mesh is approximated by moving from the point on the surface of the surface patch along the corresponding interpolated normal until the distance defined by the offset value is reached.
4. The method of claim 1, wherein the surface patch comprises at least one of a triangular surface patch and a quadrilateral surface patch, each triangular surface patch being defined for a corresponding triangle of the low-resolution version of the high-resolution mesh, each quadrilateral surface patch being defined for a corresponding bilinear quadrilateral of the low-resolution version of the high-resolution mesh, and each interpolated normal being determined based on at least one of a combination of the normals of the three vertices of the corresponding triangle of the low-resolution version of the high-resolution mesh and a combination of the normals of the four vertices of the corresponding bilinear quadrilateral.
5. The method of claim 1, wherein the surface patch comprises at least one of a triangular surface patch and a quadrilateral surface patch, each triangular surface patch being defined for a corresponding triangle of the low-resolution version of the high-resolution mesh, and each quadrilateral surface patch being defined for a corresponding bilinear quadrilateral of the low-resolution version of the high-resolution mesh. The high-resolution mesh includes at least one of a first number of triangles and a first number of bilinear quadrilaterals representing objects in the scene. The low-resolution version of the high-resolution mesh includes at least one of a second number of triangles and a second number of bilinear quadrilaterals representing objects in the scene, and The first number of triangles is greater than the second number of triangles.
6. The method of claim 1, wherein rendering the object in the scene includes rendering objects across multiple frames, and Before rendering any one of the plurality of frames, the offset values of the plurality of frames are determined.
7. A method for compressing geometry to render objects in a scene using ray tracing, the method comprising: Generate a low-resolution version of a high-resolution mesh, wherein the low-resolution version of the high-resolution mesh includes at least one of triangles and bilinear quadrilaterals representing objects in the scene; For the low-resolution version of the triangle and the bilinear quadrilateral of the high-resolution mesh: Generate a surface patch that includes the surface; The interpolated normals at points on the surface of the surface patch are determined by interpolating the normals of the low-resolution mesh. as well as For each of the points, the offset value is determined as the distance from the point on the surface to the surface of the high-resolution mesh; as well as Using a ray tracing acceleration architecture, objects in the scene are rendered by projecting rays toward at least one of the triangles and bilinear quadrilaterals formed by the points on the surface, offset along the interpolation normal, onto a new point on a surface approximating the high-resolution mesh, and performing a ray intersection test.
8. The method of claim 7, wherein for each surface patch, the interpolated normal is determined using data representing the normals of one of the triangles and bilinear quadrilaterals of the low-resolution mesh, without using at least one of any adjacent triangles and any adjacent bilinear quadrilaterals of the low-resolution mesh.
9. The method of claim 7, wherein the surface patch comprises at least one of a triangular surface patch and a quadrilateral surface patch, the triangular surface patch being defined for a corresponding triangle of the low-resolution version of the high-resolution mesh, the quadrilateral surface patch being defined for a corresponding bilinear quadrilateral of the low-resolution version of the high-resolution mesh, and each interpolated normal is determined based on at least one of a combination of the normals of the three vertices of the corresponding triangle of the low-resolution version of the high-resolution mesh and a combination of the normals of the four vertices of the corresponding bilinear quadrilateral.
10. The method of claim 7, wherein the number of points on the surface of the surface patch is determined by a factor that reduces the number of at least one of the triangles and the bilinear quadrilaterals from the high-resolution mesh to the low-resolution mesh.
11. The method of claim 7, wherein each offset value is encoded as a distance in one dimension from a point on the surface to the surface of the high-resolution mesh.
12. The method of claim 7, wherein each offset value is determined by projecting a ray along an interpolation normal from a point on the surface and calculating the distance between the point and a corresponding new point on the surface of the high-resolution mesh.
13. The method of claim 12, wherein if this produces a small offset, the ray is projected from a point on the surface along the interpolation normal in a first direction in one dimension, and another ray is projected from the point on the surface along a second direction in one dimension opposite to the first direction.
14. The method of claim 12, wherein the light ray is projected in a first direction in one dimension. In response to the light ray intersecting the surface of the high-resolution mesh, the projection of light rays from the point on the surface is stopped, and In response to the light ray not intersecting the surface of the high-resolution mesh, another light ray is projected from the point on the surface along a second direction in one dimension opposite to the first direction.
15. A processing apparatus for rendering objects in a scene using ray tracing, the processing apparatus comprising: Memory; and Processor, the processor being configured to: Generate a low-resolution version of the high-resolution mesh representing the objects in the scene; Determine the points on the surface of a surface patch defined for either a triangle or a bilinear quadrilateral for a low-resolution mesh; A ray intersection test is performed by projecting rays toward the surface of the high-resolution mesh, the surface of which is approximated from a new point calculated by offset values along the interpolated normal of the point on the surface from the surface patch; and The objects in the scene are rendered based on the light intersection test.
16. The processing apparatus of claim 15, wherein each offset value is the distance from a point on the surface of the surface patch to a new point on the surface of the high-resolution mesh.
17. The processing apparatus according to claim 16, wherein The offset value is stored in the memory before rendering, and The surface of the high-resolution mesh is approximated by moving from the point on the surface of the surface patch along the corresponding interpolated normal until the distance defined by the offset value is reached.
18. The processing apparatus of claim 15, wherein the surface patch comprises at least one of a triangular surface patch and a quadrilateral surface patch, each triangular surface patch being defined for a corresponding triangle of the low-resolution version of the high-resolution mesh, each quadrilateral surface patch being defined for a corresponding bilinear quadrilateral of the low-resolution version of the high-resolution mesh, and each interpolated normal being determined based on at least one of a combination of the normals of the three vertices of the corresponding triangle of the low-resolution version of the high-resolution mesh and a combination of the normals of the four vertices of the corresponding bilinear quadrilateral.
19. The processing apparatus of claim 15, wherein the surface patch comprises at least one of a triangular surface patch and a quadrilateral surface patch, each triangular surface patch being defined for a corresponding triangle of the low-resolution version of the high-resolution mesh, and each quadrilateral surface patch being defined for a corresponding bilinear quadrilateral of the low-resolution version of the high-resolution mesh. The high-resolution mesh includes at least one of a first number of triangles and a first number of bilinear quadrilaterals representing objects in the scene. The low-resolution version of the high-resolution mesh includes at least one of a second number of triangles and a second number of bilinear quadrilaterals representing objects in the scene, and The first number of triangles is greater than the second number of triangles.
20. The processing apparatus of claim 15, further comprising a display device, wherein the object in the scene is rendered for display on the display device.