CN115115758B - Method, intersection testing device and medium for determining intersection in ray tracing system - Google Patents

Method, intersection testing device and medium for determining intersection in ray tracing system Download PDF

Info

Publication number
CN115115758B
CN115115758B CN202210262491.1A CN202210262491A CN115115758B CN 115115758 B CN115115758 B CN 115115758B CN 202210262491 A CN202210262491 A CN 202210262491A CN 115115758 B CN115115758 B CN 115115758B
Authority
CN
China
Prior art keywords
ray
plane
intersects
backward
dimension
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210262491.1A
Other languages
Chinese (zh)
Other versions
CN115115758A (en
Inventor
G·克拉克
S·芬尼
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Imagination Technologies Ltd
Original Assignee
Imagination Technologies Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Imagination Technologies Ltd filed Critical Imagination Technologies Ltd
Publication of CN115115758A publication Critical patent/CN115115758A/en
Application granted granted Critical
Publication of CN115115758B publication Critical patent/CN115115758B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/06Ray-tracing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/005General purpose rendering architectures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/62Analysis of geometric attributes of area, perimeter, diameter or volume
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2210/00Indexing scheme for image generation or computer graphics
    • G06T2210/12Bounding box
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2210/00Indexing scheme for image generation or computer graphics
    • G06T2210/21Collision detection, intersection

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Graphics (AREA)
  • Geometry (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Analysing Materials By The Use Of Radiation (AREA)

Abstract

The invention relates to a method, an intersection testing device and a medium for determining intersection in a ray tracing system. Methods and intersection test modules are provided for determining whether a ray intersects a 3D axis alignment box in a ray tracing system, with an axis pair Ji Kuang representing a volume defined by a forward plane and a backward plane for each dimension. The forward plane of the identification frame intersects the ray at the furthest location along the ray. A determination is made as to whether the ray intersects the identified forward plane at a location along the ray that is not further than a location along the ray that intersects the backward plane in the subset of dimensions, and this determination is used to determine whether the ray intersects the axis alignment box. The subset of dimensions includes two dimensions for which the forward plane is not identified, but does not include dimensions for which the forward plane has been identified. Without performing a test to determine if the ray intersects the identified forward plane at a location along the ray that is not further than the location along the ray that intersects the backward plane in the dimension in which the forward plane has been identified, it is determined if the ray intersects the box.

Description

Method, intersection testing device and medium for determining intersection in ray tracing system
Technical Field
The present disclosure relates to techniques for performing intersection testing in a ray tracing system.
Background
Ray tracing is a computational rendering technique for generating images of a scene (e.g., a 3D scene) by tracing an optical path ('ray') in the scene, typically from the perspective of the camera. Each ray is modeled as originating from a camera and entering the scene through a pixel. As a ray traverses a scene, it may intersect objects within the scene. The intersection between a ray and its intersecting object can be modeled to create a realistic visual effect. For example, in response to determining that a ray intersects an object, a shader program (i.e., a portion of computer code) may be executed for the intersection. A programmer may write a shader program to define how the system reacts to an intersection (which may, for example, result in one or more secondary rays being emitted into the scene), for example, to represent reflection of a ray from an intersecting object or refraction of a ray through an object (e.g., if the object is transparent or translucent). As another example, the shader program may cause one or more rays to be emitted into the scene for determining whether an object is in a shadow at an intersection. The result of executing the shader program (and processing the associated secondary ray) may be to calculate the color value of the pixel through which the ray passed.
Rendering an image of a scene using ray tracing may involve performing many intersection tests, such as performing billions of intersection tests to render an image of a scene. To reduce the number of intersection tests that need to be performed, the ray tracing system may generate an acceleration structure, where each node of the acceleration structure represents an area within the scene. The acceleration structure is typically hierarchical (e.g., has a tree structure) such that it contains multiple levels of nodes, where nodes near the top of the acceleration structure represent relatively large areas in the scene (e.g., the root node may represent the entire scene), and nodes near the bottom of the acceleration structure represent relatively small areas in the scene. "Tree node" refers to a node having pointers to other nodes in the hierarchical acceleration structure, i.e., a tree node has child nodes in the hierarchical acceleration structure. "leaf node" refers to a node having one or more pointers to one or more primitives, i.e., a leaf node has no child nodes in the hierarchical acceleration structure. In other words, leaf nodes of the acceleration structure represent regions in the scene that define one or more primitives. The acceleration structure may have different structures in different examples, such as a grid structure, an octree structure, a spatial segmentation structure (e.g., k-d tree), or a bounding volume hierarchy. Nodes may represent suitable shapes or regions (which may be referred to herein as "boxes") in a scene. In some examples, the nodes represent Axis Aligned Bounding Boxes (AABBs) in the scene.
An acceleration structure may be used to perform intersection testing of a ray by first testing the ray for intersection with a root node of the acceleration structure (e.g., in a recursive manner). If a ray is found to intersect a parent node (e.g., root node), then the test may proceed to a child node of the parent node. In contrast, if a ray is found not to intersect a parent node, intersection testing of child nodes of the parent node may be avoided, thereby saving computational effort. If a ray is found to intersect a leaf node, the ray may be tested against objects within the region represented by the leaf node to determine which object(s) the ray intersects. If more than one intersection point is found for a ray, the closest intersection point to the ray origin (i.e., the first intersection the ray encounters in the scene) may be identified, and the ray may be determined to intersect at the closest intersection point identified herein. There may be multiple closest hits to the ray, and in this case some tie-break logic may be used to select one of the multiple closest hits to be used as the identified closest intersection. For some types of rays, it may not be necessary to identify the closest intersection point. For example, in processing a shadow ray, an indication of the presence of at least one intersection point is sufficient without determining which intersection point is closest, and some APIs may allow the acceleration structure to terminate traversal of the shadow ray in response to finding any intersection point, thereby reducing the number of intersection tests that need to be performed. The use of acceleration structures (rather than directly testing rays with objects in the scene) reduces the number of intersection tests that need to be performed and simplifies intersection testing. Intersection tests are simpler because the nodes of the acceleration structure represent basic shapes (e.g., axis aligned bounding boxes or spheres), and intersection tests for these basic shapes are simpler than intersection tests for more complex object shapes, e.g., basic shapes are defined in terms of triangle primitives for which alignment with respect to the coordinate system axis is not predetermined.
Ray (r) may be defined as r=o+dt, where O is a vector representing the origin of the ray, D is a vector representing the direction of the ray, and t represents the distance from the origin along the ray. According to one method, a ray may be tested for an axis-aligned box by finding, for each of the x, y and z dimensions, an interval t in which the ray is between two planes representing the sides of the box perpendicular to that dimension. This gives three intervals for the value of t (one for the x-dimension, one for the y-dimension, and one for the z-dimension). If the intersection point of the three intervals (the interval itself) is empty, the ray does not intersect the axis alignment frame; and if the intersection of these three intervals is not null, the ray may intersect the axis-aligned box. This intersection test method involves performing six tests to find three intervals t, and then performing a comparison to determine if the intersection of those intervals is empty.
According to another approach, a ray may be tested from its perspective for the edge of a frame that forms the 2D contour of the frame. If the ray passes inside each contour edge, it is determined that the ray intersects the box, and if the ray passes outside one or more contour edges of the box, it is determined that the ray does not intersect the box. AABB typically has 6 contour edges (depending on the orientation of the AABB from the perspective of the light), so this approach typically requires six tests to be performed.
The above test will determine if an infinitely long line aligned with a ray will intersect the box. However, the length of the light is generally not infinite and the light may have one or more active intervals. For example, a ray may have a certain minimum distance and a certain maximum distance from the ray origin, which may be in accordance with a minimum value of t (known as a minimum culling (culling) distance, t min ) And a maximum value of t (referred to as maximum culling distance, t max ) Is defined. Thus, a minimum distance test may be performed to check that the minimum culling distance is not greater than the maximum intersection distance to the intersection of the ray with the box; and a maximum distance test may be performed to check that the maximum culling distance is not less than the minimum intersection distance to the intersection of the ray with the box. In the first example described above in which intersection intervals are used to determine whether a ray intersects a box, separate minimum and maximum distance tests are not performed, but rather a starting interval may be initialized to represent a distance between t min And t max The range of t values between such that only for values between t min And t max When the t values between the sections are intersected, determining whether any one exists between the sectionsThe result of which intersection point determines that an intersection point exists. Range t min And t max May be included in or excluded from the interval.
Since rays have been performed multiple times for intersection tests of shapes corresponding to nodes of the acceleration structure (e.g., axis alignment boxes), it may be beneficial to implement the functions for performing these intersection tests in dedicated hardware modules, e.g., using fixed function circuitry, rather than using software modules executing on a general-purpose processing unit. Software implementations are generally more flexible because software is easier to change after being designed and/or created than hardware implementations. However, hardware implementations generally provide a more efficient implementation in terms of latency and power consumption, and thus may be preferred over software implementations if the desired functionality is known a priori. When designing hardware implementations of intersection test modules configured for performing intersection tests, there are typically the following competing goals: (i) has a smaller size (i.e., smaller silicon area), (ii) has lower latency, and (iii) has lower power consumption.
Disclosure of Invention
This summary is provided to introduce a selection of concepts in a simplified form that are further described below in the detailed description. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
A method and intersection test module are provided for determining whether a ray intersects a 3D axis alignment box in a ray tracing system, the axis pair Ji Kuang representing a volume defined by a forward plane and a backward plane for each dimension. The forward plane of the box that intersects the ray at a furthest location along the ray is identified. A determination is made as to whether the ray intersects an identified forward plane at a location along the ray that is not further than a location along the ray that intersects the backward plane in a subset of dimensions, and this determination is used to determine whether the ray intersects the axis alignment box. The subset of dimensions includes two dimensions for which the forward plane is not identified, but does not include dimensions for which the forward plane is identified. Determining whether the ray intersects the box without performing a test to determine if the ray intersects the identified forward plane at a location along the ray that is not further than a location along the ray that intersects the backward plane in the dimension in which the forward plane has been identified.
In particular, a method is provided in a ray tracing system for determining whether a ray intersects a three-dimensional axis alignment box, wherein the box represents a volume defined by a forward plane and a backward plane for each dimension of the three-dimensional axis alignment box, the method comprising:
Identifying which of the forward planes of the box intersects the ray at a furthest location along the ray;
determining whether the ray intersects an identified forward plane at a location along the ray that is not further than a location along the ray that intersects the backward plane in a subset of dimensions, wherein the subset of dimensions includes two dimensions for which the forward plane is not identified, but wherein the subset of dimensions does not include dimensions for which the forward plane has been identified; and
determining whether the ray intersects the axis-alignment box using the determination of whether the ray intersects the identified forward plane at a location along the ray that is not further than a location at which the ray intersects the backward plane in the subset of dimensions,
wherein the method determines whether the ray intersects the box without performing a test to determine if a location at which the ray intersects the identified forward plane is not farther along the ray than a location at which the ray intersects the backward plane in the dimension in which the forward plane has been identified.
The step of identifying which of the forward planes of the box intersects the ray at its furthest location along the ray and determining whether the location at which the ray intersects the identified forward plane is not farther along the ray than the location at which the ray intersects the backward plane in the subset of dimensions may be performed without calculating the intersection distance to any of the planes of the box.
The identifying which of the forward planes of the box intersects the ray at a furthest location along the ray may include:
performing a first forward test to determine which of a first forward plane and a second forward plane of the frame the ray intersects at a furthest location along the ray; and
a second forward test is performed to determine which of the determined forward planes and a third forward plane of the box the ray intersects at a furthest location along the ray, thereby identifying which of the forward planes of the box intersects the ray at a furthest location along the ray.
The identifying which of the forward planes of the box intersects the ray at a furthest location along the ray may include:
performing a first forward test to determine which of a first forward plane and a second forward plane of the frame the ray intersects at a furthest location along the ray;
performing a second forward test to determine which of the first and third forward planes of the frame the ray intersects at a furthest location along the ray;
Performing a third forward test to determine which of the second forward plane and the third forward plane of the frame the ray intersects at a furthest location along the ray; and
results of the first, second, and third forward tests are used to identify which of the forward planes of the box intersects the ray at a furthest location along the ray.
The first forward test, the second forward test, and the third forward test may be performed in parallel.
The determining whether the ray intersects the identified forward plane at a location along the ray that is not further than a location at which the ray intersects the backward plane in the subset of dimensions may include:
performing a first hybrid orientation test to determine which of the identified forward plane and a first backward plane of the box the ray intersects at a furthest location along the ray, wherein the first backward plane of the box is a backward plane of a first dimension of the subset of dimensions;
performing a second hybrid orientation test to determine which of the identified forward plane and a second backward plane of the box the ray intersects at a furthest location along the ray, wherein the second backward plane of the box is a backward plane of a second dimension of the subset of dimensions; and
The results of the first and second hybrid-direction tests are used to determine whether a location at which the ray intersects the identified forward plane is no farther along the ray than a location at which the ray intersects the backward plane in the subset of dimensions.
The first mixed-direction test and the second mixed-direction test may be performed in parallel.
The determining whether the ray intersects the identified forward plane at a location along the ray that is not further than a location at which the ray intersects the backward plane in the subset of dimensions may include:
performing a backward test to determine which of a first backward plane and a second backward plane of the box the ray intersects at a closest location along the ray, wherein the first backward plane of the box is a backward plane of a first dimension of the subset of dimensions and the second backward plane of the box is a backward plane of a second dimension of the subset of dimensions;
performing a hybrid orientation test to determine which of the identified forward and determined backward planes of the box the ray intersects at a furthest location along the ray; and
The results of the hybrid orientation test are used to determine whether a location at which the ray intersects the identified forward plane is not farther along the ray than a location at which the ray intersects the backward plane in the subset of dimensions.
The forward test, backward test, or hybrid test for determining which of the first and second planes of the frame the ray intersects at the furthest location along the ray may include comparing P m,i D j And P n,j D i Comparison is made, wherein P m,i Is a constant component value of the first plane in the ith dimension, where P n,j Is a constant component value of the second plane in the j-th dimension, where D i And D j The components of the direction vector of the ray in the i-th and j-th dimensions, respectively, where if P m,i D j >P n,j D i It may be determined that the ray intersects the first plane at a location along the ray that is farther than the location at which the ray intersects the second plane, and if P m,i D j <P n,j D i It may be determined that the ray intersects the second plane at a location along the ray that is farther than the location at which the ray intersects the first plane,
wherein the first plane is: (i) The forward plane of dimension i and having a component value P for the ith dimension 0,i Or (ii) the backward plane of dimension i and has a component value P for the ith dimension 1,i And (2) and
wherein the second plane is: (i) The forward plane of dimension j and has a component value P for the j-th dimension 0,j Or (ii) the backward plane of dimension j and has a component value P for the j-th dimension 1,j
The method may further comprise:
one or more intermediate results stored in the identification of which of the forward planes of the box intersected by the ray at its furthest location along the ray; and
the stored one or more intermediate results are read for use in the determining if the location at which the ray intersects the identified forward plane is no farther along the ray than the location at which the ray intersects the backward plane in the subset of dimensions.
The intermediate result may include a value P 0,i D j And P 0,i D k Wherein the identified forward plane has a component value P for the ith dimension 0,i And wherein D j And D k The components of the direction vector of the ray in the j-th and k-th dimensions, respectively, wherein the subset of dimensions includes the j-th and k-th dimensions but does not include the i-th dimension.
The method may further include determining whether a maximum distance condition is satisfied, wherein the maximum distance condition may be satisfied if a maximum effective distance of the ray from a ray origin is greater than or equal to a minimum distance from the ray origin to any intersection of the ray with a point within the box,
wherein the determining whether the ray intersects the axis alignment box may also include using the determination of whether the maximum distance condition is met.
The determining whether the maximum distance condition is met may include determining whether P 0,i ≤D i t max Wherein the identified forward plane has a component value P for the ith dimension 0,i Wherein D is i Is the component of the direction vector of the ray in the ith dimension, and wherein t max Is a parameter defining the maximum effective distance of the ray from the ray origin.
The method may further include determining whether a minimum distance condition is satisfied, wherein the minimum distance condition may be satisfied if a minimum effective distance of the ray from the ray origin is less than or equal to a maximum distance from the ray origin to any intersection of the ray with a point within the box,
wherein the determining whether the ray intersects the axis alignment box may also include using the determination of whether the minimum distance condition is met.
The determination of whether the minimum distance is satisfiedThe off-conditions may include: determining whether or not to P 1,i ≥D i t min ,P 1,j ≥D j t min And P is 1,k ≥D k t min Wherein the backward plane of dimension i has a component value P 1,i The backward plane of dimension j has a component value P 1,j The backward plane of dimension k has a component value P 1,k Wherein D is i 、D j And D k The components of the direction vector of the ray in the ith, jth and kth dimensions, respectively, and wherein t min Is a parameter defining the minimum effective distance of the ray from the ray origin.
The determining whether a maximum distance condition is met and the determining whether a minimum distance condition is met may be performed in parallel with the determining whether the ray intersects the identified forward plane along a location where the ray intersects the backward plane in a subset of dimensions no farther than the ray.
There is provided a method of determining whether a ray intersects a three-dimensional axis-aligned box in a ray tracing system, wherein the box represents a volume defined by a forward plane and a backward plane of each dimension of the three-dimensional axis-aligned box, the method comprising:
identifying which of the backward planes of the box intersects the ray at a closest location along the ray;
Determining whether the ray intersects the forward plane in a subset of dimensions that includes two dimensions for which the backward plane is not identified, but wherein the subset of dimensions does not include dimensions for which the backward plane has been identified, along the ray no farther than the ray intersects an identified backward plane; and
determining whether the ray intersects the axis alignment box using the determination of whether the ray intersects the forward plane in the subset of dimensions at a location along the ray that is not further than a location at which the ray intersects the identified backward plane,
wherein the method determines whether the ray intersects the box without performing a test to determine if a location of the ray intersecting the forward plane in the dimension where the backward plane has been identified is not farther along the ray than a location of the ray intersecting the identified backward plane.
The identifying which of the backward planes of the box intersects the ray at a closest location along the ray may include:
performing a first backward test to determine which of a first backward plane and a second backward plane of the frame the ray intersects at a closest location along the ray; and
A second backward test is performed to determine which of the determined backward planes and a third backward plane of the box the ray intersects at a closest location along the ray, thereby identifying which of the backward planes of the box intersects the ray at a closest location along the ray.
The identifying which of the backward planes of the box intersects the ray at a closest location along the ray may include:
performing a first backward test to determine which of a first backward plane and a second backward plane of the frame the ray intersects at a closest location along the ray;
performing a second backward test to determine which of the first backward plane and a third backward plane of the frame the ray intersects at a closest location along the ray;
performing a third backward test to determine which of the second backward plane and the third backward plane of the frame the ray intersects at a closest location along the ray; and
results of the first, second, and third backward tests are used to identify which of the backward planes of the box intersects the ray at a closest location along the ray.
The determining whether the ray intersects the forward plane in the subset of dimensions at a location along the ray that is not further than a location at which the ray intersects the identified backward plane may include:
performing a first hybrid orientation test to determine which of the identified backward plane and a first forward plane of the box the ray intersects at a furthest location along the ray, wherein the first forward plane of the box is a forward plane of a first dimension of the subset of dimensions;
performing a second hybrid orientation test to determine which of the identified backward plane and a second forward plane of the box the ray intersects at a furthest location along the ray, wherein the second forward plane of the box is a forward plane of a second dimension of the subset of dimensions; and
the results of the first and second hybrid-direction tests are used to determine whether the ray intersects the forward plane in the subset of dimensions at a location along the ray that is no farther than the location at which the ray intersects the identified backward plane.
The determining whether the ray intersects the forward plane in the subset of dimensions at a location along the ray that is not further than a location at which the ray intersects the identified backward plane may include:
Performing a forward test to determine which of a first forward plane and a second forward plane of the box the ray intersects at a furthest location along the ray, wherein the first forward plane of the box is a forward plane of a first dimension of the subset of dimensions and the second forward plane of the box is a forward plane of a second dimension of the subset of dimensions;
performing a hybrid orientation test to determine which of the identified backward plane and the determined forward plane of the box the ray intersects at a furthest location along the ray; and
the results of the hybrid orientation test are used to determine whether a location at which the ray intersects the forward plane in the subset of dimensions is not farther along the ray than a location at which the ray intersects the identified backward plane.
The method may further include selectively reversing the axes of the light rays and the components of the axis alignment box such that D i ≥0,D j Not less than 0 and D k 0, then identifying which of the forward planes of the box intersects the ray at the furthest location along the ray, where D i 、D j And D k The components of the direction vector of the ray in the i-th, j-th and k-th dimensions, respectively.
The method may also include subtracting respective components of an origin of the ray from respective components defining the positions of the forward plane and the backward plane of the box.
The determination of whether the ray intersects the axis-aligned box may be performed conservatively by rounding the value determined for the forward plane toward- + -infinity and rounding the value determined for the backward plane toward + -infinity, such that in the event that a fully accurate determination would otherwise determine that the ray intersects the axis-aligned box, errors introduced by rounding during the determination would not determine that the ray does not intersect the axis-aligned box.
The method may also include outputting an indication of a result of the determination of whether the ray intersects the axis-aligned box, wherein the outputted indication may be used in the ray tracing system to render an image of a 3D scene.
The axis alignment box may be an axis alignment bounding box that defines the geometry to be rendered, and the axis alignment box may correspond to a node of a hierarchical acceleration structure to be used for performing intersection testing in a ray tracing system.
The nodes may be part of an underlying acceleration structure (BLAS) for representing geometry in an example space, and the method may include transforming the rays into the example space.
An intersection test module for use in a ray tracing system is provided, configured to determine whether a ray intersects a three-dimensional axis alignment box, wherein the box represents a volume defined by a forward plane and a backward plane of each dimension of the three-dimensional axis alignment box, the intersection test module configured to:
identifying which of the forward planes of the box intersects the ray at a furthest location along the ray;
determining whether the ray intersects an identified forward plane at a location along the ray that is not further than a location along the ray that intersects the backward plane in a subset of dimensions, wherein the subset of dimensions includes two dimensions for which the forward plane is not identified, but wherein the subset of dimensions does not include dimensions for which the forward plane has been identified; and
determining whether the ray intersects the axis-alignment box using the determination of whether the ray intersects the identified forward plane at a location along the ray that is not further than a location at which the ray intersects the backward plane in the subset of dimensions,
wherein the intersection test module is configured to determine whether the ray intersects the box without performing a test to determine if a location at which the ray intersects the identified forward plane is not farther along the ray than a location at which the ray intersects the backward plane in the dimension in which the forward plane has been identified.
An intersection test module for use in a ray tracing system is provided, configured to determine whether a ray intersects a three-dimensional axis alignment box, wherein the box represents a volume defined by a forward plane and a backward plane of each dimension of the three-dimensional axis alignment box, the intersection test module configured to:
identifying which of the backward planes of the box intersects the ray at a closest location along the ray;
determining whether the ray intersects the forward plane in a subset of dimensions that includes two dimensions for which the backward plane is not identified, but wherein the subset of dimensions does not include dimensions for which the backward plane has been identified, along the ray no farther than the ray intersects an identified backward plane; and
determining whether the ray intersects the axis alignment box using the determination of whether the ray intersects the forward plane in the subset of dimensions at a location along the ray that is not further than a location at which the ray intersects the identified backward plane,
wherein the intersection test module is configured to determine whether the ray intersects the box without performing a test to determine if a location of the ray intersecting the forward plane in the dimension in which the backward plane has been identified is no farther along the ray than a location of the ray intersecting the identified backward plane.
An intersection testing module is provided that is configured to perform any of the methods described herein.
The intersection test module may be embodied in hardware on an integrated circuit. A method of manufacturing an intersection test module at an integrated circuit manufacturing system may be provided. An integrated circuit definition data set may be provided that, when processed in an integrated circuit manufacturing system, configures the system to manufacture intersection test modules. A non-transitory computer-readable storage medium may be provided having stored thereon a computer-readable description of an intersection test module that, when processed in an integrated circuit manufacturing system, causes the integrated circuit manufacturing system to manufacture an integrated circuit embodying the intersection test module.
An integrated circuit manufacturing system may be provided, comprising: a non-transitory computer-readable storage medium having stored thereon a computer-readable description of the intersection test module; a layout processing system configured to process the computer-readable description to generate a circuit layout description of the integrated circuit embodying the intersection test module; and an integrated circuit generation system configured to fabricate the intersection test module from the circuit layout description.
Computer program code for performing any of the methods described herein may be provided. A non-transitory computer readable storage medium having stored thereon computer readable instructions that when executed at a computer system cause the computer system to perform any of the methods described herein may be provided.
As will be apparent to those skilled in the art, the above features may be suitably combined, and may be combined with any of the aspects of the examples described herein.
Drawings
Examples will now be described in detail with reference to the accompanying drawings, in which:
FIG. 1 illustrates a ray tracing system according to examples described herein;
FIG. 2a shows two rays and a box from a first perspective;
FIG. 2b shows a ray and a box from a second view, where the second view is at the ray origin;
FIG. 3 is a flow chart of a first method of performing an intersection test to determine whether a ray intersects a 3D axis alignment box according to examples described herein;
FIGS. 4 a-4 j illustrate tests performed during a first method of performing an intersection test to determine whether a ray intersects a 3D axis alignment box;
FIG. 5a shows a ray and box with the ray's origin exceeding the box;
FIG. 5b shows the ray and box with the end of the ray in front of the box;
FIG. 5c shows a ray and frame with the origin of the ray in front of the frame and the end of the ray beyond the frame;
FIG. 6 is a flow chart of a second method of performing an intersection test to determine whether a ray intersects a 3D axis alignment box according to examples described herein;
FIGS. 7a through 7j illustrate tests performed during a second method of performing an intersection test to determine whether a ray intersects a 3D axis alignment box;
FIG. 8 illustrates a computer system in which a ray tracing system is implemented; and is also provided with
FIG. 9 illustrates an integrated circuit manufacturing system for generating an integrated circuit embodying a ray tracing system.
The figures illustrate various examples. The skilled artisan will appreciate that the element boundaries (e.g., boxes, groups of boxes, or other shapes) shown in the figures represent one example of the boundaries. In some examples, it may be the case that one element may be designed as multiple elements, or that multiple elements may be designed as one element. Where appropriate, common reference numerals have been used throughout the various figures to indicate like features.
Detailed Description
The following description is presented by way of example to enable a person skilled in the art to make and use the invention. The invention is not limited to the embodiments described herein and various modifications to the disclosed embodiments will be apparent to those skilled in the art.
Embodiments will now be described by way of example only.
Even with the use of acceleration structures, the effort involved in performing intersection tests in ray tracing systems is still significant. For example, ray tracing may be used to render images of 3D scenes, where the images may have approximately one million pixels. The ray may be traced once for each sample location. In some examples, there may be one sample position per pixel position, while in some other examples, there may be multiple sample positions per pixel position (e.g., to allow a process such as supersampling antialiasing (SSAA) to be performed in rendering the final pixel value). When a ray intersects an object in a scene, a shader may be executed that may cause another ray (i.e., a "secondary ray") to be emitted into the scene. Each primary ray may cause the emission of several secondary rays that all pass through the scene tracking to determine their intersection. It is therefore not uncommon for tens or hundreds of millions of rays to be traced through a scene to render an image. As graphics rendering technology evolves, the scene to be rendered becomes more and more complex, so it is not uncommon for thousands of objects to be present in a scene, each of which can be represented by many primitives. Further, the image being rendered may represent frames of a sequence of frames to be rendered in real-time, e.g., for display to a user in real-time. For example, a user may be playing a game, where the rendered image represents a 3D scene view of the user as the user plays the game. To make a series of frames appear as a continuous stream of video data, several frames may be rendered per second, such as 24, 30 or 60 frames per second, as some examples. Thus, it can be appreciated that the effort involved in performing intersection tests to render a scene to be output in real-time in a ray tracing system is significant.
One way to overcome this problem and perform ray tracing to render the scene to be output in real time is to have one or more supercomputers perform all the processing. This can be considered a "brute force" approach. However, in addition to targets with high performance (performing ray tracing to render a scene to be output in real time), there are competing targets that shrink the size (e.g., silicon area) and power consumption of ray tracing systems. For example, there may be a goal of implementing a ray tracing system on a mobile device such as a tablet computer or smart phone, which may be much lower in acceptable size and power consumption than a supercomputer. Thus, when designing a ray tracing system, there may be a tradeoff between performance, power consumption, and area. Depending on how this tradeoff is implemented, the examples described herein may allow for improved performance without significantly increasing power consumption and area (as compared to the prior art described above in the background section). Alternatively, in various embodiments of the trade-offs, examples described herein may allow for reducing the power consumption and/or size of the ray tracing system without significantly reducing the performance of the ray tracing system (as compared to the prior art described above in the background section). Different embodiments may be designed to address different points in the trade-off between performance, power consumption and silicon area.
As described above, the intersection of a test ray with an Axis Aligned Bounding Box (AABB) corresponding to a node of an acceleration structure is an extremely frequent operation in ray tracing systems. In particular, intersection tests of rays with bounding volumes (i.e., determining whether a ray intersects an axis-aligned box) typically consider most intersection tests performed to render an image of a scene using ray tracing. Thus, any optimization that may be made on the manner in which intersection tests are performed may be very useful for optimizing a ray tracing system in terms of reducing latency, power consumption, and physical size of the ray tracing system.
In two examples given in the background section, six tests (plus minimum and maximum distance tests) were performed to determine if a ray intersected an axis alignment box. However, according to the examples described herein, the number of tests that need to be performed to determine whether a ray intersects an axis alignment box is reduced. Specifically, in the primary examples described herein, the number of tests is reduced to four or five (plus the minimum and maximum distance tests). Furthermore, in some cases, as described below with reference to fig. 4c, 4f, 4g and 4j, one of these tests may be unnecessary, in which case the number of tests may be further reduced to three or four (plus the minimum and maximum distance tests). This can be achieved by exploiting the fact that: unlike a general object, which may not have a correlation between planes/faces defining the object, the planes of AABB are obviously arranged in parallel pairs, such that for each dimension, AABB has a forward plane and a parallel backward plane. For a pair of parallel planes of an AABB, the forward (FF) plane is the plane that the ray will intersect first, and the Backward (BF) plane is the plane that the ray will intersect second. If a ray intersects a frame, the ray will enter the frame through the forward plane and will exit the frame through the backward plane. The number of tests that need to be performed to determine whether a ray intersects an axis-aligned frame may be reduced by utilizing the organization of the planes of the axis-aligned frames. Reducing the number of tests that need to be performed to determine whether a ray intersects an axis alignment box may reduce the latency, size, and/or power consumption of intersection test modules in a ray tracing system.
Fig. 1 shows a ray tracing system 100 comprising a ray tracing unit 102 and a memory 104. Ray tracing unit 102 includes a processing module 106, an intersection test module 108, and processing logic 110. Intersection test module 108 includes one or more box intersection test units 112, one or more triangle intersection test units 114, and a ray adjustment unit 116. In operation, ray traced unit 102 receives geometric data defining objects within a 3D scene. Ray tracing unit 102 also receives ray data defining rays of the intersection to be tested. The light may be primary or secondary. The processing module 106 is configured to generate an acceleration structure based on the geometric data and send the acceleration structure to the memory 104 for storage therein. After the acceleration structure has been stored in the memory 104, the intersection test module 108 can retrieve nodes of the acceleration structure (including data defining an axis alignment box corresponding to the nodes) from the memory 104 to perform ray intersection tests for the retrieved nodes. To avoid reading the entire acceleration structure at a time, the intersection test module 108 retrieves a subset of the boxes from a layer of acceleration structure from the memory 104 at each stage based on the results of previous intersection tests. The box intersection test unit 112 performs an intersection test to determine whether a ray intersects each of the bounding boxes corresponding to the nodes of the acceleration structure (where a large piece of hierarchical acceleration structure may be culled by a miss). If the leaf nodes intersect, the triangle intersection test unit 114 performs one or more triangle intersection tests to determine which object(s), if any, the ray intersects. The result of the intersection test indicates which object in the scene the ray intersects, and the result may also indicate where on the object the ray intersects the object, and may also indicate the distance along which the ray intersects. The results of the intersection test are provided to the processing logic 110. Processing logic 110 is configured to process the results of the intersection test to determine rendering values for images representing the 3D scene. The rendering values determined by processing logic 110 may be returned to memory 104 for storage therein to represent an image of the 3D scene.
Fig. 2a shows two rays 202 and 214 and a box 204 from a first perspective. As described above, rays 202 and 214, i.e., r (t), may be represented as r (t) =o+dt, where O is a vector representing the origin of the ray, and D is the direction vector of the ray, where o= (O x ,O y ,O z ) And d= (D x ,D y ,D z ). Fig. 2a and 2b show the x, y and z basis vectors of the coordinate system. In this example, both rays 202 and 214 have the same origin, and the origin of the coordinate system is at the ray origin. This can be accomplished by subtracting the ray origin to translate the ray origin and the position of the box. Block 204 is an axis alignment block relative to the x, y, and z basis vectors of the coordinate system. The coordinate system may be in the process ofThe world space coordinate system of the rendered scene, or the coordinate system may be an example space coordinate system of an example of a set of geometries within the scene being rendered. The corner 206 of the frame 204 is in position (x min ,y min ,z min ) And the opposite corner 208 of the frame is in position (x max ,y max ,z max ). Box 204 represents a volume defined by a forward plane and a backward plane of each dimension of the three-dimensional axis alignment box. Specifically, for the x dimension, there is: (i) A forward plane (containing corner points 206, 216, 218, and 222) having a normal parallel to the x-axis and pointing toward a negative x-value, wherein any point on the forward plane in the x-dimension has an x-component value x min The method comprises the steps of carrying out a first treatment on the surface of the And (ii) a backward plane (containing corner points 208, 220, 224, and 226) having a normal parallel to the x-axis and pointing toward a positive x-value, wherein any point on the backward plane in the x-dimension has an x-component value x max . For the y dimension, there is: (i) A forward plane (containing corner points 206, 222, 224, and 226) having a normal parallel to the y-axis and pointing toward a negative y-value, wherein any point on the forward plane in the y-dimension has a y-component value y min The method comprises the steps of carrying out a first treatment on the surface of the And (ii) a backward plane (containing corner points 208, 216, 218, and 220) having a normal parallel to the y-axis and pointing toward a positive y-value, wherein any point on the backward plane in the y-dimension has a y-component value y max . For the z dimension, there is: (i) A forward plane (containing corner points 206, 218, 220, and 224) having a normal parallel to the z-axis and pointing toward a negative z-value, wherein any point on the forward plane in the z-dimension has a z-component value z min The method comprises the steps of carrying out a first treatment on the surface of the And (ii) a backward plane (containing corner points 208, 216, 222, and 226) having a normal parallel to the z-axis and pointing at a positive z-value, wherein any point on the backward plane of the z-dimension has a z-component value z max . In the example shown in FIG. 2a, the rays 202 and 214 and the box 204 are all in the positive diagram of the coordinate system, i.e., the direction vector of the rays 202 and 214 has positive values for all of their component values, and x min 、y min 、z min 、x max 、y max And z max Are positive.
Fig. 2b shows rays 202 and 214 and box 204 from a second view, where the second view is at the ray origin. Since the view angle of FIG. 2b is the origin of rays 202 and 214, the rays appear as dots only. Fig. 2b shows the x, y and z axes. In fig. 2a and 2b, the corners of the box 204 are labeled consistently 206, 208, 216, 218, 220, 222, 224, and 226 to aid in understanding how the box 204 is viewed in both figures.
Ray 202 intersects box 204. Specifically, ray 202 intersects the plane of the box at locations 210 and 212. In fig. 2b, the intersection points 210 and 212 are at the same projected position as the ray 202. Ray 202 enters box 204 at a position 210 on the forward plane of box 204 in the z dimension, which has a constant z component value z min . Ray 202 exits box 204 at position 212 on the backward plane of box 204 in the y dimension, which has a constant y component value y max . Ray 214 does not intersect box 204.
FIG. 3 is a flow chart of a method of performing an intersection test to determine if a ray 202 intersects a 3D axis alignment box 204. Although the following description refers to testing whether the ray 202 intersects the box 204, the same method may be applied to test whether the ray 214 intersects the box 204.
In step S302, data defining the ray 202 and the box 204 is obtained at the intersection test module 108. Specifically, data defining components of the origin of the ray and the direction of the ray are obtained. The data defining the origin of the ray may be three components O of the origin position of the ray x 、O y And O z . The data defining the direction of the light may include three components D of the direction of the light x 、D y And D z . Alternatively, some different values defining the direction of the light may have been pre-calculated and stored in the storage means, so that in step S302 the pre-calculated values may be read. For example, three values may be read to define the light direction data, and the three values may beAnd->In other examples, different pre-calculated values may be read to define lightLine direction, e.g. the value +.>And D z Or can read the value +.>And sgn (D) z ). Note that for the value f, sgn (f) = +1 if f is positive, and sgn (f) = -1 if f is negative. In other examples, other values may be pre-calculated and read to define the direction of the light. The data defining the frame may be data defining a position of a plane representing the frame, for example, a constant component value for each of a forward plane and a backward plane in each of three dimensions.
In step S304, the intersection test module 108 subtracts the respective components of the ray origin from the respective components defining the positions of the forward plane and the backward plane of the box. Step S304 may be described as performing a translation on ray 202 and box 204 such that the origin of the coordinate system is at the origin of ray 202. Starting from this point in the method described with reference to fig. 3, the origin of the ray is the origin of the coordinate system, i.e. at position (0, 0).
In step S306, the intersection test module 108 (e.g., the ray adjustment unit 116) selectively inverts the axes of the components of the ray and the box such that D x ≥0,D y Not less than 0 and D z And is more than or equal to 0. In the method described with reference to FIG. 3, zero, one or more of the axes are selectively reversed such that the direction of light enters a lens having a positive D x 、D y And D z The trigrams of (B). The "inversion" of an axis may be referred to as "reflection", "reversal" or "negation" and may involve changing the sign of all component values in a dimension along the axis in question. The data defining the ray includes a ray origin and a ray direction, and the data defining the box includes values representing the position of the plane in each dimension. It should be noted that reversing an odd number of axes reverses the orientation of the geometry. In some examples, step S306 may also include the intersection test module 108 selectively arranging (e.g., by the ray adjustment unit 116) (i.e., Rearranged) shaft. The arrangement of axes includes rotation of three axes, transposition or identity of two axes (i.e., without changing axes). For example, the axes may be arranged such that the principal component of the light direction is D z (i.e., ensure |D) z |≥|D x I and I D z |≥|D y |) is provided. However, in the example described with reference to fig. 3, the arrangement is not necessary. At the end of step S306, the intersection test module 108 has determined a value x min 、y min 、z min 、x max 、y max And z max . Value x min 、y min 、z min 、x max 、y max And z max Representing the displacement of the forward and backward planes of the axis-aligned box in each dimension relative to the ray origin.
FIGS. 2a and 2b show the axes of the ray and box translated and optionally inverted in steps S304 and S306 so that the origin of the coordinate system is at the ray origin and so that D x ≥0,D y Not less than 0 and D z Ray 202 and box 204 after ≡0.
Unlike a general object, which may not have a correlation between planes/faces defining the object, planes defining the faces of an axis-aligned bounding box (AABB) are arranged in parallel pairs such that for each dimension, the AABB has a forward plane and a parallel backward plane. As described above, the axes are selectively reversed such that the ray direction vectors point into the trigrams of the spatial coordinate system, which have positive values for x, y and z, i.e., D x ≥0,D y Not less than 0 and D z > 0. Thus, the forward plane of the shaft has a lower constant component value along the shaft than the rearward plane of the shaft. For a pair of parallel planes of AABB, the forward (FF) plane is the plane that the ray will first intersect (when viewed from- ≡along the ray direction) and the Backward (BF) plane is the plane that the ray will second intersect (when viewed from-factalong the ray direction). If the ray intersects the box 204 (where all x' s min 、y min 、z min 、x max 、y max And z max Positive), the ray will enter the box through the forward plane and will exit the box through the backward plane.This is summarized in that if the box is placed behind the ray origin (such that an intersection can occur for negative t), then the forward plane intersects the ray at a lower (negative maximum) t value, while the backward plane intersects the ray at a higher (negative minimum) t value. It should also be noted that if the ray is directed parallel to any pair of planes (i.e., if D x 、D y And D z Zero), the ray will intersect at most one of the pair of planes, whereas if the ray is not parallel to the pair of planes, there is a unique entry point and exit point for the (infinite) volume, defined by the forward and backward planes of the pair of planes, respectively.
In step S308, the intersection test module 108 (specifically, the one or more box intersection test units 112) identifies which of the forward planes of boxes intersects the ray at the furthest location along the ray. As described above, for each dimension, the box 204 has a forward plane and a backward plane. The ray will intersect the forward plane of the dimension before intersecting the backward plane of the dimension (unless the ray is parallel to an axis, as described in more detail below). Since the axes are selectively inverted in step S306 so that the light rays are directed into the positive trigrams of the spatial coordinate system defined by the x, y and z axes, the forward plane of the dimension will have the smallest component value of that dimension (e.g., x min 、y min Or z min ) And the backward plane of the dimension will have the largest component value of that dimension (e.g., x max 、y max Or z max ). If the ray origin is located outside the frame and if the ray enters and exits the frame, the ray enters the frame through the forward plane and the ray exits the frame through the backward plane. Specifically, if a ray enters and exits the box, the ray enters the box through the forward plane (of the three forward planes of the box) that intersects the ray at the furthest location along the ray, and the ray exits the box through the backward plane (of the three backward planes) that intersects the ray at the closest location along the ray. In the case of a tie, the ray enters (or leaves) a box on multiple forward (or backward) planes on the corner (if all faces are tied) or on the edge (if both faces are tied). The phrase "is used herein" The phrase "at the farthest position along the ray" is understood to mean "at the point having the largest t value" (in ray equation r (t) =o+dt), and the phrase "at the nearest position along the ray" is understood herein to mean "at the point having the smallest t value" (in ray equation r (t) =o+dt). Thus, in the examples described herein, the phrases "furthest along … …" and "closest along … …" refer to the ray direction vector, and not to "furthest from the ray origin" or "closest to the ray origin.
Two example methods for identifying which of the forward planes of the box intersects the ray at the furthest location along the ray in step S308 are described in detail below. In the examples described below, we mention the i, j, and k dimensions, which may correspond to the x, y, and z dimensions of the coordinate system in any order or arrangement.
For identifying which of the forward planes of the frame is furthest along the ray from the ray in step S308 First method of intersection
In the first method for performing step S308 described herein, step S308 includes: (i) Performing a first forward test to determine which of the first forward plane and the second forward plane of the frame the ray intersects at a furthest location along the ray; and (ii) performing a second forward test to determine which of the determined forward planes and the third forward plane of the box the ray intersects at a furthest location along the ray, thereby identifying which of the forward planes of the box intersects the ray at a furthest location along the ray. In this method, two tests are performed sequentially. The second test uses the results of the first test.
As described above, the point on ray 202 is given by: o+dt, where O is the origin of the ray, D is the direction of the ray, and t represents the distance from the origin along the ray. Because of step S304, the components of the remapped ray origin are all zero. The component of the ray direction vector is D i 、D j And D k Wherein i, j and k correspond to the x, y and z dimensions in any order, as described above. If t 1 <t 2 Then the light will be at the same position Dt 2 Before crossing with position Dt 1 And (5) intersecting. When the value of the parameter t is such that D i t=F i (wherein F) i A component value of the i-th dimension, the component value being constant over the forward plane of dimension i), the ray will intersect the forward plane of dimension i; and when the value of the parameter t is such that D j t=F j (wherein F) j Is the component value of the j-th dimension, which is constant over the forward plane of dimension j), the ray will intersect the forward plane of dimension j. F depending on the manner in which the ith and jth dimensions correspond to the x, y or z dimensions, respectively i And F j The values will each be x min 、y min And z min One of which is a metal alloy. Thus, ifThe ray will intersect the forward plane of dimension i before intersecting the forward plane of dimension j. However, the cost of performing a division operation is typically higher (in terms of delay, silicon area, and/or power consumption) than performing a multiplication operation, so the method can perform a comparison to compare the value F i D j And F is equal to j D i A comparison is made instead of performing a comparison to compare the value +.>And->A comparison is made. In this way, the operations are cross-multiplied, so that there is no need to perform a division operation in the comparison. If F i D j <F j D i Determining that the ray intersects the forward plane j at a location along the ray that is farther than the location at which the ray intersects the forward plane i, and if F i D j >F j D i It is determined that the ray intersects the forward plane i at a location along the ray that is farther than the location at which the ray intersects the forward plane j. This comparison involves performing two multiplication operations and comparing the results of the two multiplication operations. Note that if F i D j =F j D i The ray actually intersects the edge where the planes meet. In this case, it is also effective to select either plane as "farther" and the selection does not affect the effectiveness of the test procedure, so any one of the forward planes can be selected. The multiplication and comparison operations are less costly to implement in hardware than division or subtraction operations, e.g., the multiplication and comparison operations may be implemented in hardware having a smaller silicon area (e.g., fixed function circuitry). Division and subtraction operations that produce floating point results are relatively costly to implement in hardware (e.g., in terms of silicon area). Thus, multiplication and comparison operations are performed to determine whether F i D j >F j D i Is less costly to implement (e.g., in terms of silicon area) than to implement division and comparison operations to determine whether +.>Or performs multiplication and subtraction operations to determine whether F i D j -F j D i > 0. It should be noted that the coordinate system has been adjusted such that D i And D j The value ∈0 (and the special case of d=0 will be covered later) so that the comparison operator "need not be changed"<"and/or">"to accommodate D i And D j Is a negative value of the probability of (c).
FIGS. 4a and 4b illustrate a method for determining whether F is i D j >F j D i Is a first forward test of (c). Specifically, fig. 4a and 4b illustrate an axis alignment box 402 having three forward planes and three backward planes from the perspective of the ray origin (similar to fig. 2 b). Edge 404 defines a line (shown as a dashed line) where the forward planes of the i-th and j-th dimensions intersect. In the process for determining whether F i D j >F j D i After the first forward test of (a), it is known on which side of the line defined by edge 404 the ray passes. Thus, this comparison may be considered an edge test on edge 404. This comparison can also be considered as a test of which of the two forward planes (of dimensions i and j) intersects the ray at the furthest location along the ray. Lines defined by edges 404Is due to the determination of whether F i D j >F j D i So as to know the area where the light ray does not intersect. In other words, it is determined whether F i D j >F j D i It may be determined that the ray passes somewhere in the non-dashed area to the other side of the line defined by edge 404. FIG. 4a shows the case where the ray passes to the right of the line defined by edge 404, F i D j >F j D i Such that the forward plane of dimension i intersects the ray at a location along the ray that is farther than the location at which the forward plane of dimension j intersects the ray. In contrast, FIG. 4b shows the case where the ray passes through the left side of the line defined by edge 404, F i D j <F j D i Such that the forward plane of dimension j intersects the ray at a location along the ray that is farther than the location along dimension i at which the forward plane intersects the ray. As mentioned above, if F i D j =F j D i Either of the forward planes of dimensions i and j can be selected. For example, if a ray intersects a line defined by edge 404, the ray may be considered to be in two non-dashed areas as shown in fig. 4a and 4 b.
In a second forward test, a forward plane that intersects the ray at a furthest location along the ray has been determined in the first forward test for the remaining forward plane tests to determine which of the forward planes of the box intersects the ray at the furthest location along the ray. For example, if it has been determined that the forward plane of dimension i intersects the ray at a location along the ray that is farther than the location along the forward plane of dimension j (i.e., in the case shown in FIG. 4 a), then the second forward test includes determining whether F i D k >F k D i As shown in fig. 4c and 4 d. Edge 406 defines a line (shown as a dashed line) where the forward planes of the i-th and k-th dimensions intersect. In the process for determining whether F i D k >F k D i After the second forward test of (a), it is known on which side of the line defined by edge 406 the ray passes. Thus, this comparison may be considered an edge test on edge 406. This comparison can also be regarded as (dimensionA test of which of the two forward planes of degrees i and k intersects the ray at the furthest position along the ray. The dashed area on one side of the line defined by edge 406 represents the result of determining whether F i D k >F k D i So as to know the area where the light ray does not intersect. In other words, it is determined whether F i D k >F k D i It may be determined that the ray passes somewhere in the non-dashed area to the other side of the line defined by edge 406. FIG. 4c shows the light passing below the line defined by edge 406, F i D k <f k D i Such that the forward plane of dimension k intersects the ray at a location along the ray that is farther than the location along dimension i at which the forward plane intersects the ray. Thus, in the case shown in fig. 4c, step S308 identifies the forward plane of dimension k. In contrast, FIG. 4d shows the case where the ray passes over the line defined by edge 406, F i D k >F k D i Such that the forward plane of dimension i intersects the ray at a location along the ray that is farther than the location along the forward plane of dimension k that intersects the ray. Thus, in the case shown in fig. 4d, step S308 identifies the forward plane of dimension i. As mentioned above, if F i D k =F k D i Either of the forward planes of dimensions i and k can be selected.
If it has been determined that the forward plane of dimension j intersects the ray at a location along the ray that is farther than the location along the forward plane of dimension i (i.e., in the case shown in FIG. 4 b), then a second forward test includes determining whether F j D k >F k D j As shown in fig. 4e and 4 f. Edge 408 defines a line (shown as a dashed line) where forward planes of the j-th and k-th dimensions intersect. In the process for determining whether F j D k >F k D j After the second forward test of (a), it is known on which side of the line defined by edge 408 the ray passes. Thus, this comparison may be considered an edge test on edge 408. This comparison can also be considered as a test of which of the two forward planes (of dimensions j and k) intersects the ray at the furthest location along the ray. From the edgeThe dashed area on one side of the line defined at 408 represents the time since determining whether F is j D k >F k D j So as to know the area where the light ray does not intersect. In other words, it is determined whether F j D k >F k D j It may be determined that the ray passes somewhere in the non-dashed area to the other side of the line defined by edge 408. FIG. 4e shows the light passing over the line defined by edge 408, i.e. F j D k >F k D j Such that the forward plane of dimension j intersects the ray at a location along the ray that is farther than the location along the forward plane of dimension k that intersects the ray. Thus, in the case shown in fig. 4e, step S308 identifies the forward plane of dimension j. In contrast, FIG. 4F shows the case where the ray passes below the line defined by edge 408, i.e., F j D k <F k D j Such that the forward plane of dimension k intersects the ray at a location along the ray that is farther than the location along the forward plane of dimension j that intersects the ray. Thus, in the case shown in fig. 4f, step S308 identifies the forward plane of dimension k. As mentioned above, if F j D k =F k D j Either of the forward planes of dimensions j and k can be selected.
For identifying which of the forward planes of the frame is furthest along the ray from the ray in step S308 Intersecting second method
In a second method described herein for performing step S308, step S308 includes: (i) Performing a first forward test to determine which of the first forward plane and the second forward plane of the frame the ray intersects at a furthest location along the ray; (ii) Performing a second forward test to determine which of the first forward plane and the third forward plane of the frame the ray intersects at a furthest location along the ray; and (iii) performing a third forward test to determine which of the second forward plane and the third forward plane of the box the ray intersects at a furthest location along the ray. The results of the first, second, and third forward tests are used to identify which of the forward planes of the frame intersects the ray at the furthest location along the ray. In this second method, the first forward test, the second forward test, and the third forward test are performed independently of each other (i.e., they do not require the results of each other), and thus, the three tests may be performed in parallel.
This second method may be considered as performing three forward tests to test on which side of each of the lines defined by the three edges 404, 406, and 408 the light passes. For example, a first forward test may determine whether F i D j >F j D i . If F i D j >F j D i The location at which the forward plane of dimension i intersects the ray is farther along the ray than the location at which the forward plane of dimension j intersects the ray (e.g., the ray passes to the right of the line defined by edge 404); and if F i D j <F j D i The forward plane of dimension j intersects the ray at a location along the ray that is farther than the location along the forward plane of dimension i that intersects the ray (e.g., the ray passes to the left of the line defined by edge 404). A second forward test can determine whether F i D k >F k D i . If F i D k >F k D i The location at which the forward plane of dimension i intersects the ray is farther along the ray than the location at which the forward plane of dimension k intersects the ray (e.g., the ray passes over the line defined by edge 406); and if F i D k <F k D i The forward plane of dimension k intersects the ray at a location along the ray that is farther than the location along the forward plane of dimension i that intersects the ray (e.g., the ray passes below the line defined by edge 406). A third forward test can determine whether F j D k >F k D j . If F j D k >F k D j The location at which the forward plane of dimension j intersects the ray is farther along the ray than the location at which the forward plane of dimension k intersects the ray (e.g., the ray passes over the line defined by edge 408); and if F j D k <F k D j The forward plane of dimension k intersects the ray at a location along the ray that is farther than the dimensionj to the location where the forward plane intersects the ray (e.g., the ray passes below the line defined by edge 408). As described above, the results of the first, second, and third forward tests may be used to identify which of the forward planes of the box intersects the ray at the furthest location along the ray.
In the first method for performing step S308 described above, two forward tests are sequentially performed; whereas in the second method for performing step S308 described above, three forward tests are performed, and these three tests may be performed in parallel. In some embodiments, it may be considered beneficial to reduce the number of tests that need to be performed, so the first method for performing step S308 may be used, as this involves performing two forward tests instead of three. However, in some other embodiments, shortening the processing pipeline (e.g., reducing latency) may be considered beneficial, and thus the second method for performing step S308 may be used, as all forward tests in step S308 may be performed in parallel together, rather than sequentially.
At the end of step S308, the intersection test module 108 has identified which of the forward planes of the box the ray intersects at the furthest location along the ray (e.g., as shown in FIGS. 4 c-4 f).
In step S310, the intersection test module 108 (specifically, the one or more box intersection test units 112) determines if the ray 202 intersects the identified forward plane at a location along the ray that is not farther than the location at which the ray intersects the backward plane in the subset of dimensions. The term "subset" as used in this context refers to the appropriate subset. In other words, the subset of dimensions does not contain all dimensions. Specifically, the subset of dimensions includes two dimensions for which the forward plane is not identified, but the subset of dimensions does not include dimensions for which the forward plane has been identified. This is because the inventors have appreciated that for each dimension, a ray will intersect the forward plane of the axis-aligned box of that dimension before intersecting the backward plane of the axis-aligned box of that dimension. This is due in part to the fact that the axes of a particular dimension are parallel to the forward and rearward planes of the alignment frame. Thus, without performing any tests, the intersection test module 108 can learn that the ray 202 intersected the identified forward plane before intersecting the backward plane in the dimension where the forward plane has been identified. This implementation allows for a reduction in the number of tests that need to be performed to determine whether a ray intersects an axis alignment box. Two example methods for determining whether a ray intersects an identified forward plane before intersecting a backward plane in a subset of dimensions in step S310 are described in detail below.
For determining in step S310 whether the location at which the ray intersects the identified forward plane is not farther along the ray than First method of where ray intersects a backward plane in a subset of dimensions
In the first method for performing step S310 described herein, step S310 includes: (i) Performing a first hybrid orientation test to determine which of an identified forward plane and a first backward plane of the box the ray intersects at a furthest location along the ray, wherein the first backward plane of the box is a backward plane of a first dimension of the subset of dimensions; (ii) Performing a second hybrid orientation test to determine which of the identified forward plane and a second backward plane of the box the ray intersects at a furthest location along the ray, wherein the second backward plane of the box is a backward plane of a second dimension of the subset of dimensions; and (iii) using the results of the first and second mixed-direction tests to determine whether the ray intersects the identified forward plane at a location along the ray that is not further than the location at which the ray intersects the backward plane in the subset of dimensions. In this method, the first mixed-direction test and the second mixed-direction test do not depend on the results of each other, and thus they can be performed in parallel. It should be noted that the term "forward test" is used herein to refer to a test for comparing the distance that two forward planes intersect a ray; the term "backward test" is used herein to refer to a test for comparing the distance two backward planes intersect a ray; and the term "mixed direction test" is used herein to refer to a test for comparing the distance that a forward plane and a backward plane intersect a ray.
FIG. 4g to FIG4j shows the tests performed in different cases in step S310. For example, fig. 4g and 4j are the results of the cases shown in fig. 4c and 4f, respectively, wherein the forward plane of dimension k is identified in step S308. In both cases, the first mixed-direction test and the second mixed-direction test determine on which side of the line defined by the two edges 410 and 412 the light passes. For example, a first hybrid direction test may determine whether F k D i >B i D k Wherein F k Is a component value of a kth dimension, the component value being constant over the forward plane of dimension k, and B i Is the component value of the i-th dimension, which is constant in the backward plane of dimension i. This test corresponds to which side of the line defined by edge 410 the test ray passes. If F k D i >B i D k The location at which the forward plane of dimension k intersects the ray is farther along the ray than the location at which the backward plane of dimension i intersects the ray (e.g., the ray passes below the line defined by edge 410) such that the ray will miss the box; and if F k D i ≤B i D k The forward plane of dimension k intersects the ray at a location along the ray that is no further than the backward plane of dimension i (e.g., the ray passes over the line defined by edge 410) such that the ray may intersect the box. The second hybrid direction test can determine whether F k D j >B j D k Wherein B is j Is the component value of the j-th dimension, which is constant in the backward plane of dimension j. This test corresponds to which side of the line defined by edge 412 the test ray passes. If F k D j >B j D k Then the location at which the forward plane of dimension k intersects the ray is farther along the ray than the location at which the backward plane of dimension j intersects the ray (e.g., the ray passes below the line defined by edge 412) such that the ray will miss the box; and if F k D j ≤B j D k The location at which the forward plane of dimension k intersects the ray is not farther along the ray than the location at which the backward plane of dimension j intersects the ray (e.g., the ray passes over the line defined by edge 412),so that the ray may intersect the box. It should be noted that in step S308, F may have been calculated k D j And F k D i One or both of the values. These values may be recalculated in step S310 or may be saved during step S308 (e.g., in a register) so that they may be reused in step S310 without requiring them to be recalculated.
In order for a ray to intersect a box, the point at which the ray intersects the identified forward plane must not be further from the ray origin than the point at which the ray intersects the box's backward plane. In the examples described herein, no test need be performed to determine if a ray intersects an identified forward plane before intersecting a backward plane of a dimension for which the forward plane has been identified. In some examples (e.g., as described in the preceding paragraph), both the first mixed-direction test and the second mixed-direction test must pass to determine the hit of the ray with respect to the box, i.e., two tests are performed to determine that the ray does not intersect the respective backward planes of two dimensions of the subset of dimensions before the ray intersects the identified forward plane. However, in some other examples, in some cases, one of the hybrid-direction tests need not be performed. For example, in the case shown in fig. 4j, only one mixed direction test is required in step S310 (i.e., testing which side of the line defined by edge 410 the light passes). If the box intersection test unit 112 can determine the geometry of the box such that only one test needs to be performed (e.g., in the case shown in fig. 4j instead of in the case shown in fig. 4 g), then only one test needs to be performed in step S310.
As another example, fig. 4h is the result of the situation shown in fig. 4d, wherein the forward plane of dimension i is identified in step S308. In this case, the first mixed-direction test and the second mixed-direction test determine on which side of the line defined by the two edges 414 and 416 the light passes. For example, a first hybrid direction test may determine whether F i D j >B j D i Wherein F i Is a component value of the i-th dimension, which is constant over the forward plane of dimension i, andB j is the component value of the j-th dimension, which is constant in the backward plane of dimension j. This test corresponds to which side of the line defined by edge 416 the test ray passes. If F i D j >B j D i Then the location at which the forward plane of dimension i intersects the ray is farther along the ray than the location at which the backward plane of dimension j intersects the ray (e.g., the ray passes to the right of the line defined by edge 416) such that the ray will miss the box; and if F i D j ≤B j D i The forward plane of dimension i intersects the ray at a location along the ray that is no further than the backward plane of dimension j intersects the ray (e.g., the ray passes to the left of the line defined by edge 416) such that the ray may intersect the box. The second hybrid direction test can determine whether F i D k >B k D i Wherein B is k Is the component value of the kth dimension, which is constant in the backward plane of dimension k. This test corresponds to which side of the line defined by edge 414 the test ray passes. If F i D k >B k D i Then the location at which the forward plane of dimension i intersects the ray is farther along the ray than the location at which the backward plane of dimension k intersects the ray (e.g., the ray passes over the line defined by edge 414) such that the ray will miss the box; and if F i D k ≤B k D i The forward plane of dimension i intersects the ray at a location along the ray that is no further than the backward plane of dimension k intersects the ray (e.g., the ray passes below the line defined by edge 414) such that the ray may intersect the box. It should be noted that in step S308, F may have been calculated i D j And F i D k One or both of the values. These values may be recalculated in step S310 or may be saved during step S308 (e.g., in a register) so that they may be reused in step S310 without requiring them to be recalculated.
As another example, fig. 4i is the result of the situation shown in fig. 4e, wherein the forward plane of dimension j is identified in step S308. In this case, the first Hybrid direction test and second hybrid direction test determine on which side of the line defined by the two edges 418 and 420 the light passes. For example, a first hybrid direction test may determine whether F j D k >B k D j Wherein F j Is a component value of a j-th dimension, the component value being constant over the forward plane of dimension j. This test corresponds to which side of the line defined by edge 418 the test ray passes. If F j D k >B k D j Then the location at which the forward plane of dimension j intersects the ray is farther along the ray than the location at which the backward plane of dimension k intersects the ray (e.g., the ray passes over the line defined by edge 418) such that the ray will miss the box; and if F j D k ≤B k D j The forward plane of dimension j intersects the ray at a location along the ray that is no further than the backward plane of dimension k (e.g., the ray passes below the line defined by edge 418) such that the ray may intersect the box. The second hybrid direction test can determine whether F j D i >B i D j . This test corresponds to which side of the line defined by edge 420 the test ray passes. If F j D i >B i D j Then the location at which the forward plane of dimension j intersects the ray is farther along the ray than the location at which the backward plane of dimension i intersects the ray (e.g., the ray passes to the left of the line defined by edge 420) such that the ray will miss the box; and if F j D i ≤B i D j The forward plane of dimension j intersects the ray at a location along the ray that is no further than the backward plane of dimension i (e.g., the ray passes to the right of the line defined by edge 420) such that the ray may intersect the box. It should be noted that in step S308, F may have been calculated j D k And F j D i One or both of the values. These values may be recalculated in step S310 or may be saved during step S308 (e.g., in a register) so that they may be reused in step S310 without requiring them to be recalculated.
For at stepDetermining in step S310 whether the location at which the ray intersects the identified forward plane is not further along the ray than Second method of where ray intersects backward plane in dimension subset
In a second method described herein for performing step S310, step S310 comprises: (i) Performing a backward test to determine which of a first backward plane and a second backward plane of the box the ray intersects at a closest location along the ray, wherein the first backward plane and the second backward plane of the box are backward planes of a first dimension and a second dimension of the subset of dimensions; (ii) Performing a blending direction test to determine which of the identified forward plane and the determined backward plane of the box the ray intersects at a furthest location along the ray; and (iii) using the results of the hybrid orientation test to determine whether the ray intersects the identified forward plane at a location along the ray that is not further than the location at which the ray intersects the backward plane in the subset of dimensions.
In other words, in this approach, the closest backward plane of the ray is determined, and then intersection test module 108 determines whether the furthest forward plane (i.e., the identified forward plane) is farther along the ray than the closest backward plane. If so, the ray misses the box.
For example, in fig. 4c and 4f, the forward plane of dimension k is identified in step S308. In both cases, the backward test determines which of the backward planes of dimensions i and j intersects the ray at the closest location along the ray. The backward test can determine whether B i D j >B j D i . If B is i D j >B j D i The position where the backward plane of dimension j intersects the ray is not farther along the ray than the position where the backward plane of dimension i intersects the ray; and if B i D j <B j D i The backward plane of dimension i intersects the ray at a location along the ray that is no further than the location along the backward plane of dimension j that intersects the ray. If B is i D j =B j D i Either of the backward planes of dimension i or j can be selected. Hybrid direction testing can determine whether F k D near >B near D k Where the dimension (i or j in this case) determined to be at the nearest position along the ray is denoted "near". If F k D near >B near D k The position where the forward plane of dimension k intersects the ray is farther along the ray than the position where the determined backward plane intersects the ray, such that the ray will miss the box; and if F k D near ≤B near D k The forward plane of dimension k intersects the ray at a location along the ray that is no further than the determined location at which the backward plane intersects the ray. This means that rays may intersect the box, depending on the minimum and maximum distance conditions described below.
In the example shown in fig. 4d, the forward plane of dimension i is identified in step S308. In this case, the backward test determines which of the backward planes of dimensions j and k intersects the ray at the closest location along the ray. The backward test can determine whether B j D k >B k D j . If B is j D k >B k D j The position where the backward plane of dimension k intersects the ray is not farther along the ray than the position where the backward plane of dimension j intersects the ray; and if B j D k <B k D j The backward plane of dimension j intersects the ray at a location along the ray that is no further than the location along the backward plane of dimension k that intersects the ray. If B is j D k =B k D j Either of the backward planes of dimension j or k can be selected. Hybrid direction testing can determine whether F i D near >B near D i Where the dimension (in this case j or k) determined to be at the nearest position along the ray is denoted "near". If F i D near >B near D i The position where the forward plane of dimension i intersects the ray is farther along the ray than the position where the determined backward plane intersects the ray, such that the ray will miss the box; and if F i D near ≤B near D i The position where the forward plane of dimension i intersects the ray is along the lightThe line is no further than the determined location where the backward plane intersects the ray. This means that rays may intersect the box, depending on the minimum and maximum distance conditions described below.
In the example shown in fig. 4e, the forward plane of dimension j is identified in step S308. In this case, the backward test determines which of the backward planes of dimensions i and k intersects the ray at the closest location along the ray. The backward test can determine whether B i D k >B k D i . If B is i D k >B k D i The position where the backward plane of dimension k intersects the ray is not farther along the ray than the position where the backward plane of dimension i intersects the ray; and if B i D k <B k D i The backward plane of dimension i intersects the ray at a location along the ray that is no further than the location along the backward plane of dimension k that intersects the ray. If B is i D k =B k D i Either of the backward planes of dimension i or k can be selected. Hybrid direction testing can determine whether F j D near >B near D j Where the dimension (i or k in this case) determined to be at the nearest position along the ray is denoted "near". If F j D near >B near D j The position at which the forward plane of dimension j intersects the ray is farther along the ray than the position at which the determined backward plane intersects the ray, such that the ray will miss the box; and if F j D near ≤B near D j The forward plane of dimension j intersects the ray at a location along the ray that is no further than the determined location at which the backward plane intersects the ray. This means that rays may intersect the box, depending on the minimum and maximum distance conditions described below.
Steps S308 and S310 do not involve calculating the intersection distance to any plane of the box. Instead, steps S308 and S310 involve performing tests (e.g., forward, backward, and hybrid) to determine, for a pair of planes, which of the planes intersects the ray farther along the ray. This is achieved in the example described herein by comparing the values of the cross-multiplications, which operation does not involve calculating the intersection distance to the plane of the box. The intersection distance need not be calculated for the box intersection test performed by the box intersection test unit 112. The intersection distance to the plane of the box is the distance from the ray origin to the point on the plane where the ray intersects the plane.
In general, the forward test, backward test, and hybrid test performed to determine which of the first and second planes of the box the ray intersects at the furthest position along the ray, described above with reference to steps S308 and S310, include combining form P m,i D j And P n,j D i Is compared with the value of P m,i Is the component value of the first plane in the ith dimension, where P n,j Is a component value of a second plane in a j-th dimension, and wherein D i And D j The components of the direction vector of the ray in the i-th and j-th dimensions, respectively. In this symbol, the values of m and n indicate whether the plane is a forward plane or a backward plane, where the value of m or n may be 0 for the forward plane and 1 for the backward plane. For example, P 0,i =F i ,P 1,i =B i ,P 0,j =F j And P is 1,j =B j . If P m,i D j >P n,j D i Then the light is determined to be in a first plane (P m,i ) The intersection is located further along the ray than the ray and the second plane (P n,j ) The location of the intersection, and if P m,i D j <P n,j D i Then determine the light and the second plane (P n,j ) The intersection is located farther along the ray than the ray intersects the first plane (P m,i ) The location of the intersection. This form of comparison may be performed by performing two multiplication operations and a comparison operation. These operations are readily implemented (e.g., in hardware) in the box intersection test unit 112 of the intersection test module.
As described above, in some examples, one or more intermediate results determined in step S308 may be stored, and then in step S310, the stored one or more intermediate results may be read for determining light Whether the line intersects the identified forward plane before intersecting the backward plane in the subset of dimensions. If a forward plane in the ith dimension is identified in step S308, the intermediate result may include the value F i D j And F i D k The method comprises the steps of carrying out a first treatment on the surface of the If a forward plane in the j-th dimension is identified in step S308, the intermediate result may include the value F j D i And F j D k The method comprises the steps of carrying out a first treatment on the surface of the And if a forward plane in the kth dimension is identified in step S308, the intermediate result may include the value F k D j And F k D i
Returning to FIG. 3, at the end of step S310, the intersection test module has determined whether the ray will intersect the axis alignment box if the ray is infinitely long. This determination is used to determine whether the ray intersects the axis alignment box. It should also be noted that the method determines whether a ray intersects a box without performing a test to determine if the ray intersects an identified forward plane before intersecting a backward plane in a dimension in which the forward plane has been identified. In this way, the methods described herein avoid performing some tests by conditioned on previous results. Further, it should also be noted that for any plane of the box, the intersection distance is not directly calculated.
In the example described above, step S310 contains at most two tests (and in some cases, for example in the case shown in fig. 4j, it is possible to perform only one test in step S310). Step S308 contains two or three tests, depending on the method employed. Thus, if a first method is used for step S308 (where step S308 involves performing two tests), the total number of tests is at most four, and in some cases, for example in the case shown in fig. 4j, may be only three. Further, if a second method is used for step S308 (where step S308 involves performing three tests), the total number of tests is at most five, and in some cases, for example, in the case shown in fig. 4j, may be only four. If it has been determined in step S310 that the ray intersects the identified forward plane at a location along the ray that is farther than the ray intersects the backward plane in the subset of dimensions, then the ray missing box is known, and the method proceeds from step S310 to step S316 where the ray missing box is determined (i.e., the ray does not intersect the box). If it is determined in step S310 that the ray intersects the identified forward plane at a location along the ray that is not further than the location at which the ray intersects the backward plane in the subset of dimensions, the method proceeds to step S312.
In step S312, the intersection test module 108 (specifically, the box intersection test unit 112) determines whether the minimum distance condition and the maximum distance condition are satisfied. The minimum distance condition is satisfied if the minimum effective distance of the ray from the ray origin is less than or equal to the maximum distance from the ray origin to any intersection of the ray with a point within the box. In other words, if the origin of the ray (represented by the value t min Definition) does not exceed the box, the minimum distance condition is satisfied. FIG. 5a illustrates an example of the intersection test module 108 determining whether a ray 502 intersects a box 504. In step S310, it will be determined that the ray 502 intersected the identified forward plane of the block 504 before it intersected the backward plane of the block 504 such that the ray 502 may intersect the block 504. Specifically, ray 502 intersects the forward plane of box 504 at point 506 and intersects the backward plane of box 504 at point 508. In some examples, t min =0, so that the minimum distance of the ray from the ray origin is zero, but in the example shown in fig. 5a, t min Not equal to 0. It should be noted that since the x, y and z components of the ray and the frame are selectively inverted in step S306, the direction vector of the ray will be in the forward diagram, D x ≥0,D y Not less than 0 and D z And is more than or equal to 0. In the example shown in FIG. 5a, the minimum effective distance of the ray from the ray origin 510 is greater than the maximum distance from the ray origin to any intersection of the ray with a point within the box at point 508. Thus, in this example, in step S312, it will be determined that the minimum distance condition is not satisfied. For example, determining whether the minimum distance condition is met may include determining whether B i ≥D i t min ,B j ≥D j t min And B is k ≥D k t min . As described above, t min Is the minimum defining the ray from the ray originParameters of the effective distance. If B is i ≥D i t min 、B j ≥D j t min And B k ≥D k t min All three are true, then the minimum distance condition is satisfied; and if B i <D i t min 、B j <D j t min And B k <D k t min If any one of them is true, the minimum distance condition is not satisfied.
In some examples, t min Cannot be negative, and it should also be noted that D is due to the optional inversion of the x, y and z components in step S306 i ≥0,D j Not less than 0, and D k And is more than or equal to 0. Thus, in these examples, if any of the backward planes of the box has a negative constant value, i.e., if B i <0,B j < 0 or B k < 0 (i.e., if x max 、y max Or z max Negative) then the box is behind the ray, and thus, intersection test module 108 can determine that the ray missed the box. This determination may be performed at any time after step S306, and if this determination determines that a ray missed box (which may be referred to as a "gesture box") is due to the box being behind the ray, the method may jump directly to step S316 without performing some or all of the tests described herein with reference to steps S308, S310, and S312.
In the more general notation used above, B i 、B j And B k Can be respectively expressed as P 1,i 、P 1,j And P 1,k . As will become apparent after the following description of the maximum distance condition, it should be noted that the maximum distance condition is satisfied in the example shown in fig. 5a because the maximum effective distance of the ray from the ray origin at point 512 is greater than the minimum distance from the ray origin to the intersection of the ray with the box at point 506.
The maximum distance condition is satisfied if the maximum effective distance of the ray from the ray origin is greater than or equal to the minimum distance from the ray origin to any intersection of the ray direction vector with a point within the box. In other words, if oriented in a direction along the light rayThe end of the ray (from the value t max Definition) is not before the box, the maximum distance condition is satisfied. FIG. 5b illustrates an example of the intersection test module 108 determining whether a ray 522 intersects a box 524. In step S310, it will be determined that the ray 522 intersected the identified forward plane of block 524 before intersecting the backward plane of block 524 such that the ray 522 may intersect block 524. Specifically, ray 522 intersects the forward plane of box 524 at point 526 and intersects the backward plane of box 524 at point 528. In the example shown in FIG. 5b, the maximum effective distance of the ray from ray origin 532 is less than the minimum distance from the ray origin to any intersection of ray 522 with the forward plane of box 524 at point 526. Thus, in this example, in step S312, it will be determined that the maximum distance condition is not satisfied. It should be noted that the minimum distance condition is satisfied in the example shown in FIG. 5b, because the minimum effective distance of the ray from the ray origin at point 530 is less than the maximum distance from the ray origin to any intersection of the ray with a point within the box at point 528. In step S308, the forward plane of the frame that intersects the ray at the furthest location along the ray has been identified, and this identification may be used to simplify the process of determining whether the maximum distance is met. For example, if a forward plane of dimension i is identified in step S308, where i may be any of the x, y, or z dimensions, then the test to determine if the maximum distance condition is met includes determining if F i ≤D i t max . The other two dimensions may be ignored because the point at which the ray intersects the identified forward plane is important for the maximum distance condition. As described above, t max Is a parameter defining the maximum effective distance of a ray from the ray origin. If F i ≤D i t max The maximum distance condition is satisfied; and if F i >D i t max The maximum distance condition is not satisfied. In the more general notation used above, F i Can be expressed as P 0,i
FIG. 5c illustrates an example of the intersection test module 108 determining whether a ray 542 intersects a block 544. In step S310, it will be determined that ray 542 intersects the identified forward plane of block 544 prior to intersecting the backward plane of block 544, such that ray 542 may intersect block 544. Specifically, ray 542 intersects the forward plane of block 544 at point 546 and intersects the backward plane of block 544 at point 548. In the example shown in FIG. 5c, the minimum distance condition is met because the minimum effective distance of the ray from the ray origin at point 550 is less than the maximum distance from the ray origin to any intersection of the ray with the volume of the box at point 548. Also, in the example shown in FIG. 5c, the maximum distance condition is met because the maximum effective distance of the ray from the ray origin at point 552 is greater than the minimum distance from the ray origin to any intersection of the ray with the volume of the box at point 546.
The test performed in step S312 to determine whether the maximum distance condition is met and to determine whether the minimum distance condition is met may be performed in parallel with the test performed in step S310 to determine whether the ray intersects the identified forward plane before intersecting the backward plane in the subset of dimensions. This is because the test performed in step S312 does not depend on the result of the test performed in step S310. Parallel execution of the tests may be particularly beneficial in implementations where the block intersection test unit 112 is implemented in hardware (e.g., in fixed function circuitry). In other examples (e.g., where the box intersection test unit 112 is implemented in software, e.g., in a module of computer code executing on a processing unit), the tests may be performed sequentially in steps S310 and S312, with the second test being performed only when the first test does not determine that a ray passes relative to the box, and the third test being performed only when the first test and the second test do not determine that a ray passes relative to the box, and so on. This sequential approach allows for determining a miss without having to perform all tests (if the test earlier in the sequence has determined that the ray was missed relative to the box).
The determination in step S312 as to whether the minimum distance condition and the maximum distance condition are satisfied is used to determine whether the ray intersects the axis alignment box. If one or both of the minimum distance condition and the maximum distance condition are not met (e.g., in the example shown in fig. 5a and 5 b), the method proceeds from step S312 to step S316, where the intersection test module 108 (specifically, the box intersection test unit 112) determines that the ray does not intersect the box. However, if both the minimum distance condition and the maximum distance condition are met (e.g., in the example shown in fig. 5 c), the method proceeds from step S312 to step S314, where the intersection test module 108 (specifically, the box intersection test unit 112) determines that the ray intersects the box. It should be noted that to implement step S314, i.e., to have the intersection test module determine that the ray intersects the axis-aligned box, it will be determined that the location at which the ray intersects the identified forward plane of the box is no farther along the ray than the location at which the ray intersects the backward plane of the box (in step S310), and it will be determined that the maximum and minimum distance conditions are met (in step S312).
After steps S314 and/or S316, the method proceeds to step S318, where the intersection test module 108 outputs an indication of the result of determining whether the ray intersected the box. This indication may be a binary indication (e.g., a one bit flag) to indicate a 'hit' or 'miss' of the ray with respect to the box. In other examples, the indication may have a different form. In step S320, an image of the 3D scene is rendered (e.g., by processing logic 110) in ray tracing system 100 using the output indication. For example, a box may define a geometry to be rendered in a scene. If the box corresponds to a node of the hierarchical acceleration structure to be used for performing intersection tests in the ray tracing system, an indication of whether the ray intersects the box may be used to determine whether to test that the ray intersects the box corresponding to any child nodes in the node that correspond to intersecting boxes. For example, if a ray intersects a box corresponding to a parent node, the ray is tested for intersection with a box corresponding to a child node of the parent node, and if the ray does not intersect a box corresponding to a parent node, the ray is not tested for intersection with a box corresponding to a child node of the parent node. If a ray intersects a box corresponding to a leaf node of the hierarchical acceleration structure, the intersection of the ray with any geometry referenced by the leaf node (e.g., triangle or other primitive) may be tested.
In the example shown in FIG. 3, data defining rays and boxes is read in step S302, and then inThe components of the ray origin are subtracted from the data defining the position of the box in step S304, and then the x, y and z components of the ray and box are selectively inverted in step S306 so that D x ≥0,D y Not less than 0 and D z And is more than or equal to 0. However, the ordering of the three steps (steps S302 to S306) may be different in different examples. For example, the x, y, and z components of the ray and box data may be selectively inverted before the intersection test module 108 obtains the data. The x, y and z components of the data are selectively inverted prior to reading in the data such that D is known prior to reading in the data x ≥0,D y Not less than 0 and D z 0 or more may be useful. This allows some pre-computation to be performed on the data, and the pre-computed data may be stored in a storage device (e.g., memory on ray tracing unit 102) before being read into intersection test module 108. This means that the processing involved in this pre-calculation can be performed once on the ray and used multiple times if the ray involves multiple intersection tests. Further, in some examples, before the intersection test module 108 obtains the data, the component of the ray origin may be subtracted from the component defining the location of the plane of the box in the preprocessing stage.
The above describes a method used in a ray tracing system that does not introduce any errors into its calculation. However, some calculations, such as those performed using numbers in floating point format, may introduce rounding errors. This is in part because the precision with which floating point numbers can be represented varies from one number to another. The 'step size' between sequential floating point numbers is generally approximately proportional to the magnitude of the floating point value (with some exceptions, e.g., near zero). In some examples, the box intersection test unit 112 of the intersection test module 108 is configured to operate conservatively when testing AABB. Specifically, the tests performed in steps S308, S310, and S312 may be performed to operate conservatively. This means that the method may sometimes give a 'false positive' result (i.e., the method may sometimes indicate that a ray intersects a box even though the ray does not), but the method may not give a 'false negative' result (i.e., the method may not indicate that a ray does not intersect a box when the ray actually intersects a box). False positive results do not introduce rendering errors into the ray tracing process because if a ray is determined to intersect a box, the intersection of the ray will be tested against another object defined by the box (e.g., another box corresponding to a child node, or some geometry), and thus the ray will eventually be found not to intersect the other object. False positive results may reduce the efficiency of the intersection test procedure due to an increased number of tests performed, but this is acceptable provided that the proportion of positive results that are false positive results (not correct positive results) is low, for example less than 1%. Thus, a small number of false positive results are acceptable during ray-box intersection testing. However, a ' false negative ' result may introduce rendering errors into the ray tracing process because if a ray is determined to miss a box, the ray's intersection with another object defined by the box is not tested even though the ray may actually intersect with the other object. Rendering errors are typically unacceptable, so that during ray-box intersection testing, false negative results are unacceptable.
In some examples, therefore, the determination of whether the ray intersects the axis alignment box is performed conservatively by rounding the value determined for the forward plane toward- +and rounding the value determined for the backward plane toward+, so that errors introduced by rounding in the determination process do not result in a determination that a ray does not intersect an axis-aligned box in the event that a completely accurate determination would otherwise determine that the ray intersects the axis-aligned box. For example, multiplication involving forward planes in steps S308, S310, and/or S312 (e.g., F i D j Or F j D k As two examples) are rounded towards smaller values. Similarly, the subtraction performed in step S304 should round down for the position of the forward plane. However, multiplication involving the backward plane in steps S308, S310 and/or S312 (e.g., B i D j Or B is a j D k As two examples) are rounded towards larger values. Similarly, the subtraction performed in step S304 should round up for the position of the backward plane.
In some examples, a Top Level Acceleration Structure (TLAS) may be used to represent a scene in a world space coordinate system. The nodes of the TLAS correspond to boxes representing regions in the scene (e.g., AABB aligned with axes of the world space coordinate system). A set of geometries (e.g., representing objects) may be defined and one or more examples of the set of geometries may be inserted into corresponding locations within the scene. The set of geometries is defined in an example spatial coordinate system, and an underlying acceleration structure (BLAS) is created with nodes corresponding to boxes representing regions in the example space (e.g., AABBs aligned with axes of the example spatial coordinate system). One or more nodes of the TLAS may refer to nodes of the BLAS. The ray first traverses the nodes of the TLAS, where if the ray is found to intersect a node referencing a node of the BLAS, the intersection of the ray with the box corresponding to the node of the BLAS can be tested. The intersection test module 108 (e.g., ray adjustment unit 116) can transform rays into an example spatial coordinate system in order to test intersections with boxes corresponding to nodes of the BLAS. The boxes described herein may correspond to nodes of the TLAS (i.e., the boxes may be axis aligned boxes in world space), or the boxes described herein may correspond to nodes of the BLAS (i.e., the boxes may be axis aligned boxes in example space).
If one of the components of the ray direction vector is zero (i.e., if D x =0,D y =0 or D z =0), the ray is parallel to the forward and backward planes of the box in that dimension. When the plane is parallel to the light, there are two cases to consider: the light is either entirely outside the half-space defined by the plane (which automatically indicates a miss) or the light is entirely inside the half-space defined by the plane. Because the box test is conservative, the case where the ray is "in plane" is considered "inside".
At D i In the case of =0, where i is any one of x, y or z, if F i Less than or equal to 0, the light is completely positioned in the forward plane of the frame in the ith dimension; and if F i > 0, then the ray lies entirely outside the forward plane of the frame in the ith dimension. Further, if B i The light is completely positioned in the backward plane of the frame in the ith dimension and is more than or equal to 0; and if B i And < 0, then the ray is entirely outside the backward plane of the frame in the ith dimension. If it is determined that the ray is entirely outside one or both of the forward plane and the backward plane, then the intersection test module 108 determines that the ray does not intersect the box. This test may be performed prior to step S308, and if this test determines that the ray is parallel to the plane of the box and lies entirely outside said plane, the method may proceed directly to step S316, for example without performing one or more of the tests of steps S308, S310 or S312. However, if the ray is parallel to the plane of the box in the ith dimension but entirely within both the forward and backward planes of the ith dimension, the ray may still intersect the box. During step S308, if the forward parallel plane is tested with another forward plane to see which plane intersects the ray at the furthest location along the ray, then another forward plane is selected. If the two forward planes compared in step S308 are parallel, either plane may be selected. Unless the light direction is not effective, all three forward planes cannot be parallel. During step S310, the backward parallel plane may be ignored, i.e., the ray is considered to intersect the forward plane before intersecting the backward parallel plane.
In the example described above, the forward plane is identified (in step S308), and then a determination is made (in step S310) as to whether the identified forward plane intersects the ray at a location along the ray that is no further than the location along the ray that intersects the backward plane of the subset of dimensions that intersects the ray. In alternative embodiments, the same principles may be applied to a method of identifying a backward plane and then determining whether the identified backward plane intersects a ray before a forward plane of the subset of dimensions intersects the ray. Examples of these alternative embodiments are described with reference to the flowchart shown in fig. 6 and the diagrams shown in fig. 7a to 7 j.
FIG. 6 is a flow chart of a method of performing an intersection test to determine if a ray 202 intersects a 3D axis alignment box 204. Although the following description refers to testing whether the ray 202 intersects the box 204, the same method may be applied to test whether the ray 214 intersects the box 204.
Steps S602, S604 and S606 and the above reference figuresSteps S302, S304 and S306 described in the flow chart of 3 are the same. Thus, in step S602, data defining the ray 202 and the box 204 is obtained at the intersection test module 108. Specifically, data defining components of the origin of the ray and the direction of the ray are obtained. The data defining the frame may be data defining a position of a plane representing the frame, for example, a constant component value for each of a forward plane and a backward plane in each of three dimensions. In step S604, the intersection test module 108 subtracts the respective components of the ray origin from the respective components defining the positions of the forward plane and the backward plane of the box. In step S606, the intersection test module 108 (e.g., the ray adjustment unit 116) selectively inverts the axes of the components of the ray and the box such that D x ≥0,D y Not less than 0 and D z And is more than or equal to 0. At the end of step S606, the intersection test module 108 has determined a value x min 、y min 、z min 、x max 、y max And z max
In step S608, the intersection test module 108 (specifically, the one or more box intersection test units 112) identifies which of the backward planes of boxes intersects the ray at the closest location along the ray. Two example methods for identifying which of the backward planes of the box intersects the ray at the closest location along the ray in step S608 are described in detail below.
For identifying which of the backward planes of the box is closest along the ray and the ray in step S608 First method of intersection
In a first method described herein for performing step S608, step S608 includes: (i) Performing a first backward test to determine which of the first backward plane and the second backward plane of the frame the ray intersects at a closest location along the ray; and (ii) performing a second backward test to determine which of the determined backward plane and the third backward plane of the box the ray intersects at a closest location along the ray, thereby identifying which of the backward planes of the box intersects the ray at a closest location along the ray. In this method, two tests are performed sequentially. The second test uses the results of the first test.
FIGS. 7a and 7B illustrate a method for determining whether B i D j >B j D i Is a first backward test of (a). Specifically, fig. 7a and 7b illustrate an axis alignment box 702 having three forward planes and three backward planes from the perspective of the ray origin (similar to fig. 2b and 4a through 4 j). Edge 704 defines a line (shown as a dashed line) where the backward planes of the i-th and j-th dimensions intersect. In the process for determining whether B i D j >B j D i After the first backward test of (a), it is known on which side of the line defined by edge 704 the ray passes. Thus, this comparison may be considered an edge test on edge 704. This comparison may also be considered a test of which of the two backward planes (of dimensions i and j) intersects the ray at the nearest location along the ray. The dashed area on one side of the line defined by edge 704 represents the result of determining whether B i D j >B j D i And the area where the rays do not intersect is known. In other words, it is determined whether or not B i D j >B j D i It may be determined that the ray passes somewhere in the non-dashed area to the other side of the line defined by edge 704. FIG. 7a shows the case where the ray passes to the right of the line defined by edge 704, B i D j >B j D i Such that the backward plane of dimension j intersects the ray at a location along the ray that is no further than the location at which the backward plane of dimension i intersects the ray. In contrast, FIG. 7B shows the case where the ray passes through the left side of the line defined by edge 704, B i D j <B j D i Such that the backward plane of dimension i intersects the ray at a location along the ray that is no further than the location at which the backward plane of dimension j intersects the ray. If B is i D j =B j D i Either of the backward planes of dimensions i and j can be selected. For example, if a ray intersects a line defined by edge 704, the ray may be considered to be in two non-dashed areas as shown in fig. 7a and 7 b.
In the second backward test, the rest of the backward plane testsA first backward test has determined the backward plane that intersects the ray at the closest location along the ray to determine which of the backward planes of the box intersects the ray at the closest location along the ray. For example, if it has been determined that the backward plane of dimension j intersects the ray at a location along the ray that is not further than the location along dimension i at which the backward plane intersects the ray (i.e., in the case shown in FIG. 7 a), then a second backward test includes determining whether B j D k >B k D j As shown in fig. 7c and 7 d. The edge 706 defines a line (which is shown as a dashed line) where the backward planes of the j-th and k-th dimensions intersect. In the process for determining whether B j D k >B k D j After the second backward test of (a), it is known on which side of the line defined by edge 706 the ray passes. Thus, this comparison may be considered an edge test on edge 706. This comparison may also be considered a test of which of the two backward planes (of dimensions j and k) intersects the ray at the nearest location along the ray. FIG. 7c shows the light passing under the line defined by edge 706, B j D k <B k D j Such that the backward plane of dimension j intersects the ray at a location along the ray that is no further than the location at which the backward plane of dimension k intersects the ray. Thus, in the case shown in fig. 7c, step S608 identifies the backward plane of dimension j. In contrast, FIG. 7d shows the case where the ray passes over the line defined by edge 706, B j D k >B k D j Such that the backward plane of dimension k intersects the ray at a location along the ray that is no further than the location at which the backward plane of dimension j intersects the ray. Thus, in the case shown in fig. 7d, step S608 identifies the backward plane of dimension k. If B is j D k =B k D j Either of the backward planes of dimensions j and k can be selected.
If it has been determined that the backward plane of dimension i intersects the ray at a location along the ray that is not further than the location along the backward plane of dimension j that intersects the ray (i.e., in the case shown in FIG. 7B), then a second backward test includes determining whether B i D k >B k D i As shown in fig. 7e and 7 f.The edge 708 defines a line (shown as a dashed line) where the backward planes of the i-th and k-th dimensions intersect. In the process for determining whether B i D k >B k D i After the second backward test of (a), it is known on which side of the line defined by edge 708 the ray passes. Thus, this comparison may be considered an edge test on edge 708. This comparison can also be considered as a test of which of the two backward planes (of dimensions i and k) intersects the ray at the nearest location along the ray. FIG. 7e shows the light passing over the line defined by edge 708, B i D k >B k D i Such that the backward plane of dimension k intersects the ray at a location along the ray that is no further than the location at which the backward plane of dimension i intersects the ray. Thus, in the case shown in fig. 7e, step S608 identifies the backward plane of dimension k. In contrast, FIG. 7f shows the case where the ray passes below the line defined by edge 708, B i D k <B k D i Such that the backward plane of dimension i intersects the ray at a location along the ray that is no further than the location at which the backward plane of dimension k intersects the ray. Thus, in the case shown in fig. 7f, step S608 identifies the backward plane of dimension i. If B is i D k =B k D i Either one of the backward planes of dimensions i and k can be selected.
For identifying which of the backward planes of the box is closest along the ray and the ray in step S608 Intersecting second method
In a second method described herein for performing step S608, step S608 includes: (i) Performing a first backward test to determine which of the first backward plane and the second backward plane of the frame the ray intersects at a closest location along the ray; (ii) Performing a second backward test to determine which of the first backward plane and the third backward plane of the frame the ray intersects at a closest location along the ray; and (iii) performing a third backward test to determine which of the second backward plane and the third backward plane of the box the ray intersects at a closest location along the ray. The results of the first, second, and third backward tests are used to identify which of the backward planes of the box intersects the ray at the closest location along the ray. In this second method, the first backward test, the second backward test, and the third backward test are performed independently of each other (i.e., they do not require the results of each other), and thus, the three tests can be performed in parallel.
This second method may be considered to perform three backward tests to test on which side of each of the lines defined by the three edges 704, 706, and 708 the light passes. For example, a first backward test may determine whether B i D j >B j D i . If B is i D j >B j D i Then the location at which the backward plane of dimension j intersects the ray is no farther along the ray than the location at which the backward plane of dimension i intersects the ray (e.g., the ray passes to the right of the line defined by edge 704); and if B i D j <B j D i The backward plane of dimension i intersects the ray at a location along the ray that is no further than the location at which the backward plane of dimension j intersects the ray (e.g., the ray passes to the left of the line defined by edge 704). A second backward test may determine whether B i D k >B k D i . If B is i D k >B k D i Then the location at which the backward plane of dimension k intersects the ray is no farther along the ray than the location at which the backward plane of dimension i intersects the ray (e.g., the ray passes over the line defined by edge 708); and if B i D k <B k D i The backward plane of dimension i intersects the ray at a location along the ray that is no further than the location along the backward plane of dimension k that intersects the ray (e.g., the ray passes below the line defined by edge 708). A third backward test may determine whether B j D k >B k D j . If B is j D k >B k D j Then the location at which the backward plane of dimension k intersects the ray is no farther along the ray than the location at which the backward plane of dimension j intersects the ray (e.g., the ray passes over the line defined by edge 706); and if B j D k <B k D j The backward plane of dimension j intersects the ray at a location along the ray that is no further than the location along the backward plane of dimension k that intersects the ray (e.g., the ray passes below the line defined by edge 706). As described above, the results of the first, second, and third backward tests may be used to identify which of the backward planes of the box intersects the ray at the closest location along the ray.
In the first method for performing step S608 described above, two backward tests are sequentially performed; whereas in the second method for performing step S608 described above, three backward tests are performed, and these three tests may be performed in parallel. In some embodiments, it may be considered beneficial to reduce the number of tests that need to be performed, so the first method for performing step S608 may be used, as this involves performing two backward tests instead of three. However, in some other embodiments, shortening the processing pipeline (e.g., reducing latency) may be considered beneficial, and thus the second method for performing step S608 may be used, as all of the backward testing in step S608 may be performed in parallel together, rather than sequentially.
At the end of step S608, the intersection test module 108 has identified which of the backward planes of the box the ray intersected at the closest location along the ray (e.g., as shown in fig. 7 c-7 f).
In step S610, the intersection test module 108 (specifically, the one or more box intersection test units 112) determines if the ray intersects a forward plane in the subset of dimensions at a location along the ray that is not farther than the location at which the ray intersects the identified backward plane. The subset of dimensions includes two dimensions for which the backward plane is not identified, but the subset of dimensions does not include dimensions for which the backward plane has been identified. This is because, as described above, the inventors have appreciated that for each dimension, a ray will intersect the forward plane of the axis-aligned box of that dimension before intersecting the backward plane of the axis-aligned box of that dimension. This is due in part to the fact that the axes of a particular dimension are parallel to the forward and rearward planes of the alignment frame. Thus, without performing any tests, the intersection test module 108 can learn that the ray 202 intersects an identified backward plane at a location along the ray that is farther than the ray intersects a forward plane in the dimension in which the backward plane has been identified. This implementation allows for a reduction in the number of tests that need to be performed to determine whether a ray intersects an axis alignment box. Two example methods for determining whether a ray intersects a forward plane in a subset of dimensions before intersecting an identified backward plane in step S610 are described in detail below.
For determining in step S610 whether the ray intersects a forward plane in the subset of dimensions at a location along the ray First method not far from the intersection of ray with identified backward plane
In a first method for performing step S610 described herein, step S610 includes: (i) Performing a first hybrid orientation test to determine which of an identified backward plane and a first forward plane of the box the ray intersects at a furthest location along the ray, wherein the first forward plane of the box is a forward plane of a first dimension of the subset of dimensions; (ii) Performing a second hybrid orientation test to determine which of the identified backward plane and a second forward plane of the box the ray intersects at a furthest location along the ray, wherein the second forward plane of the box is a forward plane of a second dimension of the subset of dimensions; and (iii) using the results of the first and second mixed-direction tests to determine whether the ray intersects a forward plane in the subset of dimensions at a location along the ray that is not farther than the location at which the ray intersects the identified backward plane. In this method, the first mixed-direction test and the second mixed-direction test do not depend on the results of each other, and thus they can be performed in parallel.
Fig. 7g to 7j show tests performed in different cases in step S610. For example, fig. 7g is the result of the situation shown in fig. 7c, wherein the backward plane of dimension j is identified in step S608. In this case, the first mixed-direction test and the second mixed-direction test determine on which side of the line defined by the two edges 710 and 712 the light passes. For example, a first hybrid direction test may determine whether toF k D j >B j D k . This test corresponds to which side of the line defined by edge 710 the test ray passes. If F k D j >B j D k The location at which the forward plane of dimension k intersects the ray is farther along the ray than the location at which the backward plane of dimension j intersects the ray (e.g., the ray passes below the line defined by edge 710) such that the ray will miss the box; and if F k D j ≤B j D k The forward plane of dimension k intersects the ray at a location along the ray that is no further than the backward plane of dimension j intersects the ray (e.g., the ray passes over the line defined by edge 710) such that the ray may intersect the box. The second hybrid direction test can determine whether F i D j >B j D i . This test corresponds to which side of the line defined by edge 712 the test ray passes. If F i D j >B j D i Then the location at which the forward plane of dimension i intersects the ray is farther along the ray than the location at which the backward plane of dimension j intersects the ray (e.g., the ray passes to the right of the line defined by edge 712) such that the ray will miss the box; and if F i D j ≤B j D i The forward plane of dimension i intersects the ray at a location along the ray that is no further than the backward plane of dimension j intersects the ray (e.g., the ray passes to the left of the line defined by edge 712) such that the ray may intersect the box. It should be noted that in step S608, B may have been calculated j D k And B j D i One or both of the values. These values may be recalculated in step S610 or may be saved during step S608 (e.g., in a register) so that they may be reused in step S610 without having to recalculate them.
As another example, fig. 7h and 7i are the results of the cases shown in fig. 7d and 7e, respectively, wherein the backward plane of dimension k is identified in step S608. In both cases, the first mixed-direction test and the second mixed-direction test determine on which side of the line defined by the two edges 714 and 716 the light passes. For example, the number of the cells to be processed,first hybrid direction test can determine whether F i D k >B k D i . This test corresponds to which side of the line defined by edge 714 the test ray passes. If F i D k >B k D i The location at which the forward plane of dimension i intersects the ray is farther along the ray than the location at which the backward plane of dimension k intersects the ray (e.g., the ray passes over the line defined by edge 714) such that the ray will miss the box; and if F i D k ≤B k D i The forward plane of dimension i intersects the ray at a location along the ray that is no further than the backward plane of dimension k intersects the ray (e.g., the ray passes below the line defined by edge 714) such that the ray may intersect the box. The second hybrid direction test can determine whether F j D k >B k D j . This test corresponds to which side of the line defined by edge 716 the test ray passes. If F j D k >B k D j Then the location at which the forward plane of dimension j intersects the ray is farther along the ray than the location at which the backward plane of dimension k intersects the ray (e.g., the ray passes over the line defined by edge 716) such that the ray will miss the box; and if F j D k ≤B k D j The forward plane of dimension j intersects the ray at a location along the ray that is no further than the backward plane of dimension k (e.g., the ray passes below the line defined by edge 716) such that the ray may intersect the box. It should be noted that in step S608, B may have been calculated k D i And B k D j One or both of the values. These values may be recalculated in step S610 or may be saved during step S608 (e.g., in a register) so that they may be reused in step S610 without having to recalculate them.
In order for a ray to intersect a box, the point at which the ray intersects two forward planes of the dimensional subset must not be farther from the ray origin than the point at which the ray intersects the identified backward plane of the box. In the examples described herein, no test need be performed to determine if a ray intersects an identified backward plane before intersecting a forward plane of a dimension for which the backward plane has been identified. In some examples (e.g., as described in the preceding paragraph), both the first mixed-direction test and the second mixed-direction test must pass to determine the hit of the ray with respect to the box, i.e., two tests are performed to determine that the ray does not intersect an identified backward plane before the ray intersects the respective forward planes of two dimensions in the subset of dimensions. However, in some other examples, in some cases, one of the hybrid-direction tests need not be performed. For example, in the case shown in FIG. 7h, only one mixed direction test is required in step S610 (i.e., which side of the line defined by edge 714 the test ray passes). If the box intersection test unit 112 can determine the geometry of the box such that only one test needs to be performed (e.g., in the case shown in fig. 7h, but not in the case shown in fig. 7 i), then only one test needs to be performed in step S610.
As another example, fig. 7j is the result of the situation shown in fig. 7f, wherein the backward plane of dimension i is identified in step S608. In this case, the first mixed-direction test and the second mixed-direction test determine on which side of the line defined by the two edges 718 and 720 the light passes. For example, a first hybrid direction test may determine whether F j D i >B i D j . This test corresponds to which side of the line defined by edge 718 the test ray passes. If F j D i >B i D j Then the location at which the forward plane of dimension j intersects the ray is farther along the ray than the location at which the backward plane of dimension i intersects the ray (e.g., the ray passes to the left of the line defined by edge 718), such that the ray will miss the box; and if F j D i ≤B i D j The forward plane of dimension j intersects the ray at a location along the ray that is no further than the backward plane of dimension i (e.g., the ray passes to the right of the line defined by edge 718) such that the ray may intersect the box. The second hybrid direction test can determine whether F k D i >B i D k . The test corresponds to the test light being at the free edgeWhich side of the line defined by edge 720 passes. If F k D i >B i D k Then the location at which the forward plane of dimension k intersects the ray is farther along the ray than the location at which the backward plane of dimension i intersects the ray (e.g., the ray passes below the line defined by edge 720) such that the ray will miss the box; and if F k D i ≤B i D k The forward plane of dimension k intersects the ray at a location along the ray that is no further than the backward plane of dimension i (e.g., the ray passes over the line defined by edge 720) such that the ray may intersect the box. It should be noted that in step S608, B may have been calculated i D j And B i D k One or both of the values. These values may be recalculated in step S610 or may be saved during step S608 (e.g., in a register) so that they may be reused in step S610 without having to recalculate them.
For determining in step S610 whether the ray intersects a forward plane in the subset of dimensions at a location along the ray Second method not farther than where ray intersects identified backward plane
In a second method for performing step S610 described herein, step S610 includes: (i) Performing a forward test to determine which of a first forward plane and a second forward plane of the box the ray intersects at a furthest location along the ray, wherein the first forward plane of the box is a forward plane of a first dimension in the subset of dimensions and the second forward plane of the box is a forward plane of a second dimension in the subset of dimensions; (ii) Performing a blending direction test to determine which of the identified backward plane and the determined forward plane of the box the ray intersects at a furthest location along the ray; and (iii) using the results of the hybrid orientation test to determine whether the ray intersects a forward plane in the subset of dimensions at a location along the ray that is not further than the location at which the ray intersects the identified backward plane.
In other words, in this approach, the furthest forward plane of the ray is determined, and then intersection test module 108 determines whether the furthest forward plane is farther along the ray than the nearest backward plane (i.e., the identified backward plane). If so, the ray misses the box.
For example, in fig. 7c, the backward plane of dimension j is identified in step S608. In this case, the forward test determines which of the forward planes of dimensions i and k intersects the ray at the furthest location along the ray. Forward testing may determine whether or not to F i D k >F k D i . If F i D k >F k D i The position where the forward plane of dimension i intersects the ray is farther along the ray than the position where the forward plane of dimension k intersects the ray; and if F i D k <F k D i The forward plane of dimension k intersects the ray at a location along the ray that is farther than the location along dimension i at which the forward plane intersects the ray. If F i D k =F k D i Either of the forward planes of dimension i or k may be selected. Hybrid direction testing can determine whether or not B j D far >F far D j Where the forward plane is determined to be denoted as "far" in the dimension along the furthest position of the ray (i or k in this case). If B is j D far <F far D j Then it has been determined that the location at which the forward plane intersects the ray is farther along the ray than the location at which the backward plane of dimension j intersects the ray, such that the ray will miss the box; and if B j D far ≥F far D j It has been determined that the forward plane intersects the ray at a location along the ray that is no further than the backward plane of dimension j. This means that rays may intersect the box, depending on the minimum and maximum distance conditions.
In the example shown in fig. 7d and 7e, the backward plane of dimension k is identified in step S608. In both cases, the forward test determines which of the forward planes of dimensions i and j intersects the ray at the furthest location along the ray. Forward testing may determine whether or not to F i D j >F j D i . If F i D j >F j D i Dimension ofi's forward plane intersects the ray along a ray's forward plane farther than the ray's dimension j's intersection; and if F i D j <F j D i The forward plane of dimension j intersects the ray at a location along the ray that is farther than the location along the forward plane of dimension i. If F i D j =F j D i Either of the forward planes of dimension i or j may be selected. Hybrid direction testing can determine whether or not B k D far >F far D k Where the forward plane is determined to be denoted as "far" in the dimension along the furthest position of the ray (i or j in this case). If B is k D far <F far D k Then it has been determined that the location at which the forward plane intersects the ray is farther along the ray than the location at which the backward plane of dimension k intersects the ray, such that the ray will miss the box; and if B k D far ≥F far D k It has been determined that the forward plane intersects the ray at a location along the ray that is no further than the backward plane of dimension k. This means that rays may intersect the box, depending on the minimum and maximum distance conditions.
In the example shown in fig. 7f, the backward plane of dimension i is identified in step S608. In this case, the forward test determines which of the forward planes of dimensions j and k intersects the ray at the furthest location along the ray. Forward testing may determine whether or not to F j D k >F k D j . If F j D k >F k D j The position where the forward plane of dimension j intersects the ray is farther along the ray than the position where the forward plane of dimension k intersects the ray; and if F j D k <F k D j The forward plane of dimension k intersects the ray at a location along the ray that is farther than the location along the forward plane of dimension j. If F j D k =F k D j Either of the forward planes of dimension j or k can be selected. Hybrid direction testing can determine whether or not B i D far >F far D i Wherein the forward plane is defined alongThe dimension of the furthest position of the ray (in this case j or k) is denoted as "far". If B is i D far <F far D i Then it has been determined that the location at which the forward plane intersects the ray is farther along the ray than the location at which the backward plane of dimension i intersects the ray, such that the ray will miss the box; and if B i D far ≥F far D i It has been determined that the forward plane intersects the ray at a location along the ray that is no further than the backward plane of dimension i. This means that rays may intersect the box, depending on the minimum and maximum distance conditions.
Steps S608 and S610 do not involve calculating the intersection distance to any plane of the box. Instead, steps S608 and S610 involve performing tests (e.g., forward, backward, and hybrid) to determine, for a pair of planes, which of the planes intersects the ray farther along the ray. This is achieved in the example described herein by comparing the values of the cross-multiplications, which operation does not involve calculating the intersection distance to the plane of the box. The intersection distance need not be calculated for the box intersection test performed by the box intersection test unit 112.
As described above, in some examples, one or more intermediate results determined in step S608 may be stored, and then in step S610, the stored one or more intermediate results may be read for use in determining in step S610 whether the ray intersected the forward plane in the subset of dimensions before it intersected the identified backward plane.
Returning to FIG. 6, at the end of step S610, the intersection test module has determined whether the ray will intersect the axis alignment box if the ray is infinitely long. This determination is used to determine whether the ray intersects the axis alignment box. It should be noted that the method determines whether a ray intersects a box without performing a test to determine if the ray intersects a forward plane in a dimension in which the backward plane has been identified before intersecting the identified backward plane. In this way, the methods described herein avoid performing some tests by conditioned on previous results. Further, it should also be noted that for any plane of the box, the intersection distance is not directly calculated.
In the example described above, step S610 contains at most two tests (and in some cases, for example in the case shown in fig. 7h, it is possible to perform only one test in step S610). Step S608 contains two or three tests, depending on the method employed. Thus, if a first method is used for step S608 (where step S608 involves performing two tests), the total number of tests is at most four, and in some cases, for example in the case shown in fig. 7h, may be only three. Furthermore, if a second method is used for step S608 (where step S608 involves performing three tests), the total number of tests is at most five, and in some cases, for example in the case shown in fig. 7h, may be only four.
If it is determined in step S610 that the ray intersects a forward plane in the subset of dimensions at a location along the ray that is farther than the location at which the ray intersects the identified backward plane, then the ray missing box is known, and the method proceeds from step S610 to step S616, where the ray missing box is determined (i.e., the ray does not intersect the box). If it is determined in step S610 that the ray intersects a forward plane in the subset of dimensions at a location along the ray that is not further than the location at which the ray intersects the identified backward plane, the method proceeds to step S612.
Steps S612 to S620 shown in fig. 6 correspond to steps S312 to S320 described above with reference to fig. 3. Specifically, in step S612, the intersection test module 108 (specifically, the box intersection test unit 112) determines whether the minimum distance condition and the maximum distance condition are satisfied. The minimum distance condition is satisfied if the minimum effective distance of the ray from the ray origin is less than or equal to the maximum distance from the ray origin to any intersection of the ray with a point within the box. In other words, if the origin of the ray (represented by the value t min Definition) does not exceed the box, the minimum distance condition is satisfied. In step S608, the backward plane of the box that intersects the ray at the closest location along the ray is identified, and this identification can be used to simplify the process of determining whether the minimum distance is met. For example, if the back of dimension i is identified in step S608A plane-wise direction, where i can be any of the x, y, or z dimensions, then the test to determine if the minimum distance condition is met includes determining if B i ≥D i t min . The other two dimensions may be omitted because the point at which the ray intersects the identified backward plane is important for the minimum distance condition. As described above, t min Is a parameter defining the minimum effective distance of a ray from the ray origin. If B is i ≥D i t min The minimum distance condition is satisfied; and if B i <D i t min The minimum distance condition is not satisfied. In the more general notation used above, B i Can be expressed as P 1,i . As mentioned above, in some examples, if any of the backward planes of the box has a negative constant value, i.e., if B i <0,B j < 0 or B k < 0 (i.e., if x max 、y max Or z max Negative of either), then the box is behind the ray, and thus, in these examples, intersection test module 108 can determine that the ray missed the box. This determination may be performed at any time after step S606, and if this determination determines that a ray missed box is due to the box being behind the ray (this may be referred to as a "gesture box"), the method may jump directly to step S616 without performing some or all of the tests described herein with reference to steps S608, S610, and S612.
The maximum distance condition is satisfied if the maximum effective distance of the ray from the ray origin is greater than or equal to the minimum distance from the ray origin to any intersection of the ray direction vector with a point within the box. In other words, if the end of the ray (represented by the value t max Definition) is not before the box, the maximum distance condition is satisfied. For example, determining whether the maximum distance condition is met may include determining whether F i ≤D i t max ,F j ≤D j t max And F k ≤D k t max . As described above, t max Is a parameter defining the maximum effective distance of a ray from the ray origin. If F i ≤D i t max 、F j ≤D j t max And F k ≤D k t max All three are true, the maximum distance condition is satisfied; and if F i >D i t max 、F j >d j t max And F k >D k t max If any one of them is true, the maximum distance condition is not satisfied. In the more general notation used above, F i 、F j And F k Can be respectively expressed as P 0,i 、P 0,j And P 0,k
The test performed in step S612 to determine whether the maximum distance condition is met and to determine whether the minimum distance condition is met may be performed in parallel with the test performed in step S610 to determine whether the ray intersects a forward plane in the subset of dimensions before intersecting the identified backward plane. This is because the test performed in step S612 does not depend on the result of the test performed in step S610. In embodiments where the block intersection test unit 112 is implemented in hardware (e.g., in fixed function circuitry), it may be particularly beneficial to perform the tests in parallel, and three comparisons may be performed independently, e.g., in parallel. In other examples (e.g., where the box intersection test unit 112 is implemented in software, e.g., in a module of computer code executing on a processing unit), the tests may be performed sequentially in steps S610 and S612, with the second test being performed only when the first test does not determine that a ray passed relative to the box, and the third test being performed only when the first test does not determine that a ray passed relative to the box, and so on. This sequential approach allows for determining a miss without having to perform all tests (if the test earlier in the sequence has determined that the ray was missed relative to the box).
The determination of whether the minimum distance condition and the maximum distance condition are satisfied in step S612 is used to determine whether the ray intersects the axis alignment box. If one or both of the minimum distance condition and the maximum distance condition are not met, the method proceeds from step S612 to step S616, where the intersection test module 108 (specifically, the box intersection test unit 112) determines that the ray does not intersect the box. However, if both the minimum distance condition and the maximum distance condition are satisfied, the method proceeds from step S612 to step S614, where the intersection test module 108 (specifically, the box intersection test unit 112) determines that the ray intersects the box. It should be noted that to implement step S614, i.e., to have the intersection test module determine that the ray intersects the axis-aligned box, it will be determined that the location at which the ray intersects the forward plane is not farther along the ray than the location at which the ray intersects the identified backward plane (in step S610), and it will be determined that the maximum and minimum distance conditions are met (in step S612).
After steps S614 and/or S616, the method proceeds to step S618, where the intersection test module 108 outputs an indication of the result of determining whether the ray intersected the box. This indication may be a binary indication (e.g., a one bit flag) to indicate a 'hit' or 'miss' of the ray with respect to the box. In other examples, the indication may have a different form. In step S620, (e.g., processing logic 110) renders an image of the 3D scene using the output indication in ray tracing system 100, e.g., in the same manner as described above with reference to step S320.
FIG. 8 illustrates a computer system in which a ray tracing system described herein may be implemented. The computer system includes a CPU 802, a GPU 804, a memory 806, and other devices 814, such as a display 816, speakers 818, and a camera 822. Ray traced unit 810 (corresponding to ray traced unit 102) is implemented on GPU 804 and Neural Network Accelerator (NNA) 811. In other examples, ray tracing unit 810 may be implemented on CPU 802 or within NNA 811, or as a separate processing unit in a computer system. The components of the computer system may communicate with each other via a communication bus 820. Storage 812 (corresponding to memory 104) is implemented as part of memory 806.
The ray tracing system of fig. 1 is shown as including several functional blocks. This is merely illustrative and is not intended to limit the strict division between the different logic elements of such entities. Each of the functional blocks may be provided in any suitable manner. It should be understood that intermediate values described herein as being formed by the ray tracing system need not be physically generated by the ray tracing system at any point in time, and may represent only logical values that facilitate description of the processing performed by the ray tracing system between its inputs and outputs.
The ray tracing units, and in particular the intersection test modules described herein, may be embodied in hardware on an integrated circuit. The intersection test module described herein can be configured to perform any of the methods described herein. Generally, any of the functions, methods, techniques, or components described above may be implemented in software, firmware, hardware (e.g., fixed logic circuitry) or any combination thereof. The terms "module," "function," "component," "element," "unit," "block," and "logic" may be used herein to generally represent software, firmware, hardware, or any combination thereof. In the case of a software implementation, the module, function, component, element, unit, block or logic represents program code that performs specified tasks when executed on a processor. The algorithms and methods described herein may be executed by one or more processors executing code that causes the processors to perform the algorithms/methods. Examples of a computer-readable storage medium include Random Access Memory (RAM), read-only memory (ROM), optical disks, flash memory, hard disk memory, and other memory devices that can store instructions or other data using magnetic, optical, and other techniques and that can be accessed by a machine.
The terms computer program code and computer readable instructions as used herein refer to any kind of executable code for execution by a processor, including code expressed in machine language, an interpreted language, or a scripting language. Executable code includes binary code, machine code, byte code, code defining an integrated circuit (e.g., a hardware description language or netlist), and code expressed in programming language code such as C, java or OpenCL. The executable code may be, for example, any kind of software, firmware, script, module, or library that, when properly executed, handled, interpreted, compiled, run in a virtual machine or other software environment, causes the processor of the computer system supporting the executable code to perform the tasks specified by the code.
The processor, computer, or computer system may be any kind of device, machine, or special purpose circuit, or a collection or portion thereof, that has processing capabilities such that instructions can be executed. The processor may be or include any kind of general purpose or special purpose processor, such as CPU, GPU, NNA, a system on a chip, a state machine, a media processor, an Application Specific Integrated Circuit (ASIC), a programmable logic array, a Field Programmable Gate Array (FPGA), or the like. The computer or computer system may include one or more processors.
The present invention is also intended to cover software defining a configuration of hardware as described herein, such as Hardware Description Language (HDL) software, for designing integrated circuits or for configuring programmable chips to perform desired functions. That is, a computer readable storage medium may be provided having encoded thereon computer readable program code in the form of an integrated circuit definition data set that, when processed (i.e., run) in an integrated circuit manufacturing system, configures the system to manufacture an intersection test module configured to perform any of the methods described herein, or to manufacture an intersection test module comprising any of the devices described herein. The integrated circuit definition data set may be, for example, an integrated circuit description.
Accordingly, a method of manufacturing an intersection test module as described herein at an integrated circuit manufacturing system may be provided. Furthermore, an integrated circuit definition data set may be provided that, when processed in an integrated circuit manufacturing system, enables a method of manufacturing an intersection test module to be performed.
The integrated circuit definition data set may be in the form of computer code, for example, as a netlist, code for configuring a programmable chip, as a hardware description language defining a device suitable for fabrication at any level in an integrated circuit, including as Register Transfer Level (RTL) code, as a high-level circuit representation (such as Verilog or VHDL), and as a low-level circuit representation (such as OASIS (RTM) and GDSII). Higher-level representations (such as RTL) logically defining hardware suitable for fabrication in an integrated circuit may be processed on a computer system configured to generate a fabrication definition of the integrated circuit in the context of a software environment including definitions of circuit elements and rules for combining these elements to generate a fabrication definition of the integrated circuit defined by the representations. As is typically the case when software is executed at a computer system to define a machine, one or more intermediate user steps (e.g., providing commands, variables, etc.) may be required to configure the computer system to generate a manufacturing definition for an integrated circuit to execute code that defines the integrated circuit to generate the manufacturing definition for the integrated circuit.
An example of processing an integrated circuit definition data set at an integrated circuit manufacturing system to configure the system to manufacture intersection test modules will now be described with respect to fig. 9.
Fig. 9 illustrates an example of an Integrated Circuit (IC) manufacturing system 902 configured to manufacture intersection test modules as described in any of the examples herein. Specifically, IC fabrication system 902 includes layout processing system 904 and integrated circuit generation system 906. The IC fabrication system 902 is configured to receive an IC definition data set (e.g., defining an intersection test module as described in any of the examples herein), process the IC definition data set, and generate an IC from the IC definition data set (e.g., embodying the intersection test module as described in any of the examples herein). The processing of the IC definition data set configures the IC fabrication system 902 to fabricate an integrated circuit embodying the intersection test module as described in any of the examples herein.
Layout processing system 904 is configured to receive and process the IC definition data set to determine a circuit layout. Methods of determining a circuit layout from an IC definition dataset are known in the art and may involve, for example, synthesizing RTL codes to determine a gate level representation of a circuit to be generated, for example in terms of logic components (e.g., NAND, NOR, AND, OR, MUX and FLIP-FLOP components). By determining the location information of the logic components, the circuit layout may be determined from the gate level representation of the circuit. This may be done automatically or with the participation of a user in order to optimize the circuit layout. When the layout processing system 904 has determined the circuit layout, it may output the circuit layout definition to the IC generation system 906. The circuit layout definition may be, for example, a circuit layout description.
As is known in the art, the IC generation system 906 generates ICs from circuit layout definitions. For example, the IC generation system 906 may implement a semiconductor device fabrication process that generates ICs, which may involve a multi-step sequence of photolithography and chemical processing steps during which electronic circuits are built up on wafers made of semiconductor material. The circuit layout definition may be in the form of a mask that may be used in a lithographic process to generate an IC from the circuit definition. Alternatively, the circuit layout definitions provided to the IC generation system 906 may be in the form of computer readable code that the IC generation system 906 may use to form an appropriate mask for generating the IC.
The different processes performed by IC fabrication system 902 may all be implemented at one location, e.g., by a party. Alternatively, IC fabrication system 902 may be a distributed system such that some processes may be performed at different locations and by different parties. For example, some of the following phases may be performed at different locations and/or by different parties: (i) Synthesizing RTL code representing the IC definition dataset to form a gate level representation of the circuit to be generated; (ii) generating a circuit layout based on the gate level representation; (iii) forming a mask according to the circuit layout; and (iv) using the mask to fabricate the integrated circuit.
In other examples, processing the integrated circuit definition data set at the integrated circuit manufacturing system may configure the system to manufacture intersection test modules without processing the IC definition data set to determine a circuit layout. For example, an integrated circuit definition dataset may define a configuration of a reconfigurable processor, such as an FPGA, and processing of the dataset may configure the IC manufacturing system to generate (e.g., by loading configuration data into the FPGA) the reconfigurable processor having the defined configuration.
In some embodiments, the integrated circuit manufacturing definition data set, when processed in the integrated circuit manufacturing system, may cause the integrated circuit manufacturing system to generate an apparatus as described herein. For example, an apparatus as described herein may be manufactured by configuring an integrated circuit manufacturing system from an integrated circuit manufacturing definition dataset in the manner described above with reference to fig. 9.
In some examples, the integrated circuit definition dataset may contain software running on or in combination with hardware defined at the dataset. In the example shown in fig. 9, the IC generation system may be further configured by the integrated circuit definition data set to load firmware onto the integrated circuit in accordance with program code defined at the integrated circuit definition data set at the time of manufacturing the integrated circuit or to otherwise provide the integrated circuit with program code for use with the integrated circuit.
Embodiments of the concepts set forth in the present application in apparatuses, devices, modules, and/or systems (and in methods implemented herein) may provide improved performance over known embodiments. Performance improvements may include one or more of increased computational performance, reduced latency, increased throughput, and/or reduced power consumption. During the manufacture of such devices, apparatuses, modules, and systems (e.g., in integrated circuits), a tradeoff may be made between performance improvements and physical implementations, thereby improving manufacturing methods. For example, a tradeoff can be made between performance improvement and layout area, matching the performance of known embodiments, but using less silicon. This may be accomplished, for example, by reusing the functional blocks in a serial fashion or sharing the functional blocks among elements of an apparatus, device, module, and/or system. In contrast, the concepts set forth in the present application that lead to improvements in the physical implementation of devices, apparatus, modules and systems, such as reduced silicon area, may be compromised for performance improvements. This may be accomplished, for example, by fabricating multiple instances of the module within a predefined area budget.
The applicant hereby discloses in isolation each individual feature described herein and any combination of two or more such features, to the extent that such features or combinations are capable of being carried out based on the present specification as a whole in light of the common general knowledge of a person skilled in the art, irrespective of whether such features or combinations of features solve any problems disclosed herein. In view of the foregoing description it will be evident to a person skilled in the art that various modifications may be made within the scope of the application.

Claims (20)

1. A method of determining whether a ray intersects a three-dimensional axis alignment box in a ray tracing system, wherein the three-dimensional axis pair Ji Kuang represents a volume defined by a forward plane and a backward plane of each dimension of the three-dimensional axis alignment box, the method comprising:
identifying which of the forward planes of the three-dimensional axis alignment box intersects the ray at a furthest location along the ray;
determining whether the ray intersects an identified forward plane at a location along the ray that is not further than a location along the ray that intersects the backward plane in a subset of dimensions, wherein the subset of dimensions includes two dimensions for which the forward plane is not identified, but wherein the subset of dimensions does not include dimensions for which the forward plane has been identified; and
determining whether the ray intersects the three-dimensional axis alignment box using the determination of whether the ray intersects the identified forward plane at a location along the ray that is not further than a location at which the ray intersects the backward plane in the subset of dimensions,
wherein if it is determined that the ray intersects the identified forward plane at a location along at least one of the ray's locations that are farther than the ray's locations that intersect the backward plane in the subset of dimensions, it is determined that the ray does not intersect the three-dimensional axis alignment box, and
Wherein the method determines whether the ray intersects the three-dimensional axis alignment box without performing a test to determine if the ray intersects the identified forward plane at a location along the ray that is not further than a location along the backward plane in the dimension in which the forward plane has been identified.
2. The method of claim 1, wherein the steps of identifying which of the forward planes of the three-dimensional axis alignment box intersects the ray at a furthest location along the ray and determining whether a location at which the ray intersects the identified forward plane is no farther along the ray than a location at which the ray intersects the backward planes in a subset of dimensions are performed without calculating an intersection distance to any of the forward planes and the backward planes of the three-dimensional axis alignment box.
3. The method of claim 1 or 2, wherein the identifying which of the forward planes of the three-dimensional axis alignment box intersects the ray at a furthest location along the ray comprises:
performing a first forward test to determine which of a first forward plane and a second forward plane of the three-dimensional axis alignment box the ray intersects at a furthest position along the ray; and
A second forward test is performed to determine which of the determined forward planes and a third forward plane of the three-dimensional axis alignment box the ray intersects at a furthest location along the ray, thereby identifying which of the forward planes of the three-dimensional axis alignment box intersects the ray at a furthest location along the ray.
4. The method of claim 1 or 2, wherein the identifying which of the forward planes of the three-dimensional axis alignment box intersects the ray at a furthest location along the ray comprises:
performing a first forward test to determine which of a first forward plane and a second forward plane of the three-dimensional axis alignment box the ray intersects at a furthest position along the ray;
performing a second forward test to determine which of the first and third forward planes of the three-dimensional axis alignment box the ray intersects at a furthest position along the ray;
performing a third forward test to determine which of the second forward plane and the third forward plane of the three-dimensional axis alignment box the ray intersects at a furthest position along the ray; and
Results of each of the first, second, and third forward tests are used to identify which of the forward planes of the three-dimensional axis alignment box intersects the ray at a furthest location along the ray.
5. The method of claim 1 or 2, wherein the determining whether the ray intersects the identified forward plane at a location along the ray that is not further than a location at which the ray intersects the backward plane in the subset of dimensions comprises:
performing a first hybrid orientation test to determine which of the identified forward plane and a first backward plane of the three-dimensional axis alignment box the ray intersects at a furthest location along the ray, wherein the first backward plane of the three-dimensional axis alignment box is a backward plane of a first dimension of the subset of dimensions;
performing a second hybrid orientation test to determine which of the identified forward plane and a second backward plane of the three-dimensional axis alignment box the ray intersects at a furthest location along the ray, wherein the second backward plane of the three-dimensional axis alignment box is a backward plane of a second dimension of the subset of dimensions; and
The results of each of the first and second hybrid-direction tests are used to determine whether the location at which the ray intersects the identified forward plane is no farther along the ray than the location at which the ray intersects the backward plane in the subset of dimensions.
6. The method of claim 1 or 2, wherein the determining whether the ray intersects the identified forward plane at a location along the ray that is not further than a location at which the ray intersects the backward plane in the subset of dimensions comprises:
performing a backward test to determine which of a first backward plane and a second backward plane of the three-dimensional axis alignment box the ray intersects at a closest location along the ray, wherein the first backward plane of the three-dimensional axis alignment box is a backward plane of a first dimension of the subset of dimensions and the second backward plane of the three-dimensional axis alignment box is a backward plane of a second dimension of the subset of dimensions;
performing a hybrid orientation test to determine which of the identified forward and determined backward planes of the three-dimensional axis alignment box the ray intersects at a furthest position along the ray; and
The results of the hybrid orientation test are used to determine whether the ray intersects the identified forward plane at a location along the ray that is not further than the location at which the ray intersects the backward plane in the subset of dimensions.
7. The method of claim 1 or 2, wherein the forward test, backward test, or hybrid test for determining which of the first and second planes of the three-dimensional axis alignment box the ray intersects at the furthest position along the ray comprises combining P m,i D j And P n,j D i Comparison is made, wherein P m,i Is a constant component value of the first plane in the ith dimension, where P n,j Is a constant component value of the second plane in the j-th dimension, where D i And D j The components of the direction vector of the ray in the ith and the jth dimensions, respectively, where if P m,i D j >P n,j D i Determining that the ray intersects the first plane at a location along the ray that is farther than the location at which the ray intersects the second plane, and if P m, i D j <P n,j D i Determining that the ray intersects the second plane at a location along the ray that is farther than the ray intersects the first planeThe location of the intersection is such that,
wherein the first plane is: (i) The forward plane of dimension i and having a component value P for the ith dimension 0,i Or (ii) the backward plane of dimension i and has a component value P for the ith dimension 1,i And (2) and
wherein the second plane is: (i) The forward plane of dimension j and has a component value P for the j-th dimension 0,j Or (ii) the backward plane of dimension j and has a component value P for the j-th dimension 1,j
8. The method of claim 1 or 2, further comprising:
one or more intermediate results stored in the forward plane identifying which of the three-dimensional axis alignment boxes intersected by the ray at a furthest location along the ray; and
the stored one or more intermediate results are read for use in the determining if the location at which the ray intersects the identified forward plane is no farther along the ray than the location at which the ray intersects the backward plane in the subset of dimensions.
9. The method of claim 1 or 2, further comprising determining whether a maximum distance condition is met, wherein the maximum distance condition is met if the maximum effective distance of the ray from the ray origin is greater than or equal to a minimum distance from the ray origin to any intersection of the ray with a point within the three-dimensional axis alignment box,
Wherein the determining whether the ray intersects the three-dimensional axis pair Ji Kuang further comprises using the determination of whether the maximum distance condition is met.
10. The method of claim 1 or 2, further comprising determining whether a minimum distance condition is satisfied, wherein the minimum distance condition is satisfied if a minimum effective distance of the ray from the ray origin is less than or equal to a maximum distance from the ray origin to any intersection of the ray with a point within the three-dimensional axis alignment box,
wherein the determining whether the ray intersects the three-dimensional axis pair Ji Kuang further comprises using the determination of whether the minimum distance condition is met.
11. The method of claim 10, further comprising determining whether a maximum distance condition is met, wherein the maximum distance condition is met if a maximum effective distance of the ray from a ray origin is greater than or equal to a minimum distance from the ray origin to any intersection of the ray with a point within the three-dimensional axis alignment box, wherein the determining whether the ray intersects the three-dimensional axis pair Ji Kuang further comprises using the determination of whether the maximum distance condition is met, and
Wherein the determining whether a maximum distance condition is met and the determining whether a minimum distance condition is met are performed in parallel with the determining whether the ray intersects the identified forward plane along a location where the ray intersects the backward plane in a subset of dimensions no farther than the ray.
12. A method of determining whether a ray intersects a three-dimensional axis alignment box in a ray tracing system, wherein the three-dimensional axis pair Ji Kuang represents a volume defined by a forward plane and a backward plane of each dimension of the three-dimensional axis alignment box, the method comprising:
identifying which of the backward planes of the three-dimensional axis alignment box intersects the ray at a nearest location along the ray;
determining whether the ray intersects the forward plane in a subset of dimensions that includes two dimensions for which the backward plane is not identified, but wherein the subset of dimensions does not include dimensions for which the backward plane has been identified, along the ray no farther than the ray intersects an identified backward plane; and
determining whether the ray intersects the three-dimensional axis alignment box using the determination of whether the ray intersects the forward plane in the subset of dimensions at a location along the ray that is not further than a location at which the ray intersects the identified backward plane,
Wherein if it is determined that the ray intersects at least one of the forward planes in the subset of dimensions at a location along the ray that is farther than the location at which the ray intersects the identified backward plane, it is determined that the ray does not intersect the three-dimensional axis alignment box, and
wherein the method determines whether the ray intersects the three-dimensional axis alignment box without performing a test to determine if a location of the ray intersecting the forward plane in the dimension where the backward plane has been identified is not farther along the ray than a location of the ray intersecting the identified backward plane.
13. The method of claim 12, wherein the identifying which of the backward planes of the three-dimensional axis alignment box intersects the ray at a closest location along the ray comprises:
performing a first backward test to determine which of a first backward plane and a second backward plane of the three-dimensional axis alignment box the ray intersects at a closest location along the ray; and
a second backward test is performed to determine which of the determined backward planes and a third backward plane of the three-dimensional axis alignment box the ray intersects at a closest location along the ray, thereby identifying which of the backward planes of the three-dimensional axis alignment box intersects the ray at a closest location along the ray.
14. The method of claim 12, wherein the identifying which of the backward planes of the three-dimensional axis alignment box intersects the ray at a closest location along the ray comprises:
performing a first backward test to determine which of a first backward plane and a second backward plane of the three-dimensional axis alignment box the ray intersects at a closest location along the ray;
performing a second backward test to determine which of the first backward plane and a third backward plane of the three-dimensional axis alignment box the ray intersects at a closest location along the ray;
performing a third backward test to determine which of the second backward plane and the third backward plane of the three-dimensional axis alignment box the ray intersects at a closest location along the ray; and
results of each of the first, second, and third backward tests are used to identify which of the backward planes of the three-dimensional axis alignment box intersects the ray at a closest location along the ray.
15. The method of any of claims 12 to 14, wherein the determining whether the ray intersects the forward plane in the subset of dimensions at a location along the ray that is not further than a location at which the ray intersects the identified backward plane comprises:
Performing a first hybrid orientation test to determine which of the identified backward plane and a first forward plane of the three-dimensional axis alignment box the ray intersects at a furthest location along the ray, wherein the first forward plane of the three-dimensional axis alignment box is a forward plane of a first dimension of the subset of dimensions;
performing a second blending orientation test to determine which of the identified backward plane and a second forward plane of the three-dimensional axis alignment box the ray intersects at a furthest location along the ray, wherein the second forward plane of the three-dimensional axis alignment box is a forward plane of a second dimension of the subset of dimensions; and
the results of each of the first and second hybrid-direction tests are used to determine whether the ray intersects the forward plane in the subset of dimensions at a location along the ray that is not further than the location at which the ray intersects the identified backward plane.
16. The method of any of claims 12 to 14, wherein the determining whether the ray intersects the forward plane in the subset of dimensions at a location along the ray that is not further than a location at which the ray intersects the identified backward plane comprises:
Performing a forward test to determine which of a first forward plane and a second forward plane of the three-dimensional axis alignment box the ray intersects at a furthest location along the ray, wherein the first forward plane of the three-dimensional axis alignment box is a forward plane of a first dimension of the subset of dimensions and the second forward plane of the three-dimensional axis alignment box is a forward plane of a second dimension of the subset of dimensions;
performing a hybrid orientation test to determine which of the identified backward plane and the determined forward plane of the three-dimensional axis alignment box the ray intersects at a furthest position along the ray; and
using the results of the hybrid orientation test to determine whether the ray intersects the forward plane in the subset of dimensions at a location along the ray that is not further than the location at which the ray intersects the identified backward plane.
17. The method of any of claims 12-14, further comprising selectively reversing axes of components of the ray and the three-dimensional axis alignment box such that D i ≥0,D j Not less than 0 and D k 0, then identifying which of the forward planes of the three-dimensional axis alignment box intersects the ray at the furthest location along the ray, wherein D i 、D j And D k The components of the direction vector of the ray for dimension i, dimension j and dimension k, respectively.
18. An intersection testing apparatus for use in a ray tracing system configured to determine whether a ray intersects a three-dimensional axis alignment box, wherein the three-dimensional axis pair Ji Kuang represents a volume defined by a forward plane and a backward plane of each dimension of the three-dimensional axis alignment box, the intersection testing apparatus comprising:
means for identifying which of the forward planes of the three-dimensional axis alignment box intersects the ray at a furthest location along the ray;
means for determining whether the ray intersects an identified forward plane at a location along the ray that is not further than a location along the ray that intersects the backward plane in a subset of dimensions, wherein the subset of dimensions includes two dimensions for which the forward plane is not identified, but wherein the subset of dimensions does not include dimensions for which the forward plane has been identified; and
means for determining whether the ray intersects the three-dimensional axis alignment box using the determination of whether the ray intersects the identified forward plane at a location along the ray that is not further than a location at which the ray intersects the backward plane in the subset of dimensions,
Means for determining that the ray does not intersect the three-dimensional axis alignment box if it is determined that the ray intersects the identified forward plane at a location along at least one of the ray's locations that are farther than the ray intersects the backward plane in the subset of dimensions, and
wherein, the crossing testing arrangement still includes: means for determining whether the ray intersects the three-dimensional axis alignment box without performing a test to determine if the ray intersects the identified forward plane no further along the ray than the ray intersects the backward plane in the dimension in which the forward plane has been identified.
19. An intersection testing apparatus for use in a ray tracing system configured to determine whether a ray intersects a three-dimensional axis alignment box, wherein the three-dimensional axis pair Ji Kuang represents a volume defined by a forward plane and a backward plane of each dimension of the three-dimensional axis alignment box, the intersection testing apparatus comprising:
means for identifying which of the backward planes of the three-dimensional axis alignment box intersects the ray at a nearest location along the ray;
Means for determining whether the ray intersects the forward plane in a subset of dimensions that includes two dimensions for which the backward plane is not identified, but wherein the subset of dimensions does not include dimensions for which the backward plane has been identified, along which the ray does not intersect further than the identified backward plane; and
means for determining whether the ray intersects the axis alignment box using the determination of whether the ray intersects the forward plane in a subset of dimensions no further along the ray than the ray intersects the identified backward plane,
means for determining that the ray does not intersect the three-dimensional axis alignment box if it is determined that the ray intersects at least one of the forward planes in the subset of dimensions at a location along the ray that is farther than the location at which the ray intersects the identified backward plane, and
wherein, the crossing testing arrangement still includes: means for determining whether the ray intersects the three-dimensional axis alignment box without performing a test to determine if the ray intersects the forward plane in the dimension where the backward plane has been identified is no farther along the ray than the ray intersects the identified backward plane.
20. A non-transitory computer readable storage medium having computer readable code stored thereon, the computer readable code configured to cause the method according to any one of claims 1 to 17 to be performed when the computer readable code is run.
CN202210262491.1A 2021-03-23 2022-03-17 Method, intersection testing device and medium for determining intersection in ray tracing system Active CN115115758B (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
GB2104055.5 2021-03-23
GB2104055.5A GB2599182B (en) 2021-03-23 2021-03-23 Intersection testing in a ray tracing system

Publications (2)

Publication Number Publication Date
CN115115758A CN115115758A (en) 2022-09-27
CN115115758B true CN115115758B (en) 2023-10-31

Family

ID=75690011

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210262491.1A Active CN115115758B (en) 2021-03-23 2022-03-17 Method, intersection testing device and medium for determining intersection in ray tracing system

Country Status (4)

Country Link
US (2) US11741659B2 (en)
EP (1) EP4113449A1 (en)
CN (1) CN115115758B (en)
GB (1) GB2599182B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102037497A (en) * 2008-03-21 2011-04-27 柯斯提克绘图有限公司 Architectures for parallelized intersection testing and shading for ray-tracing rendering
CN102947865A (en) * 2010-04-29 2013-02-27 柯斯提克绘图公司 Systems and methods for primitive intersection in ray tracing
US8564589B1 (en) * 2010-05-17 2013-10-22 Nvidia Corporation System and method for accelerated ray-box intersection testing
CN107111890A (en) * 2014-10-17 2017-08-29 高通股份有限公司 Use the light box test for intersection of the fixing function logic based on dot product
CN108090947A (en) * 2018-01-03 2018-05-29 沈阳品尚科技有限公司 A kind of ray tracing optimization method towards 3D scenes
CN109087384A (en) * 2017-06-14 2018-12-25 想象技术有限公司 Compressed radiation direction data in ray trace system
CN110930497A (en) * 2020-02-11 2020-03-27 南京芯瞳半导体技术有限公司 Global illumination intersection acceleration method and device and computer storage medium

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7495664B2 (en) * 2000-06-19 2009-02-24 Mental Images Gmbh Instant ray tracing
US7499053B2 (en) * 2000-06-19 2009-03-03 Mental Images Gmbh Real-time precision ray tracing
US7414624B2 (en) * 2005-10-28 2008-08-19 Intel Corporation Apparatus and method for a frustum culling algorithm suitable for hardware implementation
KR102242566B1 (en) * 2014-06-30 2021-04-20 삼성전자주식회사 Apparatus and method for processing ray tracing
US9552664B2 (en) * 2014-09-04 2017-01-24 Nvidia Corporation Relative encoding for a block-based bounding volume hierarchy
US10242485B2 (en) * 2014-09-04 2019-03-26 Nvidia Corporation Beam tracing
US10477200B2 (en) * 2017-04-13 2019-11-12 Facebook, Inc. Panoramic camera systems
US10970914B1 (en) * 2019-11-15 2021-04-06 Imagination Technologies Limited Multiple precision level intersection testing in a ray tracing system
US11790593B2 (en) * 2020-03-13 2023-10-17 Advanced Micro Devices, Inc. Ray-tracing multi-sample anti-aliasing

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102037497A (en) * 2008-03-21 2011-04-27 柯斯提克绘图有限公司 Architectures for parallelized intersection testing and shading for ray-tracing rendering
CN102947865A (en) * 2010-04-29 2013-02-27 柯斯提克绘图公司 Systems and methods for primitive intersection in ray tracing
US8564589B1 (en) * 2010-05-17 2013-10-22 Nvidia Corporation System and method for accelerated ray-box intersection testing
CN107111890A (en) * 2014-10-17 2017-08-29 高通股份有限公司 Use the light box test for intersection of the fixing function logic based on dot product
CN109087384A (en) * 2017-06-14 2018-12-25 想象技术有限公司 Compressed radiation direction data in ray trace system
CN108090947A (en) * 2018-01-03 2018-05-29 沈阳品尚科技有限公司 A kind of ray tracing optimization method towards 3D scenes
CN110930497A (en) * 2020-02-11 2020-03-27 南京芯瞳半导体技术有限公司 Global illumination intersection acceleration method and device and computer storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
JEFFREY MAHOVSKY等.Fast Ray-Axis Aligned Bounding Box Overlap Tests with Plucker Coordinates.Journal of Graphics Tools.2004,第9卷(第1期),第35-46页. *

Also Published As

Publication number Publication date
GB2599182A9 (en) 2022-08-17
GB2599182B (en) 2022-10-26
EP4113449A1 (en) 2023-01-04
CN115115758A (en) 2022-09-27
US20230410409A1 (en) 2023-12-21
US20220335678A1 (en) 2022-10-20
GB2599182A (en) 2022-03-30
GB202104055D0 (en) 2021-05-05
US11741659B2 (en) 2023-08-29

Similar Documents

Publication Publication Date Title
CN110827389A (en) Strict ray triangle intersection
CN112907717B (en) Multi-precision horizontal intersection testing in ray tracing systems
CN115115764B (en) Intersection test method, device and medium in ray tracing system
CN114119841A (en) Intersection testing in ray tracing systems
US11010963B2 (en) Realism of scenes involving water surfaces during rendering
CN115115765B (en) Intersection testing in ray tracing systems
US20200193684A1 (en) Efficient data path for ray triangle intersection
US20230401781A1 (en) Intersection testing in a ray tracing system using axis-aligned box coordinate components
CN115115758B (en) Method, intersection testing device and medium for determining intersection in ray tracing system
US20220350606A1 (en) Performing comparison operations using vector floating point values
CN115512031A (en) Graphics processing
CN115115761B (en) Method, apparatus and medium for determining whether a ray intersects a three-dimensional axis alignment box
US20230031189A1 (en) Transformation of data in a ray tracing system
US20220350566A1 (en) Performing comparison operations using extended exponent range floating point values
CN113936087A (en) Intersection testing in ray tracing systems
GB2607456A (en) Intersection testing in a ray tracing system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant