US-12626449-B2 - Ray tracing of displaced micro meshes using a bounding prism hierarchy
Abstract
Devices and methods for rendering a scene using ray tracing are provided which include prior to ray tracing any frame of the scene: generating, for each frame, a low resolution mesh from a high resolution mesh representing objects in the scene, the low resolution mesh comprising a plurality of micro-meshes each defining a geometric shape; sub-dividing the micro-meshes; and generating, for each micro-mesh, a displaced micro-mesh. For a frame of the scene, at least one displaced micro-mesh is traced using a bounding prism hierarchy on a condition that a prism is hit by the ray. The bounding prism hierarchy comprises the prism bounding the displaced micro-mesh and a plurality of sub-prisms each bounding a portion of the displaced micro-mesh. At least one other displaced micro-mesh is ray traced using the prism without the plurality of sub-prisms on a condition that the prism is not hit by the ray.
Inventors
- Holger Gruen
- David Ronald Oldcorn
- David Kirk McAllister
Assignees
- ADVANCED MICRO DEVICES, INC.
Dates
- Publication Date
- 20260512
- Application Date
- 20231214
Claims (20)
- 1 . A method for rendering a scene using ray tracing, the method comprising: prior to ray tracing a current frame of the scene: generating, for the scene, a low resolution mesh from a high resolution mesh representing objects in the scene, the low resolution mesh comprising a plurality of micro-meshes each defining a geometric shape, and for each of the plurality of micro-meshes of the low resolution mesh generating a displaced micro-mesh by computing, for vertices of a respective micro-mesh, signed displacement values expressed in scene-length units and measured along interpolated normals derived from a triangular curved surface patch constructed from vertex positions and vertex normals of the corresponding geometric shape; and for the current frame of the scene: ray tracing at least one displaced micro-mesh using a bounding prism hierarchy comprising a prism bounding the displaced micro-mesh and a plurality of sub-prisms each bounding a corresponding portion of the displaced micro-mesh, and rendering the frame.
- 2 . The method of claim 1 , further comprising sub-dividing the micro-meshes into sub-divided geometric shapes and sub-dividing the sub-divided geometric shapes into micro-geometric shapes.
- 3 . The method of claim 2 , further comprising, prior to ray tracing the current frame of the scene: interpolating normals of the sub-divided geometric shapes and the micro-geometric shapes using the triangular curved surface patch; computing the signed displacement values for vertices of the respective micro-mesh, measured along the interpolated normals and computed from samples of the high resolution mesh; and displacing the vertices by the signed displacement values.
- 4 . The method of claim 3 , wherein the displaced micro-mesh is generated based on: the interpolated normals of the sub-divided geometric shapes and the micro-geometric shapes, and the signed displacement values of displaced vertices of the respective micro-mesh along the interpolated normals.
- 5 . The method of claim 3 , wherein each of the plurality of sub-prisms is generated based on: minima and maxima of the signed displacement values of a corresponding sub-divided geometric shape; and interpolated normals at vertices of the corresponding sub-divided geometric shape.
- 6 . The method of claim 2 , wherein the geometric shape, the sub-divided geometric shapes and the micro-geometric shapes are triangles or bi-linear quadrangles.
- 7 . The method of claim 1 , wherein: the prism and each sub-prism are computed from minima and maxima of the signed displacement values along the interpolated normals, and at least one face of the prism or of a sub-prism is a bilinear surface, and the prism is generated based on: minima and maxima of the signed displacement values measured along the interpolated normals; and the interpolated normals at vertices of the displaced micro-mesh.
- 8 . The method of claim 7 , further comprising: prior to ray tracing the current frame of the scene, deriving the interpolated normals using the triangular curved surface patch, wherein the prism is also generated based on minima and maxima of signed displacement values determined from the triangular curved surface patch.
- 9 . The method of claim 1 , wherein each portion of the displaced micro-mesh corresponds to one of the sub-divided geometric shapes of the displaced micro-mesh.
- 10 . The method of claim 1 , further comprising ray tracing at least one other displaced micro-mesh using the prism bounding the displaced micro-mesh prior to generating any of the plurality of sub-prisms for that displaced micro-mesh.
- 11 . The method of claim 10 , further comprising: ray tracing each displaced micro-mesh using a bounding volume hierarchy; on a condition that the prism is hit by the ray, generating the bounding prism hierarchy by sub-dividing the prism into the plurality of sub-prisms, and ray tracing the at least one displaced micro-mesh using the bounding prism hierarchy by continuing traversal of the bounding volume hierarchy of the at least one displaced micro-mesh and testing the ray against at least one of the plurality of sub-prisms; and on a condition that the prism is not hit by the ray, continuing to ray trace the at least one other displaced micro-mesh using the prism bounding the displaced micro-mesh without generating any of the plurality of sub-prisms for the at least one displaced micro-mesh.
- 12 . The method of claim 10 , further comprising ray tracing each displaced micro-mesh using a bounding volume hierarchy by: generating, one at a time, sub-prisms of a level of the bounding prism hierarchy and testing for ray-intersection of each sub-prism after recursively generating and testing for ray-intersection of a previous sub-prism of the level and each child sub-prism of the previous sub-prism.
- 13 . The method of claim 10 , further comprising ray tracing each displaced micro-mesh using a bounding volume hierarchy by: determining which second level sub-prism is first intersected by a ray; and determining which other second-level sub-prisms are intersected by the ray based on where the ray leaves a first second-level sub-prism.
- 14 . The method of claim 1 , further comprising: responsive to determining that the prism is intersected by a ray, generating sub-prisms for portions intersected by the ray during traversal and testing the ray against the sub-prisms while traversal continues.
- 15 . A computing device for rendering a scene using ray tracing, the computing device comprising: memory; and an accelerated processor in communication with the memory, configured to: prior to ray tracing a current frame of the scene: generate, for the scene, a low resolution mesh from a high resolution mesh representing objects in the scene, the low resolution mesh comprising a plurality of micro-meshes each defining a geometric shape; and for each of the plurality of micro-meshes of the low resolution mesh generate a displaced micro-mesh by computing, for vertices of a respective micro-mesh, signed displacement values expressed in scene-length units and measured along interpolated normals derived from a triangular curved surface patch constructed from vertex positions and vertex normals of the corresponding geometric shape; and for the current frame of the scene: ray trace at least one of the displaced micro-meshes, each represented by data in the memory, using a bounding prism hierarchy comprising a prism bounding the displaced micro-mesh and a plurality of sub-prisms each bounding a portion of the displaced micro-mesh; and render the frame.
- 16 . The computing device of claim 15 , wherein the accelerated processor is configured to: sub-divide the micro-meshes into sub-divided geometric shapes and to sub-divide the sub-divided geometric shapes into micro-geometric shapes.
- 17 . The computing device of claim 16 , wherein the accelerated processor is configured to, prior to ray tracing the current frame of the scene: interpolate normals of the sub-divided geometric shapes and the micro-geometric shapes; using the triangular curved surface patch; compute signed displacement values expressed in scene-length units and measured along the interpolated normals from samples of the high resolution mesh; and generate the displaced micro-mesh based on: the interpolated normals of the sub-divided geometric shapes and the micro-geometric shapes and signed displacement values of displaced vertices of the micro-mesh along the interpolated normals.
- 18 . The computing device of claim 17 , wherein: the prism and each sub-prism are computed from minima and maxima of the signed displacement values along the interpolated normals, and at least one face of the prism or of a sub-prism is a bilinear surface, and the accelerated processor is configured to generate the prism based on: minima and maxima of the signed displacement values measured along the interpolated normals; and interpolated normals at the vertices of the displaced micro-mesh, such that at least one face of the prism is bilinear.
- 19 . The computing device of claim 18 , wherein the accelerated processor is configured to: prior to ray tracing the current frame of the scene, derive the interpolated normals using the triangular curved surface patch, wherein the prism is also generated based on minima and maxima of signed displacement values determined from the triangular curved surface patch.
- 20 . An accelerated processor for rendering a scene using ray tracing, the accelerated processor comprising: memory; and fixed function hardware circuitry, in communication with the memory, configured to: prior to ray tracing a current frame of the scene: generate, for the scene, a low resolution mesh from a high resolution mesh representing objects in the scene, the low resolution mesh comprising a plurality of micro-meshes each defining a geometric shape, for each of the plurality of micro-meshes of the low resolution mesh, generate a displaced micro-mesh by computing, for vertices of a respective micro-mesh, signed displacement values expressed in scene-length units and measured along interpolated normals derived from a triangular curved surface patch constructed from vertex positions and vertex normals of the corresponding geometric shape; and for the current frame of the scene: ray trace at least one of the displaced micro-meshes using a bounding prism hierarchy comprising a prism bounding the displaced micro-mesh and a plurality of sub-prisms each bounding a portion of the displaced micro-mesh; and render the frame.
Description
BACKGROUND Ray tracing is a type of graphics rendering technique in which simulated rays of light are cast to test for object intersection and pixels are illuminated and colored based on the result of the ray cast. Ray tracing is computationally more expensive than rasterization-based techniques, but produces more physically accurate results. Improvements in ray tracing operations are constantly being made. BRIEF DESCRIPTION OF THE DRAWINGS A more detailed understanding may be had from the following description, given by way of example in conjunction with the accompanying drawings wherein: FIG. 1 is a block diagram of an example device in which one or more features of the disclosure can be implemented; FIG. 2 is a block diagram of the device, illustrating additional details related to execution of processing tasks on the accelerated processing device of FIG. 1, according to an example; FIG. 3 illustrates a ray tracing pipeline for rendering graphics using a ray tracing technique, according to an example; FIG. 4 is an illustration of a bounding volume hierarchy, according to an example; FIG. 5 is a flow diagram illustrating an example method of rendering objects in a scene using ray tracing according to features of the present disclosure; FIG. 6 is an illustration showing an example of sub-dividing a triangle of a low resolution mesh to create micro-triangles according to features of the present disclosure; FIG. 7 is an illustration showing an example of interpolated normals of the triangle and sub-divided micro-triangles shown in FIG. 6; FIG. 8 is an illustration showing an example of generating a displaced micro-mesh according to features of the present disclosure; FIG. 9 is an illustration showing an example of generating a first level bounding prism of a bounding prism hierarchy according to features of the present disclosure; FIG. 10 is an illustration of determining a hierarchy of minimum and maximum displacements according to features of the present disclosure; FIG. 11 is an illustration showing an example of generating sub-prisms of a displaced micro-mesh according to features of the present disclosure; and FIG. 12 is an illustration of a bounding volume hierarchy of the displaced micro-mesh shown in FIG. 11. DETAILED DESCRIPTION As described above, each ray intersection test is complex and expensive in terms of processing resources. Accordingly, accelerated hierarchy structures, such as a bounding volume hierarchy (BVH) are used to implement ray tracing more efficiently to make accurate determinations. While an accelerated hierarchy structure (e.g., a BVH structure) implements ray tracing more efficiently, a large amount of data is often used to represent each primitive (e.g., each node) of the BVH structure and, therefore, a large amount of memory is consumed to implement the BVH structure for ray tracing. In fact, the BVH data used to represent more complex scenes is typically too large to fit into the memory of an accelerated processor (e.g., GPU). Displacement mapping is a graphics rendering technique which adds detail to surface geometry. Displacement mapping includes displacing (e.g., along a surface normal) the geometric positions of points over a surface according to a value generated at each point on the surface. For example, a displaced micro-mesh (e.g., a set of micro-triangles) is a type of displaced surface primitive that is generated from a low resolution version (i.e., having a smaller number of base triangles) of a high resolution mesh (i.e., having a larger number of triangles) representing objects in a scene. One or more displaced micro-triangles are generated using a displacement map in which geometric positions of points over a base triangle are displaced (e.g., along a surface normal) according to values determined at each point on the surface of the base triangle. While displaced micro-meshes provide more depth and detail to surfaces, the additional geometry generated for the micro-meshes (e.g., micro-triangles) increases the overall cost (e.g., increased processing time and memory usage) to perform the ray tracing and render scenes. For example, more time and memory is used to generate each displaced micro-triangle and trace the rays through each of the displaced micro-triangles. Some conventional techniques implement tessellation-free displacement mapping for ray tracing based on advanced interval arithmetic and mipmaps of square displacement textures. However, these conventional techniques are more costly (e.g., complex and require additional hardware to implement). For example, these conventional techniques rely on normalizing interpolated normals before applying displacements along the normals. Features of the present disclosure provide apparatuses and methods for efficiently compressing surface geometry and rendering a scene (e.g., rendering objects in a scene) using ray tracing. Features of the present disclosure perform efficient ray tracing of uncompressed displaced su