Intersection testing in ray tracing systems
By projecting the vertex coordinates of the element to the ray space and analyzing the symbols, we can determine whether the rays and the element intersect, which solves the problem of intersecting test calculations in the ray tracing system, and achieves the effect of reducing power consumption and hardware requirements.
Patent Information
- Application Number
- CN202411359332.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-09-29
- Filing Date
- 2024-09-27
- Publication Date
- 2025-04-01
AI Technical Summary
Ray tracing systems require a large number of intersecting tests when rendering scene images, resulting in increased power consumption, hardware requirements and delays, and the prior art is difficult to effectively reduce these problems.
By projecting the vertex coordinates of the primitives into the ray space, analyzing the symbols of the vertex coordinate data in the ray space, and determining whether the disintersection condition is met, thereby determining whether the ray intersects the primitives and avoiding unnecessary floating-point operations.
This method can quickly determine whether the light rays intersect with the element without performing floating point calculations, reduce the calculation amount of intersection tests, reduce the system's power consumption and hardware requirements, and improve rendering efficiency.
Smart Images

Figure CN119741418A_ABST
Abstract
Description
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims priority to UK patent application GB2315023.8 filed on September 29, 2023, the entirety of which is incorporated herein by reference. Technical Field
[0003] The present disclosure relates to a method of processing a primitive as part of an intersection test in a ray tracing system, the primitive being defined by an ordered set of vertices, and to an intersection test module configured to perform processing of the primitive as part of the intersection test in the ray tracing system. Background Art
[0004] Ray tracing is a computational rendering technique used to generate an image of a scene by tracing the path of light from the camera's perspective through the scene. The path of light may also be referred to as light. Each ray is modeled as originating from a camera and entering the scene through a pixel. When the ray crosses the scene, it may intersect with an object in the scene. The intersection between the ray and the object it intersects may be modeled to create realistic visual effects. For example, in response to determining that the ray intersects with the object, a shader program may be executed for the intersection. A programmer may write a shader program to define how the system reacts to the intersection, which may, for example, cause one or more secondary rays to be emitted into the scene. For example, if the object is transparent or translucent, the secondary ray may represent the reflection of the ray from the intersected object or the refraction of the ray through the object. As another example, a shader program may cause one or more rays to be emitted into the scene to determine whether the object is in the shadow at the intersection. The result of executing the shader program (and processing the associated secondary rays) may be the color value of the pixel through which the ray is calculated.
[0005] Rendering an image of a scene using ray tracing may involve performing many intersection tests of different rays against objects present in the scene. A ray tracing system may perform billions of intersection tests to render an image of a scene. Intersection tests typically involve complex floating point operations that are computationally intensive and, if the ray tracing system is implemented in hardware, require a large amount of physical silicon area. Therefore, methods for reducing the power consumption, hardware requirements, and latency of intersection tests are desirable. Summary of the invention
[0006] 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.
[0007] A method for performing intersection testing of rays about primitives in a ray tracing system is provided, the primitives being defined by an ordered set of vertices, the method comprising:
[0008] receiving (i) data defining a direction and an origin of a ray to be tested against a primitive, and (ii) coordinate data of a set of two or more of the vertices, the set of two or more vertices defining at least one edge of the primitive;
[0009] projecting coordinate data for the set of two or more vertices into a ray space using the ray data, wherein the ray space has two non-parallel axes each transverse to a direction of the ray, wherein a ray space reference system associated with the two non-parallel axes is centered at the point on the ray, such that the ray is represented as the point on the two non-parallel axes in the ray space, and wherein the point is the origin of the ray space;
[0010] analyzing the signs of the coordinate data of the set of two or more vertices in the ray space to determine whether a disjoint condition is satisfied, wherein satisfaction of the disjoint condition indicates that the ray does not intersect the primitive; and
[0011] In response to determining that the disjoint condition is satisfied, it is determined that the ray does not intersect the primitive.
[0012] A method for performing intersection testing of rays about primitives in a ray tracing system is provided, the primitives being defined by an ordered set of vertices, the method comprising:
[0013] receiving (i) data defining a direction and an origin of a ray to be tested against a primitive, and (ii) coordinate data of a set of two or more of the vertices, the set of two or more vertices defining at least one edge of the primitive;
[0014] projecting coordinate data for the set of two or more vertices into a ray space using the ray data, wherein the ray space has two non-parallel axes each transverse to a direction of the ray, wherein a ray space reference system associated with the two non-parallel axes is centered at the point on the ray, such that the ray is represented as the point on the two non-parallel axes in the ray space, and wherein the point is the origin of the ray space;
[0015] analyzing the signs of the coordinate data of the set of two or more vertices in the ray space to determine whether a disjoint condition is satisfied, wherein satisfaction of the disjoint condition indicates that the ray does not intersect the primitive; and
[0016] In response to determining that the disjoint condition is not satisfied, additional intersection testing is performed on the primitive with respect to the ray.
[0017] The analyzing the signs of the coordinate data of the set of two or more vertices in ray space may be performed as part of an intersection test of the ray with respect to the primitive without performing any floating point calculations beforehand.
[0018] The method may also include performing a zero comparison on the coordinate data of each vertex in the set of two or more vertices.
[0019] The sign of the coordinate data of a set of two or more vertices in ray space may indicate the orientation of at least one edge of the primitive.
[0020] The sign of the coordinate data of a set of two or more vertices in ray space can be used to determine the winding order of the primitive.
[0021] The set of two or more vertices may include a first pair of vertices defining a first edge of the primitive, and analyzing the sign of the coordinate data of the set of two or more vertices in ray space may include determining whether:
[0022] The sign of the first coordinate of the first vertex in the first pair of vertices in the ray space is different from the sign of the first coordinate of the second vertex in the first pair of vertices, and the sign of the second coordinate of the first vertex in the first pair of vertices in the ray space is the same as the sign of the second coordinate of the second vertex in the first pair of vertices; or
[0023] The sign of the second coordinate of the first vertex in the first pair of vertices in the ray space is different from the sign of the second coordinate of the second vertex in the first pair of vertices, and the sign of the first coordinate of the first vertex in the first pair of vertices in the ray space is the same as the sign of the first coordinate of the second vertex in the first pair of vertices.
[0024] Analysis of the sign of the coordinate data of the first pair of vertices in ray space can be used to determine the orientation of the first edge of the primitive.
[0025] The non-intersection condition may be satisfied if the orientation of a first edge of a primitive matches a predetermined orientation, which indicates that the ray does not intersect a primitive including an edge having this orientation.
[0026] The orientation of the first side of the primitive may be defined according to the orientations of two non-parallel axes indicated by data flags used to translate the coordinates of a first pair of vertices in ray space.
[0027] The data flag may be a single bit.
[0028] The set of two or more vertices may be a set of three or more vertices forming at least two pairs of vertices, a first pair of vertices defining a first side of the primitive and a second pair of vertices defining a second side of the primitive, and analyzing the sign of the coordinate data of the set of two or more vertices in the ray space may include determining whether the following conditions exist:
[0029] the sign of the first coordinate in ray space of the first vertex in the second pair of vertices is different from the sign of the first coordinate of the second vertex in the second pair of vertices, and the sign of the second coordinate in ray space of the first vertex in the second pair of vertices is the same as the sign of the second coordinate of the second vertex in the second pair of vertices; or
[0030] The sign of the second coordinate of the first vertex in the second pair of vertices in the ray space is different from the sign of the second coordinate of the second vertex in the second pair of vertices, and the sign of the first coordinate of the first vertex in the second pair of vertices in the ray space is the same as the sign of the first coordinate of the second vertex in the second pair of vertices.
[0031] Analysis of the signs of the coordinate data of the first pair of vertices and the second pair of vertices in ray space may be used to determine the orientation of the first edge and the second edge of the primitive.
[0032] The disjoint condition may be satisfied if the orientation of the first side of the primitive is different from the orientation of the second side of the primitive.
[0033] A set of two or more vertices may be a complete set of ordered vertices defining a primitive.
[0034] Analyzing the sign of coordinate data of a set of two or more vertices in ray space may include analyzing the sign of at least a first coordinate in ray space of all vertices in a complete set of vertices defining a primitive.
[0035] The non-intersection condition is satisfied if at least one of the following is true:
[0036] The sign of the first coordinate in ray space is the same for all vertices in the complete set of ordered vertices; or
[0037] The sign of the second coordinate in ray space is the same for all vertices in the complete set of ordered vertices.
[0038] The coordinate data for each vertex in a set of two or more vertices in ray space may include:
[0039] a first coordinate along a first of the two non-parallel axes; and
[0040] The second coordinate along the second axis of the two non-parallel axes.
[0041] The first non-parallel axis may be perpendicular to the second non-parallel axis in the ray space, and both the first non-parallel axis and the second non-parallel axis may be perpendicular to the direction of the ray.
[0042] If it is determined that the ray does not intersect a primitive, no further intersection tests may be performed on the ray for this primitive.
[0043] This method can be used to render an image of the scene.
[0044] An intersection test module for performing intersection tests of rays about primitives in a ray tracing system is provided, wherein the primitives are defined by an ordered set of vertices, and the intersection test module is configured to:
[0045] receiving (i) data defining a direction and an origin of a ray to be tested against a primitive, and (ii) coordinate data of a set of two or more of the vertices, the set of two or more vertices defining at least one edge of the primitive;
[0046] projecting coordinate data for the set of two or more vertices into a ray space using the ray data, wherein the ray space has two non-parallel axes each transverse to a direction of the ray, wherein a ray space reference system associated with the two non-parallel axes is centered at the point on the ray, such that the ray is represented as the point on the two non-parallel axes in the ray space, and wherein the point is the origin of the ray space;
[0047] analyzing the signs of the coordinate data of the set of two or more vertices in the ray space to determine whether a disjoint condition is satisfied, wherein satisfaction of the disjoint condition indicates that the ray does not intersect the primitive; and
[0048] In response to determining that the disjoint condition is satisfied, it is determined that the ray does not intersect the primitive.
[0049] The intersection testing module may also be configured to perform additional intersection testing on the primitive with respect to the ray in response to determining that the disjoint condition is not satisfied.
[0050] A method for processing a primitive for intersection testing in a ray tracing system is provided, the primitive being defined by an ordered set of vertices, the method comprising:
[0051] receiving (i) data defining a ray to be tested against a primitive, and (ii) coordinate data for a set of three or more vertices, the set of three or more vertices defining the primitive;
[0052] For each vertex of the primitive, use the coordinate data of this vertex to determine the distance component of the length of the vertex along the ray;
[0053] comparing the determined distance component of each of the vertices to at least one of a minimum valid distance value and a maximum valid distance value for the ray; and
[0054] A ray is determined not to intersect a primitive in response to any of the following:
[0055] Determining that the determined distance components of all vertices of the primitive are less than the minimum valid distance; or
[0056] It is determined that the determined distance components of all vertices of the primitive are greater than the maximum valid distance.
[0057] The method may also include comparing the determined distance component of each of the vertices to both a minimum valid distance value and a maximum valid distance value for the ray.
[0058] The distance component of each vertex can be determined by looking at the first coordinate of each of the vertices.
[0059] The ray may be represented using a ray direction vector, and the first coordinate may be along an axis corresponding to the component of the ray direction vector having a largest magnitude.
[0060] Comparing the determined distance component of each of the vertices to at least one of a minimum valid distance value and a maximum valid distance value for the ray may include observing coordinate data of the vertex in a spatial coordinate system in which the primitive is defined.
[0061] The method may also include projecting coordinate data of the set of three or more vertices into a ray space using the ray data, wherein the ray space has two non-parallel axes that are both transverse to the direction of the ray, a ray space reference system associated with the two non-parallel axes is centered on the point on the ray, such that the ray is represented as this point on the two non-parallel axes in the ray space, and the point is the origin of the ray space.
[0062] Comparing the determined distance component of each of the vertices to at least one of a minimum valid distance value and a maximum valid distance value of the ray may be performed based on the projected coordinate data.
[0063] The light may be represented using a light direction vector, and the method may further comprise calculating, using the projected coordinate data, an indication of the coordinate value of each vertex along an axis in the spatial coordinate system for which the component of the light direction vector has a maximum magnitude.
[0064] Calculating an indication of a coordinate value of a vertex along an axis in the spatial coordinate system for which a component of the light direction vector has a maximum magnitude may comprise scaling the coordinate value by said component of the light direction vector having the maximum magnitude.
[0065] Scaling the coordinate values by the component of the light direction vector having the largest magnitude may be performed such that:
[0066]
[0067] Its i where are the coordinates of the i-th vertex, D maj is the component of the light direction vector with the largest magnitude, and r i ′ is the rescaled vertex coordinate of the i-th vertex.
[0068] The ray may be represented using a ray direction vector, and the method may include scaling the minimum and maximum valid distance values for the ray using the component of the ray direction vector having the largest magnitude.
[0069] Scaling the minimum effective distance value and the maximum effective distance value of the ray may include multiplying the minimum effective distance value and the maximum effective distance value by the component of the ray direction vector having the largest magnitude.
[0070] A rescaling of the minimum valid distance value of the ray can be performed such that:
[0071] t′ min =D maj t min
[0072] where t min is the minimum effective distance of the light, D maj is the principal component of the light direction, and t′ min is the rescaled minimum valid distance value for the ray.
[0073] A rescaling of the maximum effective distance value for the ray can be performed such that:
[0074] t′ max =D maj t max
[0075] Its max is the maximum effective distance of the light, D maj is the principal component of the light direction, and t′ min is the rescaled maximum valid distance value for the ray.
[0076] In response to determining that the ray does not intersect a primitive, no additional intersection tests may be performed with respect to the ray for this primitive.
[0077] This method can be used to render an image of the scene.
[0078] An intersection test module for processing a primitive as part of an intersection test in a ray tracing system is provided, the primitive being defined by an ordered set of vertices, the intersection test module being configured to:
[0079] receiving (i) data defining a ray to be tested against a primitive, and (ii) coordinate data for a set of three or more vertices, the set of three or more vertices defining the primitive;
[0080] For each vertex of the primitive, use the coordinate data of this vertex to determine the distance component of the length of the vertex along the ray;
[0081] comparing the determined distance component of each of the vertices to at least one of a minimum valid distance value and a maximum valid distance value for the ray; and
[0082] A ray is determined not to intersect a primitive in response to any of the following:
[0083] Determining that the determined distance components of all vertices of the primitive are less than the minimum valid distance; or
[0084] It is determined that the determined distance components of all vertices of the primitive are greater than the maximum valid distance.
[0085] The intersection test module can also be configured to perform additional intersection tests on the primitive with respect to the ray in response to determining that: (i) the determined distance component for less than all of the vertices of the primitive is less than the minimum valid distance, and (ii) the determined distance component for less than all of the vertices of the primitive is greater than the maximum valid distance.
[0086] The intersection test module may be further configured to compare the determined distance component of each of the vertices to a minimum valid distance value and a maximum valid distance value of the ray.
[0087] The ray may be represented using a ray direction vector, and the determined distance component for each vertex may be determined by observing a first coordinate of each of the vertices, the first coordinate being along an axis corresponding to the component of the ray direction vector having the largest magnitude.
[0088] The intersection testing module may be configured to compare the determined distance component of each of the vertices with at least one of a minimum valid distance value and a maximum valid distance value of the ray by observing the coordinate data of the vertices in a spatial coordinate system in which the primitive is defined.
[0089] The intersection test module can also be configured to project coordinate data of a set of three or more vertices into a ray space using the ray data, wherein the ray space has two non-parallel axes that are both transverse to the direction of the ray, a ray space reference system associated with the two non-parallel axes is centered on the point on the ray, so that the ray is represented as this point on the two non-parallel axes in the ray space, and the point is the origin of the ray space, wherein the projected coordinate data can be used to perform a comparison of the determined distance component of each of the vertices with at least one of a minimum valid distance value and a maximum valid distance value of the ray.
[0090] The intersection test module may be embodied in hardware on an integrated circuit. A method of manufacturing the intersection test module at an integrated circuit manufacturing system may be provided. An integrated circuit definition data set may be provided, which, when processed in the integrated circuit manufacturing system, configures the system to manufacture the intersection test module. A non-transitory computer-readable storage medium may be provided, having stored thereon a computer-readable description of the intersection test module, which, when processed in the integrated circuit manufacturing system, causes the integrated circuit manufacturing system to manufacture an integrated circuit embodying the intersection test module.
[0091] An integrated circuit manufacturing system can be provided, comprising: a non-transitory computer-readable storage medium having stored thereon a computer-readable description of an intersection test module; a layout processing system configured to process the computer-readable description to generate a circuit layout description of an integrated circuit embodying the intersection test module; and an integrated circuit generation system configured to manufacture the intersection test module based on the circuit layout description.
[0092] A computer program code for performing any of the methods described herein may be provided. A non-transitory computer readable storage medium may be provided on which computer readable instructions are stored which, when executed in a computer system, cause the computer system to perform any of the methods described herein.
[0093] As will be apparent to the skilled person, the above features may be combined as appropriate and may be combined with any aspect of the examples described herein. BRIEF DESCRIPTION OF THE DRAWINGS
[0094] Examples will now be described in detail with reference to the accompanying drawings, in which:
[0095] Figure 1 A ray tracing system configured to perform an intersection test on each of a plurality of rays for a node of a hierarchical acceleration structure is shown;
[0096] Figure 2 shows the intersection between rays and primitives in world space;
[0097] Figure 3 Shows Figure 2 Projection of the primitives into the light space;
[0098] Figure 4 A first method of processing primitives as part of intersection testing in a ray tracing system is shown;
[0099] Figure 5 The analysis used for Figure 4 A first sub-method of the sign of the coordinate data shown;
[0100] Figure 6 The analysis used for Figure 4 A second sub-method of the sign of the coordinate data shown;
[0101] Figure 7 Shows that you can use Figure 5 The primitives are culled by the method shown;
[0102] Figure 8 Shows that you can use Figure 6 The primitives are culled by the method shown;
[0103] Fig. 9 The analysis used for Figure 4 The third sub-method of the sign of the coordinate data shown;
[0104] Fig.10 Shows that you can use Fig. 9 The primitives are culled by the method shown;
[0105] Fig.11 A second method of processing primitives as part of intersection testing in a ray tracing system is shown;
[0106] Fig.12 Shows that you can use Fig.11 The primitives are culled by the method shown;
[0107] Fig.13 It shows that the Figure 1 A computer system for an intersection test module; and
[0108] Fig.14 An integrated circuit manufacturing system for producing an integrated circuit including a graphics processing system is shown.
[0109] The accompanying drawings show various examples. The skilled person will appreciate that the element boundaries (e.g., boxes, groups of boxes, or other shapes) shown in the accompanying drawings represent an example of boundaries. In some examples, it may be the case that an element can be designed as multiple elements, or multiple elements can be designed as one element. Where appropriate, common reference numerals are used throughout the accompanying drawings to indicate similar features. DETAILED DESCRIPTION
[0110] The following description is presented by way of example to enable one skilled in the art to make and use the invention.The present 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.
[0111] Embodiments will now be described by way of example only.
[0112] Figure 1 A ray tracing system 100 configured to perform intersection testing is shown. Intersection testing is performed to render an image in a scene. Rendering a scene image using ray tracing may involve performing many intersection tests. The ray tracing system includes a ray tracing unit 102 and a memory 104. The ray tracing unit 102 includes a processing module 106, an intersection testing module 108, and a processing logic 110. The intersection testing module 108 includes one or more box intersection testing modules 112 and one or more primitive intersection testing modules 114. In operation, the ray tracing unit 102 receives geometric data defining an object within a 3D scene. 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 testing module 108 can retrieve nodes of the acceleration structure from the memory 104 to perform ray intersection tests for the retrieved nodes. The results of the intersection test are provided to the processing logic 110. The processing logic 110 is configured to process the results of the intersection test to determine a processing value representing the image of the 3D scene.The processing value determined by the processing logic 110 may be transferred back to the memory 104 for storage therein to represent the image of the 3D scene.
[0113] Typically, when performing an intersection test between a light and a primitive, the light is defined according to the components (i.e., coordinates) in the spatial coordinate system in which the primitive is defined. However, the light data defining the light can be used to derive a light coordinate system relative to the light itself, so that the primitive to be tested for a given light can be mapped to the light coordinate system derived from the data of this light. The term "spatial coordinate system" is used here to refer to the coordinate system in which the primitive is defined. "Spatial coordinate system" can be a world space coordinate system or an example space coordinate system. In most examples described herein, the spatial coordinate system is a three-dimensional coordinate system. The shape, size, and position of the primitive can be defined as an area of a three-dimensional space completely contained in the plane of the three-dimensional coordinate system, and can be defined by n≥3 line segments. Each of the interior angles of the primitive can be less than or equal to 180°. Primitives with all interior angles less than or equal to 180° are called convex polygons. Strictly convex polygons are convex polygons with all interior angles strictly less than 180°.
[0114] The terms "ray coordinate system" and "ray space" are used herein to refer to a coordinate system that is specific to a ray and has its origin on the ray. In the examples described in detail herein, the origin of the ray coordinate system is the origin of the ray, but in other examples, the origin of the ray coordinate system is the origin of the ray, with appropriate adjustments to the minimum culling distance and maximum culling distance (t min and t max ), any point on the light ray (i.e., any point along the line of the light ray) can be used as the origin of the light ray coordinate system. The light ray coordinate system has three basis vectors. The first basis vector of the basis vectors is aligned with the light ray direction. The second basis vector and the third basis vector are transverse to the first basis vector (or are not parallel to the first basis vector). Both the second basis vector and the third basis vector of the basis vectors can be orthogonal to the first basis vector and are not parallel to each other. The second basis vector and the third basis vector of the light ray coordinate system are generally not orthogonal to each other, although in some examples they may be orthogonal to each other. In the examples described herein, when expressed in the spatial coordinate system, the second basis vector and the third basis vector of the light ray coordinate system have 0 as a component. In some examples, when expressed in the spatial coordinate system, the second basis vector and the third basis vector of the basis vectors of the light ray coordinate system have a value of ±1 (i.e., a magnitude of 1) for one component.
[0115] In the example described below, the intersection test module 108 uses a ray coordinate system to perform an intersection test to determine whether a ray intersects a primitive, where the ray and the primitive are defined in 3D space using a spatial coordinate system. The result of performing the intersection test on the ray is output from the intersection test module 108 for use by the ray tracing system, for example, to determine which shader program the processing logic 110 executes for the ray.
[0116] By subtracting the ray origin from the position of the vertices defining the primitive in world space, the vertices defining the primitive can be translated for performing intersection tests using the ray coordinate system. Subtracting the ray origin from the position of the vertices defining the primitive means that the position of the primitive is then defined relative to the origin of the ray. By first displacing the vertices using the ray origin, all relative errors in downstream calculations are centered about the ray origin. In an alternative example, the vertices defining the primitive can be translated after ray space projection by pre-calculating the 2D coordinates of the ray origin in its own ray space coordinate system for each ray.
[0117] Figure 2 An exemplary ray 202 and an exemplary primitive 204 are shown presented for intersection testing. In this example, the exemplary primitive is a convex polygon. More specifically, the exemplary primitive 204 is a triangle. As viewed from the perspective of the ray, the orientation of the primitive is indicated as clockwise. The primitive 204 consists of an ordered set of vertices (vertices 0 ,v 1 ,v 2 ) definition. Each vertex has a set of coordinate values in the spatial coordinate system, where each coordinate value is a measurement of the vertex along a corresponding axis of the spatial coordinate system. For primitive 204, the first vertex v 0 can have a set of coordinates (x 0 ,y 0 ,z 0 ), the second vertex v 1 can have a set of coordinates (x 1 ,y 1 ,z 1 ), and the third vertex v 2 can have a set of coordinates (x 2 ,y 2 ,z 2 Each pair of vertices of the primitive 204 can define a corresponding edge of the primitive. The primitive 204 includes three edges: 0 ,v 1 ) defined by the first edge, defined by the vertex (v 1 ,v 2 ) and the second edge defined by the vertex (v 2 ,v 0 ) defined by the third side. As described above, the light ray 202, namely r(t), can be expressed as r(t)=O+Dt, where O is a vector representing the origin of the light ray and D is a direction vector of the light ray, where O=(O x ,O y ,O z ) and D=(D x ,D y ,D z ). Figure 2The x, y, and z basis vectors of the spatial coordinate system are shown. As described above, the spatial coordinate system can be the world space coordinate system of the scene being rendered, or the spatial coordinate system can be an example spatial coordinate system of a set of example geometric shapes within the scene being rendered. The origin of the ray coordinate system used in the intersection test is the origin of the ray. The positions of the vertices defining the primitive 204 are translated by subtracting the ray origin from the positions of the vertices. Figure 2 In the example shown, ray 202 intersects primitive 204 at intersection point 206. Figure 2 In the above example, the basic vectors of the light coordinate system are represented by P, Q and R. The first basic vector R of the light coordinate system is set to be along the direction of the light, R = A (D x ,D y ,D z ), where A is a scalar value. Figure 2 The ray origin of the ray coordinate system shown in is located at the intersection of the P, Q and R axes, at position O.
[0118] The second and third basis vectors P and Q can be defined as and More generally, and as Figure 2 As shown in the example, P = B (D z ,0,-D x ) and Q=C(0,D z ,-D y ), where B and C are any non-zero scalar values. Figure 2 In the example of , R is orthogonal to P and Q, which can be seen in PR = QR = 0. However, depending on D x and D y For example, unless D x or D y is zero, otherwise P and Q would not be orthogonal to each other. Note that D z cannot be zero, because the selective permutation of the axes makes D z are the principal components of the light direction, and since a valid light direction vector must have non-zero magnitude in order to define a line (although it can be strictly negative).
[0119] Figure 3 Shows Figure 2 The primitive 204 has been projected onto a pair of axes aligned with the basis vectors P and Q (i.e., the second basis vector and the third basis vector of the light coordinate system). Therefore, Figure 3 The primitives are viewed from the perspective of the light (i.e., the "eye" is positioned at the origin of the light and "looks" along the light direction vector). Figure 3In the example shown in , the P axis and the Q axis are perpendicular or orthogonal to the direction of the light ray 202. Note that in other examples, the P axis and the Q axis can be transverse (i.e., not parallel) but not oriented perpendicularly relative to the light ray direction. The P and Q axes, together with the R axis pointing into the page, define the "ray space" of the light ray 202. From Figure 2 The ray origin O of is shown at the origin 206 of the reference system defined by the axes P and Q because the reference system is shown from the perspective of the ray, i.e., the ray origin O and Figure 2 The intersection point 206 now coincides. The ray direction R points into the page, for example, where the components of the ray direction vector along the P and Q axes are zero. Therefore, the intersection position 206 of the ray with the primitive 204 is Figure 3 is at the origin. Figure 3 Indicates the orientation of primitive 204 Figure 3 , as determined by the winding order of its vertices. The winding order of a primitive is the order of the vertices that define that primitive, ignoring any cyclic factors. In other words, only "odd" arrangements of vertices are considered to indicate a different winding order between one primitive and another. Thus, a first primitive may be determined to be different from a second primitive if the order of those vertices differs by an odd arrangement (e.g., ordered back to front) between the first primitive and the second primitive, even if the two primitives are defined by the same vertices. Figure 3 , the light coordinate system basis vectors P and Q are shown as being at right angles to each other, even though they may not be orthogonal in the space coordinate system, where this implicit "clipping" does not affect subsequent hit or intersection attribute calculations. Each vertex of primitive 204 is defined by a set of coordinate values in the light coordinate system, where each coordinate value is a measurement of the vertex along a corresponding axis of the light coordinate system. For primitive 204, the first vertex v 0 can have a first set of ray space coordinates (p 0 ,q 0 ,r 0 ), the second vertex v 1 can have a second set of coordinates (p 1 ,q 1 ,r 1 ), and the third vertex v 2 We can have a third set of coordinates (p 2 ,q 2 ,r 2 ). In some examples, r i For each ray space vertex, no calculation may be performed when performing an intersection test on the primitive. That is, the intersection distance may be determined without calculating the third ray space coordinate of each vertex in the primitive. i Can be used to store the chief ray space coordinates of each primitive vertex, as described in further detail below.
[0120] The ray coordinate system can be left-handed or right-handed. Figure 3 In a right-handed coordinate system, one of the P or Q axes is reversed so that the Q axis points downward or the P axis points from right to left (or alternatively the axes are reordered as QPR, RQP, or PRQ). A left-handed coordinate system can be described as a counterclockwise coordinate system because the rotation from the first basis vector to the second basis vector (e.g., Figure 3 A left-handed coordinate system can be described as a clockwise system because the rotation from the first basis vector to the second basis vector (such as Figure 3 The handedness of the coordinate system may affect the perceived orientation of the primitives (given a fixed primitive winding). For example, Figure 3 As shown, a right-handed coordinate system can reverse the primitive orientation relative to the viewpoint of the ray, and a left-handed coordinate system can maintain the primitive orientation. To indicate the handedness of the ray coordinate system, a wrap flag can be supplied to the user to set when a spatial coordinate system with the opposite handedness to that expected is desired. This wrap flag indicates that any intersection orientation results should be reversed, and one method for achieving this is to indicate that all edges should be treated as pointing in opposite directions.
[0121] Projecting the primitive into ray space during intersection testing is advantageous because it simplifies the test to a 2D problem. A ray is determined to intersect a primitive only if the primitive covers the origin of both the P and Q axes in ray space. After primitive 204 is projected into ray space, intersection testing for this primitive also includes determining a parameter w that indicates which side of the e-th edge of primitive 204 the ray passes. For primitive 204, e is a number between 1 and 3. For example, w can be a signed parameter that uses the two projected vertices v that define the e-th edge of the primitive. i and v j is a function of the position of (which is referred to herein as the “2D cross product”) f(v i ,v j ) to determine. Define the two projected vertices v of the edge i and v j The 2D cross product of the position f(v i ,v j ) is defined as f(v i ,v j )=p i ,q j -q i ,p j , where p i and qi is the projected vertex v i The components along the corresponding axes of the pair of axes, and where p j and q j is the projected vertex v j The component along the corresponding axis of the pair of axes. In other examples, other functions defining the positions of the two projected vertices of the edge can be used to determine the parameter w. The sign of w for the e-th edge of primitive 204 indicates the angle from the edge (from v i Point to v j ) to see whether the ray passes on the left or right side of this edge. Passing on the "right" side of the edge corresponds to a clockwise rotation from the first end point to the second end point relative to the origin. For the above as f(v i ,v j )=p i ,q j -q i ,p j The form of the "2D cross product" is given by , and with the first axis pointing to the right and the second axis pointing upward, left / counterclockwise corresponds to positive results for f, and right / clockwise corresponds to negative results for f. Assuming a left-handed system (according to Figure 2 and Figure 3 ), and aligning the first axis P and the second axis Q to the right and top respectively in projected space, we have a third axis R (the direction of the ray) pointing into the page. This gives Figure 3 In a right-handed system, the third axis R points out of the page, giving Figure 3 Opposite perceptual orientation.
[0122] Once the w parameter has been determined for all the edges of the primitive 204, it can be determined whether the light intersects with the primitive based on the sign of the w parameter determined for the edge of the primitive. In the example, if the w parameters determined for the edge of the primitive all have the same sign, it is determined that the light intersects with the primitive, and if the w parameters determined for the edge of the primitive do not all have the same sign, it is determined that the light does not intersect with the primitive. That is, the intersection test includes using the parameters determined for the edge of the primitive to determine whether the light passes through the "inside" of the edge of the primitive when the (convex) primitive is regarded as a whole, wherein if it is determined that the light passes through the inside of all the edges of the primitive, it is determined that the light intersects with the primitive. Similarly, if it is determined that the light passes through the "outside" of one or more edges in the edge of the primitive, it is determined that the light does not intersect with the primitive.
[0123] Performing intersection testing by determining the 2D cross product of each edge of the primitive as described above involves floating point operations and can therefore be considered computationally expensive. For this reason, it is advantageous if the number of cross product calculations that must be performed by the intersection test module can be minimized. Before performing these advanced calculations, the calculations can be minimized by culling or removing primitives from the intersection processing. If it can be determined that a primitive does not intersect a ray without performing floating point operations, culling primitives from the intersection test processing can be performed. Removing primitives in this manner can be achieved via the processing methods described below. The methods described below may also be additionally referred to as "pre-processing methods" because they are prior to substantial intersection testing (i.e., 2D cross product calculations). The processing methods can be used to render images in a scene because they are used to inform subsequent intersection tests required to render the scene.
[0124] Figure 4 A first approach to processing primitives as part of intersection testing in a ray tracing system is shown in FIG. Figure 4 The method can be performed on a ray to be tested against this primitive or on a bundle of rays to be tested against a primitive. In the following description, the term "ray" is used to refer to both a single ray and a bundle of rays. Figure 4 The method is executed before any floating point calculations are performed for intersection testing of the ray with respect to the primitive. If the result of the method is a determination that the ray does not intersect the primitive, no further intersection tests are performed on the primitive for that ray. In other words, no substantial floating point calculations are performed on the primitive. The method may be performed by an intersection testing module (such as Figure 1 Module 108 shown in FIG. 1 is executed.
[0125] Figure 4 The method begins at step S402, which includes receiving data defining the direction and origin of a ray to be tested against a primitive. In other words, at step S402, data defining the ray to be tested against a primitive is received. The ray data may be provided by Figure 1 The ray data may define a primary ray or a secondary ray. The ray data may be retrieved by the intersection testing module 108 from a memory accessible to the intersection testing module. The origin of a ray is the point from which the ray is considered to originate (e.g., a viewpoint of a scene or a camera). The direction of a ray indicates the orientation of the ray through the scene to be rendered. As described above, the origin and direction of a ray together define the ray. The direction and origin of a ray are used to project the vertices of a primitive into the ray coordinate system of this ray.
[0126] Figure 4The method further comprises receiving coordinate data of a primitive at step S404. More specifically, step S404 comprises receiving coordinate data of a set of two or more vertices defining the primitive. The set of two or more vertices defines at least one edge of the primitive. As mentioned above, each primitive in the scene to be rendered is defined by an ordered set of vertices, and each edge of the primitive is defined by two ordered vertices of these ordered vertices. The coordinate data may indicate the coordinates of each vertex in the set of vertices. The coordinate data may include one or more vertex coordinates of each vertex in the set of vertices. The vertex coordinates are an indication of the position of this vertex along an axis. The vertex coordinates may define the position of each vertex of the set of vertices in a spatial coordinate system. That is, the vertex coordinates may define a coordinate system in which the primitive is defined. The spatial coordinate system may be a world space coordinate system or an instance space coordinate system. The coordinate data may be received simultaneously with the light data. The coordinate data may be received sequentially after or before the light data. The coordinate data may be received from a pipeline of primitive data, wherein the primitive will be processed sequentially by light. The coordinate data may be received from a position different from the light data.
[0127] Once the ray data and coordinate data are received by the intersection test module, then at step S406, the method includes projecting the coordinate data of the set of two or more vertices into ray space using the ray data. That is, the coordinate data is projected from the space coordinate system into the ray coordinate system. As described above, the coordinate data is projected into the ray space by defining basis vectors P, Q, and R, where R is set to be the coordinate along the ray R=A(D x ,D y ,D z ) direction, where A is a scalar value. The second and third basis vectors P and Q are defined as P = B (D z ,0,-D x ) and Q=C(0,D z ,-D y ) values. The P and Q axes of ray space are defined as two non-parallel axes that are both transverse to the direction R of the ray. The origin of the ray space of the ray. The projection of vertex coordinates into ray space can be performed as an initial step of intersection testing before real (i.e. floating point) intersection testing.
[0128] After the coordinate data of the primitive is projected into the light space, then in step S408, the signs of the coordinate data of the set of two or more vertices in the light space are analyzed to determine whether the non-intersection condition is met. That is, the signs of the coordinate data of the set of two or more vertices are compared with the non-intersection condition. When compared with the origin of the light space, the sign of the coordinate data indicates the orientation of the vertex coordinates along one or more axes of the light space. That is, the sign of the vertex coordinate data indicates whether the position of the vertex is positive or negative relative to the corresponding light space axis. "Non-intersection condition" may also be referred to as a test, or a determination of whether a certain scene is true. The non-intersection condition determines whether the sign of the coordinate data meets a predetermined standard. The non-intersection condition may require that the signs of the vertex coordinates be compared with each other. Alternatively, the non-intersection condition may require that the signs of the vertex coordinates be compared with another value. Examples of non-intersection conditions that can be met in step S408 are provided below. In some examples, the non-intersection condition requires that the orientation of one or more edges of the primitive (each edge is defined by a corresponding pair of vertices) is the same as the corresponding predetermined orientation. In other examples, the non-intersection condition requires that the signs of certain vertex coordinates of the primitive are the same as each other.
[0129] If the non-intersection condition is satisfied (i.e., the answer to the test at step S410 is yes), the method proceeds to step S412, where it is determined that the ray does not intersect the primitive. Figure 4 In the method, the satisfaction of the non-intersection condition indicates that the ray does not intersect the primitive. Therefore, if the sign of the vertex coordinates passes the test at step S410, then this means that there is a "missing" between the ray and the primitive. The intersection test module can be configured to determine that the ray does not intersect the primitive in response to determining that the vertex coordinates satisfy the non-intersection condition. Possible results of this determination are explained below.
[0130] Alternatively to step S412, if the non-intersection condition is not met (i.e., the answer to the test in step S410 is no), then it is not determined that the ray does not intersect the primitive. That is, the intersection test module can be configured to determine that if the non-intersection condition is not met, additional testing is required to determine whether there is an intersection between the ray and the primitive. Therefore, the method proceeds to step S414, in which the primitive is submitted for additional intersection testing. The additional intersection testing may include performing floating point operations (e.g., 2D dot cross product calculations) to determine whether there is an intersection between the ray and the primitive.
[0131] Analyzing the sign of the coordinate data may include comparing the sign of a first coordinate of a first vertex of the primitive in ray space with the sign of a first coordinate of one or more other vertices of the primitive in ray space. For example, in ray space, where each vertex of the primitive has a p-coordinate and a q-coordinate, Figure 4The method may include comparing the sign of the p-coordinate of the first vertex of the primitive with the p-coordinates of one or more other vertices of the primitive. Analyzing the sign of the coordinate data may include comparing the signs of two or more coordinates of the first vertex of the primitive with two or more corresponding coordinates of one or more other vertices of the primitive. As mentioned above, two or more vertices in the set of two or more vertices define at least one edge of the primitive. Analyzing the sign of the coordinate data of the set of two or more vertices in the ray space may indicate whether the edge has intersected an axis of two non-parallel axes in the ray space. More specifically, if the sign of the first coordinate of the first edge defining vertex is different from the sign of the first coordinate of the second edge defining vertex, then the edge may be defined to intersect at least one axis. For example, if the edge is defined by vertex v o ,v 1 Define, and v 0 The p coordinate has the same 1 The p coordinates have different signs, which means that the edge v o ,v 1 must intersect the Q axis. Similarly, if v 0 The q coordinate of v 1 The q coordinates have different signs, which means that the edge v o ,v 1 It must intersect the P axis. This is described in further detail below.
[0132] Figure 4 The method may also include performing a zero comparison on the coordinate data of each vertex in the set of two or more vertices. That is, method step S408 involves assigning a sign to each coordinate value of the set of vertices in the ray space by performing a zero comparison. A zero comparison is a comparison that compares a value with zero to determine whether the value is greater than or less than zero. In the context of coordinate data, a zero comparison determines the position of a vertex coordinate relative to the origin of a coordinate system, or compares the position with the origin. If a vertex coordinate is greater than (and not equal to) zero, it is "strictly positive". If a vertex coordinate is less than (and not equal to) zero, it is defined as "strictly negative". Once it has been determined whether a coordinate is greater than or less than zero, a sign can be assigned to the coordinate (e.g., a + sign indicates a strictly positive value, and a - sign indicates a strictly negative value). Alternatively, a flag can be assigned to a coordinate to determine whether it is greater than or less than zero (e.g., a data bit value of 0 indicates a strictly positive value, and a data bit value of 1 indicates a strictly negative value). This flag can be a data bit, referred to as a "sign bit". Zero comparisons are used in the methods described herein because these types of comparisons are cheap and effective using minimal hardware space and processing power. In an alternative example, Figure 4The method may include performing an ε comparison on the coordinate data of each vertex in a set of two or more vertices. In some examples, it may not be possible to ensure the precision or accuracy of vertex values close to zero. Therefore, in order to ensure conservative intersection results, it may be necessary to slightly "fill" the coordinate comparison by checking that the coordinate is <-ε or >ε, rather than <0 or >0, for a (small) strictly positive error value ε. These comparisons may alternatively be replaced by non-strict inequalities. The magnitude of the error value may be absolute or relative. For example, the error value may be relative to the magnitude of the vertex coordinate after translation according to the ray origin but before projection into ray space. Note that an "ε comparison" may be slightly more expensive than a "zero comparison" because comparison with zero is typically the simplest comparison operation performed in floating-point arithmetic.
[0133] The sign of the coordinate data of a set of two or more vertices in the ray space can be used to indicate the orientation of an edge. An edge can have a counterclockwise or clockwise orientation. From the perspective of the ray, when the ray (i.e., the origin of the ray space) passes on the right-hand side of the edge relative to the direction of the edge, the edge has a clockwise orientation. From the perspective of the ray, when the ray (i.e., the origin of the ray space) passes on the left-hand side of the edge relative to the direction of the edge, the edge has a counterclockwise orientation. When the observed vertex is a pair of vertices that define an edge, the sign of the vertex coordinate data of the primitive can be used to determine the orientation of the edge of the primitive. This is explained in further detail below.
[0134] The sign of the coordinate data of the set of two or more vertices in the light space can be used to determine the winding order of the primitive. The order of the vertices in the primitive is used to determine the winding order of the primitive (for the edge, this means their direction). Therefore, the winding order of the primitive affects the orientation of the edge of the primitive in the light space (that is, from the angle of the light). In addition to this sorting, the orientation of the edge of the primitive depends on the vertex coordinates of the primitive in the light space. For example, if the sign of a pair of vertex coordinates defining the edge of the primitive indicates that this edge has a counterclockwise orientation, it can be derived from it that if a hit occurs, the primitive as a whole will have a counterclockwise orientation. Similarly, if a pair of vertex coordinates defining the edge of the primitive indicates that this edge has a clockwise orientation, it can be derived from it that if a hit occurs, the primitive as a whole will have a clockwise orientation. Determining the orientation of the primitive may help determine what type of (if any) additional processing will be performed on this primitive, as described in further detail below.
[0135] Steps S408 to S414 constitute Figure 4The analysis step of the method shown in is shown as reference numeral 416. As mentioned above, as described in S408, there may be multiple methods of analyzing the signs of the coordinate data of two or more vertices, and as introduced in step S410, there may be different types of non-intersection conditions. Figure 5 , Figure 6 and Fig. 9 Some more detailed examples of analysis steps that may be performed in steps S408 to S414 are shown in FIG.
[0136] Figure 5 A first example of the analysis step 416 is shown. Figure 5 The analysis method shown in includes analyzing the vertex coordinates of the first pair of vertices of the primitive. The first pair of vertices can define the edge of the first primitive. Therefore, Figure 5 The method requires only the coordinate data of a pair of vertices that define the edge of the primitive to be tested. Figure 5 When the method is used, step S404 may include receiving coordinate data of only two vertices defining an edge of the primitive. Alternatively, step S404 may include receiving coordinate data of multiple vertices defining the primitive, and sequentially performing the steps for each of the edges of the primitive defined by these vertices. Figure 5 By analyzing the signs of the vertex coordinates of a pair of vertices defining an edge in ray space, it can be determined whether the edge intersects one or more of the axes defining the PQ plane. This determination can then be used to determine the orientation of the edge in the ray coordinate system. Once the orientation of the edge has been determined, it can be determined based on a culling scheme whether the edge is guaranteed not to intersect the primitive.
[0137] Figure 5 The exemplary method shown in considers a pair of vertices v defining an edge of a primitive 0 ,v 1 . Vertex v 0 ,v 1 Each vertex in is defined by a set of coordinate values in the space coordinate system, and when projected into light space, is also defined by a set of coordinate values in the light coordinate system. Each light space coordinate value is a measurement of the vertex along the corresponding axis of the light coordinate system. The first vertex v 0 The first set of light space coordinates (p 0 ,q 0 ,r 0 ) definition, and the second vertex v 1 The second set of coordinates (p 1 ,q 1 ,r 1 ) definition. As explained above, r 0 and r 1The projections onto the third ray space basis vectors may not be computed in this method, since these coordinates may not be needed for the intersection distance determination. Figure 5 Methods may include analyzing v 0 and v 1 Coordinates along the P and Q axes, which are two non-parallel axes that may be transverse to the direction of the light ray.
[0138] More specifically, Figure 5 The method may include determining a pair of vertices v 0 ,v 1 has a different sign, and the second coordinate of each vertex in a pair of vertices has the same sign. If a vertex coordinate is strictly greater than zero, its sign can be positive. If a vertex coordinate is strictly less than zero, its sign can alternatively be negative. If the sign of the first coordinate of a first vertex is different from the sign of this first coordinate of a second vertex, then it can be derived that the edge defined by those vertices intersects one of the P and Q axes of the ray space. For example, if p 0 Different from p 1 (For example, if p 0 is positive and p 1 is negative), then we can derive the edge v 0 ,v 1 It intersects the Q axis at a point along its length. o The result is different from q 1 (q o For example, positive q 1 and negative), then we can derive the edge v 0 ,v 1 If an edge intersects the P axis at a point along its length (i.e., it intersects only one of these axes), then the orientation of the edge can be determined from the direction of the ray from v. 0 Extend to v 1 Direction export.
[0139] Figure 5 The method includes, in step S502, determining whether the sign of the first coordinate of the first vertex in the first pair of vertices in the light space is different from the sign of the first coordinate of the second vertex in the first pair of vertices. That is, in step S502, determining whether the first vertex and the second vertex v 0 and v 1 do not share the same sign in one of their coordinates. Specifically, step S502 includes determining v 0 (p 0 ) has a different sign from v 1 (p 1) corresponds to the sign of the first coordinate. If p o The sign is positive and p 1 The sign is negative, or if p 0 The sign is negative and p 1 The sign of is positive, then p 0 and p 1 In mathematical terms, under which p 0 and p 1 The conditions that are identified as different can be defined as follows:
[0140] (p o >0∧p 1 <0)∨(p 0 <0∧p 1 >0)
[0141] Although in Figure 5 In the example, step S502 includes comparing the p coordinates, but in an alternative example, this step may include comparing the v 0 and v 1 Different coordinates of, such as the q coordinate.
[0142] If it is determined that the sign of the first coordinate of the first vertex in the first pair of vertices in the ray space is different from the sign of the first coordinate of the second vertex in the first pair of vertices (i.e., if the answer to the test at step S502 is yes), the method proceeds to step S504, in which it is determined whether the sign of the second coordinate of the first vertex in the first pair of vertices in the ray space is the same as the sign of the second coordinate of the second vertex in the first pair of vertices. That is, at step S504, it is determined whether v 0 and v 1 Specifically, step S504 includes determining whether v 0 (q 0 ) has the same sign as v 1 (q 1 ) have the same sign as the corresponding second coordinate. If q o and q 1 The signs of both are positive, or if q o and q 1 If the signs of both are positive, then q 0 and q 1 In mathematical terms, under which q 0 and q 1 The conditions that are determined to be the same can be defined as follows:
[0143] (q o >0∧q 1 >0)∨(q o <0∧q1 <0)
[0144] Although in Figure 5 In the example, step S504 includes comparing the q coordinates, but in an alternative example, this step may include comparing the v 0 and v 1 Different coordinates of, such as the q coordinate.
[0145] If it is determined that the sign of the first coordinate of the first vertex in the first pair of vertices in the ray space is the same as the sign of the first coordinate of the second vertex in the first pair of vertices (i.e., if the answer to the test at step S502 is no), the method proceeds to step S506, in which it is determined whether the sign of the second coordinate of the first vertex in the first pair of vertices in the ray space is different from the sign of the second coordinate of the second vertex in the first pair of vertices. That is, at step S506, it is determined whether v 0 and v 1 Specifically, step S506 includes determining whether v has different signs in the second coordinate of their coordinates. 0 (q 0 ) has a different sign from v 1 (q 1 ) corresponds to the sign of the second coordinate. If q o The sign is positive and q 1 The sign is negative, or if q 0 The sign is negative and q 1 The sign of is positive, then q 0 and q 1 In mathematical terms, the 0 and q 1 The conditions that are identified as different can be defined as follows:
[0146] (q o >0∧q 1 <0)∨(q o <0∧q 1 >0)
[0147] Although in Figure 5 In the example, step S506 includes comparing the q coordinates, but in an alternative example, this step may include comparing the v 0 and v 1 Different coordinates of, such as the q coordinate.
[0148] Therefore, for Figure 5In the method shown in , analyzing the sign of the coordinate data of the set of two vertices in the ray space includes determining whether the following situations exist: (i) the sign of the first coordinate of the first vertex in the first pair of vertices in the ray space is different from the sign of the first coordinate of the second vertex in the first pair of vertices, and the sign of the second coordinate of the first vertex in the first pair of vertices in the ray space is the same as the sign of the second coordinate of the second vertex in the first pair of vertices (i.e., the answer to the test at step S502 is yes, and the answer to the test at step S504 is also yes), or (ii) the sign of the second coordinate of the first vertex in the first pair of vertices in the ray space is different from the sign of the second coordinate of the second vertex in the first pair of vertices, and the sign of the coordinate of the first vertex in the first pair of vertices in the ray space is the same as the sign of the first coordinate of the second vertex in the first pair of vertices (i.e., the answer to the test at step S506 is yes, and the answer to the test at step S502 is no). If condition (i) or condition (ii) is met, it can be derived that the edge defined by the first vertex and the second vertex intersects one of the P and Q axes in the ray space. If condition (i) or (ii) is satisfied, the method may proceed to step S508, where the orientation of the edge defined by a pair of vertices is determined.
[0149] It is worth noting that although Figure 5 Steps S502 to S506 in FIG. 5 are shown in a particular order, but the steps may be performed in any order. The steps may be performed sequentially. Alternatively, the steps may be performed in parallel. The tests at steps S502 to S506 may be reversed (e.g., the test at step S502 may include determining p 0 and p 1 have the same signs).
[0150] In step S508, the orientation of the first edge of the primitive is determined using an analysis of the signs of the coordinate data of the first pair of vertices in the ray space. The orientation of the primitive edge can be determined by observing the signs of the vertices defining the edge. 0 、v 1 Defined edge, the edge starts at v 0 and ends at v 1 Based on the signs of the coordinates defining each of these edges, the orientation of the edge can be determined based on whether the edge passes from -p to +p space, from +p to -p space, from -q to +q space, and from +q to -q space. For example, for a left-handed coordinate system (i.e., Figure 3 The first axis P and the second axis Q are shown, and the third ray-aligned axis points into the page), with a first vertex v with a negative p coordinate 0 and a second vertex v with positive p coordinate 1An edge where both vertices have negative q coordinates can be determined to have a counterclockwise orientation because the light passes on the left-hand side of the edge. Similarly, if both vertices have positive q coordinates, the edge can be determined to have a clockwise orientation because the light passes on the right-hand side of the edge. A complete list of edge orientations that can be derived from the signs of the p and q coordinates of the pair of vertices that define the edge is provided below.
[0151] Note that X represents a combination of coordinate signs where the orientation of the edge cannot be derived from the signs of the p- and q-coordinates alone.
[0152]
[0153]
[0154] The results summarized above can be stored in a lookup table that can be accessed by the intersection test module for use in Figure 5 The edge orientation is determined at step S508.
[0155] In some cases, the ray space coordinates of a primitive vertex may be equal to zero. In such scenarios, edges with endpoint coordinates of zero do not intersect their corresponding coordinate axes. To account for scenarios where primitive ray space vertices are equal to zero, a trichotomy is defined where a different bit value is assigned to each of s>0, s<0, and s=0 (where s represents the p-coordinate or q-coordinate of the ray space vertex). More specifically:
[0156] The floating point value "=0" can be represented as 0=0b000
[0157] The floating point value "">0" can be represented as 1 = 0b001
[0158] The floating point value "<0" can be represented as 7 = 0b111
[0159] Using the three-digit values given above, unsigned arithmetic can be performed modulo 8 as follows:
[0160] f=p o q 1 -q o p 1
[0161] The result of this calculation will be one of 0, 1, 2, 6, and 7. If the result f = 1, 2, the edge can be defined as counterclockwise (for a left-handed system), and if f = 6, 7, it is defined as clockwise (for a left-handed system). If f = 0, the orientation of the edge may not be determined. Alternatively, a lookup table can be used to encode the functionality of this expression on a case-by-case basis. For example, according to this technique, the following provides an abbreviated list of edge orientations that can be derived from the signs of the p- and q-coordinates of a pair of vertices that define the edge:
[0162] <![CDATA[p 0 ]]> <![CDATA[p 1 ]]> <![CDATA[q 0 ]]> <![CDATA[q 1 ]]> Orientation (left-handed coordinate system) Orientation (right-hand coordinate system) <0 <0 <0 <0 X X <0 <0 <0 =0 Clockwise Counterclockwise <0 <0 <0 >0 Clockwise Counterclockwise <0 <0 =0 <0 Counterclockwise Clockwise <0 <0 =0 >0 X X
[0163] In some examples, the light coordinate system can only be observed in a left-handed coordinate system. In these examples, the intersection test module does not need to have an indication of the handedness of the system to determine the edge orientation. In other examples, the coordinate system can be observed in a left-handed coordinate system or a right-handed coordinate system. It has been explained above that in a right-handed system, one of the P axis or the Q axis is reversed so that the Q axis points downward or the P axis points from the right to the left (or, alternatively, the order of the first P axis and the second Q axis is reversed). In other words, the handedness of the light coordinate system switches the orientation of two non-parallel axes that may be orthogonal to the direction of the light in the light space. Therefore, in a right-handed system, the orientation of the edge from the perspective of the light is reversed. This reversal is indicated in the above table.
[0164] In order to take into account the handedness of the light coordinate system when determining the orientation of the edge of the primitive, a handedness flag indicating the handedness of the light coordinate system can be provided to the intersection test module. In some examples, the flag can be a single bit in length. A zero bit value can indicate that the orientation of the light space is clockwise, and therefore no edge reversal is required. If the flag has a value of 1, the orientation of the light space can be reversed (i.e., it can be counterclockwise). The flag can be added to the primitive data so that it is supplied to the intersection test module as part of this data, and therefore it can be modified on a primitive / geometry / instance basis. The flag can alternatively be supplied to the intersection test module, or can be used for this unit, regardless of the original data: the flag can be added to the light data so that it is supplied to the intersection test module as part of this data, and therefore it can be modified on a ray-by-ray basis; the flag can be embedded or hard-coded into the system itself explicitly (e.g., so that it can be modified by a device context, etc.) or implicitly (e.g., by preselecting a column in the above lookup table). In any case, the edge orientation is determined using a combination of the sign and symbol of the coordinate data of the ray space primitive vertices in conjunction with the above table. Once the edge orientation is determined, the method proceeds to step S510.
[0165] In step S510, it is determined whether the orientation of the edge matches the predetermined edge orientation. Figure 5In the method, the non-intersection condition of step S410 can be that the orientation of the edge matches a predetermined edge orientation. The predetermined edge orientation can be selected to match a predetermined primitive orientation associated with a primitive culling rule. From the perspective of light, the primitive culling rule can cull or remove primitives determined to have a specific orientation from the intersection test. An example of a primitive culling rule is back-face primitive culling. Back-face primitive culling culls "back-face" primitives, which are determined to have an outer surface facing away from the origin of the light (where "outside", "front" and the opposite orientation of the predetermined primitive orientation are considered to be the same). In contrast, a "front-face" primitive is a primitive determined to have an outer surface facing toward the origin of the light (where "outside", "front" and the predetermined primitive orientation are considered to be the same). For certain ray tracing operations, culling back-face primitives may be useful because these primitives are typically intended to be hidden in the rendered scene, and therefore processing the primitives is redundant.
[0166] The backface culling method determines primitives with a predetermined specific orientation as "back faces". The orientation of a primitive can be derived from the orientation of a single edge of the primitive, because for a primitive intersected by a ray, all edges of the primitive share the same orientation with respect to the ray. Therefore, if the vertex v i 、v j If the defined edge is determined to have a first orientation, it can be derived that (i) the primitive as a whole has the first orientation, or (ii) one or more edges of the primitive have the opposite orientation, and therefore the primitive does not intersect with the light. If scenario (ii) is true, it is desirable to cull the primitive because it can be derived that the light will miss the primitive. If scenario (i) is true, the culling rule can be used to cull primitives with the first orientation. In one example, the culling method can determine that primitives with a counterclockwise orientation in a left-handed light coordinate system are back-facing. The method can then cull primitives determined to have a counterclockwise orientation or prevent additional intersection tests of these primitives. In other words, if the orientation of the first edge of the primitive matches a predetermined (e.g., counterclockwise) primitive orientation, it can be determined that there is no intersection between the light and the primitive. This is because the predetermined (e.g., counterclockwise) orientation indicates that the light does not intersect with primitives that include edges with this orientation.
[0167] Therefore, if the orientation of the edge is determined to match a predetermined orientation (e.g., counterclockwise), the method proceeds to step S512, in which it is determined that the light does not intersect the primitive containing this edge. That is, if the orientation of the edge is determined to match the predetermined orientation of the elimination rule, any primitive containing this edge is eliminated. The predetermined orientation may include one or more predetermined orientations. That is, the predetermined orientation may be a single orientation (e.g., clockwise or counterclockwise), or two orientations (e.g., both clockwise and counterclockwise). The indication of the predetermined orientation may be supplied to the intersection test module as a flag. The flag may be a single bit. In this example, a single bit of the flag may be used to indicate one of two possible states. For example, the first bit value may indicate that primitives with a clockwise orientation should be eliminated, and the second bit value may indicate that primitives with a counterclockwise orientation should be eliminated. The flag may alternatively include two bits. In this example, the two bits of the flag may be used to indicate one of four possible states. For example, a first bit value may indicate that primitives with a clockwise orientation should be culled, a second bit value may indicate that primitives with a counterclockwise orientation should be culled, a third bit value may indicate that no primitives should be culled (i.e., neither clockwise nor counterclockwise), and a fourth bit value may indicate that all primitives should be culled (i.e., both clockwise and counterclockwise). This flag may be provided with the primitive data, ray data, or embedded in the test system so that it can be modified on a per-primitive / geometry / primitive / ray, etc. basis in the same manner as the handedness flag.
[0168] If the answer to the test at step S510 is no (i.e., the edge orientation does not match the predetermined edge orientation), the method proceeds to step S514, where the primitive is submitted for additional intersection testing. That is, as a result of step S510, based on the analysis of the particular edge under consideration, it is determined that the primitive is not a primitive that can be culled early, and therefore a subsequent intersection test can be performed to determine whether an intersection exists between the primitive and the ray. Figure 5 In the example, additional intersection tests may include analyzing the vertex coordinates of one or more different pairs of vertices defining the primitive to determine whether the one or more different pairs of vertices define an edge that intersects the P axis or the Q axis (but not both). That is, at least one pair of other primitive vertices may be performed Figure 5 If you have already passed Figure 5 If the method has tested all primitive vertex pairs and has not reached step S512, then the subsequent intersection test at step S514 can be the substantial intersection test defined above (eg, floating point calculation).
[0169] If the answer to the test at step S506 or S504 is no, the method can also proceed to step S514, in which the primitive containing the edge is submitted for additional intersection testing. At the end of steps S504 and S506, the method has been 0 ,、p 1 ,q o and q 1 The symbol is derived from the vertex v 0 、v 1 Whether the edge defined by this parameter intersects one or more of the P and Q axes. 0 and p 1 have the same sign, then the edge does not intersect the Q axis. o and q 1 have the same sign, then the edge does not intersect the P axis. Therefore, if vertex v 0 、v 1 If the edges do not share the same sign in their p and q coordinates (i.e., if the answer to the test at S506 is no), it can be concluded that the edge intersects neither the P axis nor the Q axis. In this scenario, it may not be possible to determine the orientation of the edge from the signs of the p and q coordinates alone, and therefore an additional intersection test must be performed at step S514. 0 and p 1 have different signs, then the edge does intersect the Q axis. If q o and q 1 have different signs, then the edge does intersect the P axis. Therefore, if vertex v 0 、v 1 have different signs in their p- and q-coordinates (i.e., if the answer to the test at S504 is no), it can be derived that the edge intersects the P-axis and the Q-axis. In this scenario, it may not be possible to determine the orientation of the edge from the signs of the p- and q-coordinates alone. This is because, if the edge intersects two ray space axes, the endpoints of these edges are located in opposite quadrants of the 2D ray space. In this case, the edge can be continuously moved so that it crosses the origin, but its endpoints do not leave their corresponding quadrants. This means that a clockwise or counterclockwise edge orientation can be derived from the same sign combination. Therefore, an additional intersection test must be performed again at step S514 to determine the exact orientation of the edge.
[0170] Figure 7 It is shown that you can use Figure 5 An example of primitives culled by the method shown in FIG. Figure 7 The primitive 702 in has three ordered vertices v 0 ,v 1 ,v 2 , where each pair of these vertices defines a corresponding edge of the primitive. Figure 7is shown as projected into a ray coordinate system. In this coordinate system, assuming the system has a clockwise orientation, the primitive can be seen to have a counterclockwise orientation relative to the viewpoint of the ray. That is, the ray passes through the primitive on the left-hand side of each of the primitive's edges, relative to the edge orientation. Assuming a predetermined primitive orientation is associated with a counterclockwise back-facing primitive, the above description can be used Figure 5 The method uses the back-face culling rule to cull this primitive. Look at the vertex v that defines the first edge of the primitive. 0 、v 1 , it can be determined that for a strictly positive measurement p i ,q i , the symbol of these vertices in ray space is -p 0 ,+q 0 ,-p 1 ,-q 1 In other words, the signs of the first coordinates of the pair of vertices are the same, and the signs of the second coordinates of the pair of vertices are different. 0 、v 1 The edges defined can be determined to intersect the P axis but not the Q axis. This means that the orientation of the edges can be defined. For a primitive that intersects the ray, each of the edges of the primitive will have the same orientation in the ray coordinate system. Therefore, in the vertex v 0 、v 1 When the defined edge is determined to have a counterclockwise orientation (because p i is negative and q i From positive to negative), it can be concluded that either (i) the primitive as a whole has a counterclockwise orientation, or (ii) one or more edges of the primitive have a clockwise orientation, and therefore the primitive does not intersect the ray. If scenario (ii) is true, then it is desirable to cull the primitive because it can be concluded that the ray will miss the primitive. Alternatively, if scenario (i) is true, and the culling rule specifies that counterclockwise primitives are to be culled, then the non-intersection condition is satisfied by the fact that the edge orientation is counterclockwise. In summary, by edge v 0 、v 1 The condition is satisfied, and the primitive can therefore be culled. This means that no further intersection tests are performed on the primitive. 0 、v 1 This culling is performed on any (one or more) primitives.
[0171] Figure 5 The advantage of the method shown in is that it uses only zero comparisons, which, as mentioned before, has virtually no cost. Figure 5Another advantage of the method shown in is that it only requires observation of a single pair of vertices for a primitive with any number of vertices greater than or equal to three. If the orientation of an edge can be derived from a single pair of vertices by using zero comparisons, then this provides a very cheap and efficient way to reduce the number of intersection tests that must be performed on a set of primitives. When used to handle primitives with a larger number of edges, Figure 5 The method may be particularly advantageous because entire primitives consisting of n edges can be eliminated from testing of a single edge. Figure 5 The method can be used to process primitives with any alternative number of edges. Note that the subscripts 0, 1, and 2 used to represent primitive vertices and their coordinates are used only for exemplary purposes. Other examples can use alternative combinations of indexes or orderings of these subscripts.
[0172] exist Figure 6 In Figure 4 A second example of the analysis coordinate data symbol is shown. Figure 5 Same, Figure 6 It shows that Figure 4 A more detailed version of step S416 is shown. Figure 6 The analysis method shown in includes analyzing the vertex coordinates of a set of three or more vertices of a primitive. That is, for Figure 6 method, in Figure 4 The set of two or more vertices defined in step S404 is a set of three or more vertices. In many examples, the set of vertices includes four vertices (corresponding to two edges without common vertices). The set of three or more vertices can form at least two pairs of vertices, the first pair of vertices defining a first edge of the primitive and the second pair of vertices defining a second edge of the primitive. Figure 5 As with the method shown, the edge direction is defined by analyzing the signs of the ray space coordinates of a pair of vertices defining the edge of the primitive, and it can be determined whether the edge of the primitive intersects one or more of the P axis and the Q axis in the ray space. Figure 6 The method involves comparing the orientations of two edges of a primitive and determining whether the edges have the same orientation. If the edges do not have the same orientation, it can be determined that the ray is not interested in the primitive.
[0173] Figure 6 The exemplary method shown in FIG. 1 considers three vertices v defining a primitive. 0 ,v 1 、v 2 The set of vertices v 0 ,v 1 、v 2Each vertex in is defined by a set of coordinate values in the space coordinate system, and when projected into light space, they are also defined by a corresponding coordinate value in the light coordinate system, where each coordinate value of the vertex in the light coordinate system is the measurement of the vertex along the corresponding axis of the light coordinate system. The first vertex v 0 The first set of light space coordinates (p 0 ,q 0 ,r 0 ) definition, the second vertex v 1 The second set of coordinates (p 1 ,q 1 ,r 1 ) definition, and the third vertex v 2 The third set of coordinates (p 2 ,q 2 ,r 2 ) definition. Vertex v 0 ,v 1 、v 2 At least the first side of the primitive can be defined (v 0 ,v 1 ) and the second side of the primitive (v 0 ,v 2 )). As explained above, when performing intersection tests on primitives, the r of each ray space vertex may not be calculated. i Note that these vertex and edge references are provided as examples only, and Figure 6 The method can be used to analyze alternative edges / vertices of primitives. Figure 6 The edges analyzed in the method are adjacent edges because they share the vertex v 0 In other examples, the edges of the primitives used in this example may not be contiguous. For example, for a primitive with four or more edges, the four vertices that make up two edges of the primitive may be completely different (i.e., the two edges of the primitive may not even share a common vertex). For a primitive, the following can be performed for multiple different combinations of two or more edges that define the primitive. Figure 6 method. Figure 6 Methods may include analyzing v 0 、v 1 and v 2 Coordinates along the P and Q axes, which are two non-parallel axes that are both transverse to the direction of the light ray r.
[0174] Figure 6 The first three steps (steps S602, S604 and S606) are the same as Figure 5 The corresponding method steps S502, S504 and S506 are the same. That is, steps S602, S604 and S606 involve determining the vertex v 0 、v 1Whether the first edge of the defined primitive intersects one (but not both) of the P and Q axes. This method is referenced above Figure 5 has been described and therefore will not be repeated here.
[0175] If the answer to the test of step S604 or step S606 is yes, then the first edge of the primitive (v 0 ,v 1 ) (only) intersects one of the P axis and the Q axis. Then, the method proceeds to steps S610, S612 and S614, in which the second of the two edges in the primitive is analyzed. That is, the second set of vertices (v 2 ,v 0 )) defined by the primitive. This method is substantially the same as the method of steps S502, S504 and S506, but is performed for different edges of the primitive. That is, in step S610, it is determined whether the sign of the first coordinate of the first vertex in the second pair of vertices in the ray space is different from the sign of the first coordinate of the second vertex in the second pair of vertices. That is, in step S610, it is determined whether the first vertex and the second vertex (v 2 ,v 0 ) do not share the same sign in one of its coordinates. Specifically, step S610 includes determining v 2 (p 2 ) has a different sign from v 0 (p 0 ) corresponds to the sign of the first coordinate. Similar to the reference above Figure 5 What is described, in mathematical terms, is 2 and p 0 The conditions that are identified as different can be defined as follows:
[0176] (p 2 >0∧p 0 <0)∨(p 2 <0∧p 0 >0)
[0177] Although in Figure 6 In the example, step S610 includes comparing the p coordinates, but in an alternative example, this step may include comparing the v 2 and v 0 Different coordinates of, such as the q coordinate.
[0178] If it is determined that the sign of the first coordinate in ray space of the first vertex in the second pair of vertices is different from the sign of the first coordinate of the second vertex in the second pair of vertices (i.e., if the answer to the test at step S610 is yes), the method proceeds to step S612, in which it is determined whether the sign of the second coordinate in ray space of the first vertex in the second pair of vertices is the same as the sign of the second coordinate of the second vertex in the second pair of vertices. That is, at step S612, it is determined whether the first vertex and the second vertex v 2 ,v 0 Specifically, step S612 includes determining whether v shares the same sign in the second coordinate in its coordinates. 2 ,(q 2 ) has the same sign as v 0 (q 0 ) has the same sign as the corresponding second coordinate. In mathematical terms, under which q 2 and q 0 The conditions that are determined to be the same can be defined as follows:
[0179] (q 2 >0∧q 0 >0)∨(q 2 <0∧q 0 <0)
[0180] Although in Figure 6 In the example, step S612 includes comparing the q coordinates, but in an alternative example, this step may include comparing the v 2 and v 0 Different coordinates of, such as the q coordinate.
[0181] If it is determined that the sign of the first coordinate in ray space of the first vertex in the second pair of vertices is the same as the sign of the first coordinate of the second vertex in the second pair of vertices (i.e., if the answer to the test at step S610 is no), the method proceeds to step S614, in which it is determined whether the sign of the second coordinate in ray space of the first vertex in the second pair of vertices is different from the sign of the second coordinate of the second vertex in the first pair of vertices. That is, at step S614, it is determined whether the first vertex and the second vertex v are the same. 2 ,v 0 Specifically, step S614 includes determining whether v has a different sign in the second coordinate in its coordinates. 2 (q 2 ) has a different sign from v 0 (q 0 ) corresponds to the sign of the second coordinate. In mathematical terms, under which q 2 and q 0 The conditions that are identified as different can be defined as follows:
[0182] (q 2 >0∧q 0 <0)∨(q 2 <0∧q 0 >0)
[0183] Although in Figure 6 In the example, step S614 includes comparing the q coordinates, but in an alternative example, this step may include comparing the v 2 and v 0 Different coordinates of, such as the q coordinate.
[0184] In conclusion, Figure 6 Steps S602 to S614 of the method include analyzing the signs of coordinate data of a set of two or more vertices in ray space. If the answer to any of the method steps S604 or S606 is yes, the method also includes determining whether the following situations exist: (i) the sign of the first coordinate of the first vertex in the second pair of vertices in the ray space is different from the sign of the first coordinate of the second vertex in the second pair of vertices, and the sign of the second coordinate of the first vertex in the second pair of vertices in the ray space is the same as the sign of the second coordinate of the second vertex in the second pair of vertices, (ii) the sign of the second coordinate of the first vertex in the second pair of vertices in the ray space is different from the sign of the second coordinate of the second vertex in the second pair of vertices, and the sign of the coordinate of the first vertex in the second pair of vertices in the ray space is the same as the sign of the first coordinate of the second vertex in the second pair of vertices. In other words, the method includes determining whether two of the edges in the primitive intersect with one (and only one) of the P axis and the Q axis in the ray space (this axis may be different for the first pair of vertices and the second pair of vertices). Based on this derivation, the method can proceed to step S616, in which the orientations of the edges are compared.
[0185] and Figure 5 , it is noted that although steps S602 to S614 are shown in a particular order, these steps may be performed in any order. These steps may be performed sequentially. Alternatively, these steps may be performed in parallel. The tests at steps S602 to S606 or the tests at steps S610 to S614 may be reversed (e.g., the test at step S602 may include determining p 0 and p 1 have the same signs).
[0186] In step S616, analysis of the signs of the coordinate data of the first pair of vertices and the second pair of vertices in the ray space is used to determine the orientation of the first edge and the second edge of the primitive, respectively. As defined above, the orientation of a primitive edge can be determined by observing the signs of the vertices defining the edge. 0 、v 1Defined edge, the edge starts at v 0 and ends at v 1 For strictly positive measurements p and q, based on the signs of the coordinates defining each of these edges, the orientation of the edge can be determined based on whether the edge passes from -p to +p half-space, from +p to -p half-space, from -q to +q half-space, and from +q to -q half-space. By observing the signs of the p and q coordinates of both the first vertex and the second vertex, the orientation of the first and second edges can be determined. Figure 5 Unlike the method shown in , it may not be necessary to know the orientation of the coordinate system when determining the orientation of the first primitive and the second primitive. This is because Figure 6 The method involves comparing primitive edges to each other, rather than comparing them to a predetermined orientation. In other words, Figure 6 The method in considers the relative orientation of the first primitive and the second primitive (i.e., relative to each other). Therefore, in step S616, when determining the orientation of the first primitive edge and the second primitive edge, a left-handed coordinate system can be assumed. The determination of these orientations is basically the same as described above with reference to Figure 5 Perform as described.
[0187] In step S618, it is determined whether the orientation of the first side of the primitive is different from the orientation of the second side of the primitive. In other words, it is determined whether the orientations of the first side and the second side are different. Figure 6 , the non-intersection condition can be satisfied if the orientation of the first side of the primitive is different from the orientation of the second side of the primitive. For example, the non-intersection condition can be satisfied if the orientation of the first side is clockwise and the orientation of the second side is counterclockwise. Similarly, the non-intersection condition can be satisfied if the orientation of the first side is counterclockwise and the orientation of the second side is clockwise. As explained above, for primitives that intersect with a ray, each side of the ray will have the same orientation from the perspective of the ray. Therefore, if it is determined that two sides of a primitive have different orientations, this means that the ray does not intersect with the primitive (i.e., the primitive does not pass through the origin in the ray space).
[0188] If the answer to the test at step S604, S606, S610 or S612 is no, the method can also proceed to step S622, in which the primitive containing the edge is submitted for another intersection test. At the end of steps S604 and S606, the method has been 0 ,、p 1 ,q o and q 1 The symbol is derived from the vertex v 0 、v 1 Whether the edge defined by this parameter intersects one or more of the P and Q axes. 0 and p 1have the same sign, then the edge does not intersect the Q axis. o and q 1 have the same sign, then the edge does not intersect the P axis. 0 and p 1 have different signs, then the edge does intersect the Q axis. If q o and q 1 have different signs, then the edge does intersect the P axis. Therefore, if vertex v 0 、v 1 have different signs in their p-coordinates and q-coordinates (i.e., if the answer to the test at S604 is no), it can be derived that the edge intersects the P-axis and the Q-axis. 2 、v 0 The same determination is made for the edges defined. If it is determined that the edge intersects neither the P axis nor the Q axis, or if it intersects both axes, then no orientation determination can be made for the edge, and so the method proceeds to step S622 where the primitive is submitted for additional intersection testing. Figure 6 In , additional intersection testing may include analyzing the signs of one or more different pairs of edges defining the primitive to determine if there is a pair of edges that both intersect the P axis or the Q axis (but not both) (the axis that intersects can be different for each edge). That is, Figure 6 The method can be performed for at least one other pair of primitive edges. Figure 6 If the method has tested all primitive edge pairs and has not reached step S620, then the subsequent intersection test at step S622 can be the actual intersection test defined above (e.g., floating point calculation).
[0189] If the answer to the test at step S618 is yes, the method also proceeds to step S622 and the primitive is submitted from another intersection test. In this case, there is not enough information for it to deduce that there is no intersection between the ray and the primitive. The intersection test module can then continue to test different groups of primitive vertex pairs against each other to determine whether there is at least one edge of the primitive that has a different orientation than another edge of the primitive.
[0190] If it is determined that the orientations of the first primitive and the second primitive are different, the method proceeds to step S620 where it is determined that the ray does not intersect the primitive.
[0191] Figure 6 The method shown in is advantageous because it does not require knowledge of the orientation of the coordinate system or specific culling rules to classify "missing" between rays and primitives. Therefore, it increases the simplicity and efficiency of the intersection point testing method described in this article.
[0192] Figure 8It is shown that you can use Figure 6 An example of primitives culled by the method shown in FIG. Figure 8 The primitive 802 in has four ordered vertices v defining the four edges of the primitive. 0 ,v 1 ,v 2 ,v 3 Element 802 is Figure 8 is shown as projected into the light coordinate system. It can be seen that Figure 8 The origin 804 of the ray in does not pass through the primitive, and therefore the ray does not intersect the primitive. This means that the primitive does not wrap completely around the origin (i.e., not all edges of the convex primitive have the same orientation from the ray's perspective). More specifically, the ray is at edge v 1 ,v 2 and v 2 ,v 3 The ray passes on the right-hand side of , so the two edges have a clockwise orientation with respect to the origin. 0 ,v 1 and v 3 ,v 0 , so these edges have a counterclockwise orientation with respect to the origin. If, for example, we define the edge v 1 ,v 2 and v 0 ,v 1 , the vertex execution Figure 6 , it will be determined that the orientations of the two edges are different. Therefore, without performing a detailed (e.g., floating point) intersection test, it can be determined that the ray did not pass through the primitive and therefore there is a gap between the ray and the primitive. This means that there is no need to perform a subsequent intersection test on primitive 804. Although Figure 8 The primitive shown in FIG. 1 includes four edges, but it should be understood that the operation can be performed on primitives including any number of edges (and corresponding vertices) greater than or equal to three (e.g., a triangle primitive). Figure 6 method.
[0193] exist Figure 6 In an alternative example to the example shown in , instead of dynamically determining the orientation of primitive edges, these determinations can be made once for all edges "in advance" (i.e., before intersection testing) and pre-stored in memory local to the intersection testing unit / its. Based on the pre-stored results, an orientation comparison can then be determined for the set of edges for each primitive.
[0194] The pairwise comparisons mentioned in this article may be inefficient for higher order polygons. For higher order polygons, it may be more efficient to mark the first instance of edge orientation as the edges of a primitive are resolved and to cull the primitive as soon as a record of two edges of the primitive with different orientations occurs. This means that each edge is analyzed only once, rather than multiple times as pairwise comparisons occur.
[0195] exist Figure 4 In some examples of the method shown in , analyzing the sign of the coordinate data of the set of two or more vertices in the ray space includes analyzing the signs of all vertices in the complete set of vertices defining the primitive. That is, in some examples, Figure 4 The method includes observing all vertices of the primitives in the ray space. In these examples, analyzing the sign of the coordinate data may include analyzing the sign of the first coordinate of all vertices in the complete set of vertices. Analyzing the sign of the coordinate data may alternatively include analyzing the sign of two coordinates of all vertices in the complete set of vertices.
[0196] Figure 4 Another example of step 416 is Fig. 9 and Fig.10 In Fig. 9 and Fig.10 In the example primitive to be processed, there are three vertices, where each pair of vertices in the three pairs of vertices defines a corresponding edge of the primitive. Once the coordinate data of the set of vertices is projected into the ray space using the ray data, the process begins. Fig. 9 That is, in Fig. 9 At the beginning, each vertex defining the primitive has been projected onto a pair of axes aligned with the basis vectors P and Q. As described above, when the coordinate data of the primitive is projected into the light space, each vertex of the primitive is defined by a set of coordinate values in the light coordinate system, where each coordinate value is a measurement of the vertex along a corresponding axis of the light coordinate system. For primitive 204, the first vertex v 0 can have a set of ray space coordinates (p 0 ,q 0 ,r 0 ), the second vertex v 1 can have a set of coordinates (p 1 ,q 1 ,r 1 ), and the third vertex v 2 can have a set of coordinates (p 2 ,q 2 ,r 2 )(Note that for the reasons explained above, r may not be calculated i ).
[0197] It is worth noting that although Fig. 9Steps S902 to S908 in are shown in a particular order, but these steps can be performed in any order. These steps can be performed sequentially. Alternatively, these steps can be performed in parallel. It is also worth noting that Fig. 9 The "min" and "max" annotations in are used purely for brevity and ease of understanding, but steps S902 to S908 should preferably be performed using zero comparisons, as demonstrated in the text below.
[0198] exist Fig. 9 In the method, the disjoint condition is satisfied if all signs of at least one ray space coordinate value among all vertices in the complete set of (ordered) vertices of the primitive are the same. That is, if all vertices of the primitive in ray space share the same sign in at least one of their first coordinates or second coordinates, then the ray is determined to not intersect the primitive. This can be determined as the primitive must be strictly located in the half-space of the 2D ray space and therefore cannot overlap (i.e. intersect) the origin.
[0199] In steps S902 and S904, the method determines whether the sign of the first coordinate in the ray space is the same for all vertices in the complete set of ordered vertices defining the primitive. The first coordinate of the vertex may be measured along the first of two non-parallel axes defining the ray coordinate system or ray space. The first coordinate of the vertex may be measured along the P axis in the ray space. Therefore, more specifically, in step S902, the method determines whether the sign of the first coordinate in the ray space is the same for all vertices in the complete set of ordered vertices defining the primitive. The first coordinate of the vertex may be measured along the P axis in the ray space. 0 、v 1 and v 2 All coordinates of the position p 0 、p 1 、p 2 Is it less than zero? That is, the method determines the coordinate p in the light space 0 、p 1 and p 2 Is the sign of all negative? The method can determine the coordinate p in the ray space 0 、p 1 and p 2 Whether all signs of are strictly negative. This condition can be expressed mathematically as follows:
[0200] (p 0 <0∧p 1 <0∧p 2 <0)
[0201] If the coordinate p in the ray space 0 、p 1 and p 2If all signs of are strictly negative, the non-intersection condition is satisfied because the p coordinates of the primitive vertices share the same sign. Therefore, the method proceeds to step S912, in which it is determined that the ray does not intersect the primitive.
[0202] Fig.10 It shows that the satisfaction Fig. 9 An example of the tested primitive at step S902 in FIG. Fig.10 The primitive 1002 in has three vertices v 0 、v 1 and v 2 . Vertex v 0 、v 1 and v 2 Each vertex in is projected onto Fig. 9 In ray space, since these vertices are aligned with the PQ plane. Fig. 9 It can be seen that all v 0 、v 1 and v 2 1002 is located on the left hand side of the PQ plane in the light space. That is to say, all vertices have negative p coordinates, or p coordinates that are strictly less than zero. Because all vertices in the primitive have negative p coordinates, the primitive does not intersect with the Q axis. This means that the primitive does not intersect with the light space origin 1004. As already mentioned herein, the origin 1004 of the P axis and the Q axis in the light space is the origin of the light that is being tested for the primitive. Therefore, if the primitive 1002 does not intersect with the origin 1004 of the light, the primitive cannot intersect with the light that defines this origin, which is the intersection of the P axis and the Q axis.
[0203] Thus, if all vertices of a primitive share the same sign in at least one of their coordinates, this indicates that the primitive does not intersect the ray. Thus, the sign of the primitive can be used directly to unambiguously determine that the ray does not intersect the primitive.
[0204] If the primitive does not satisfy the test of step S902, the method proceeds to step S904, in which all coordinates p are determined. 0 ,p 1 and p 2 Is it greater than zero? That is, the method determines the coordinate p in the light space 0 、p 1 and p 2 All signs of are positive. The method can determine the coordinates p in the ray space 0 、p 1 and p 2 Are all signs strictly positive? If the coordinates p in the ray space 0 、p 1 and p 2The disjoint condition is satisfied if all signs of are strictly positive, since the coordinates share the same sign. This test can be written mathematically as follows:
[0205] (p 0 >0∧p 1 >0∧p 2 >0)
[0206] Therefore, the method proceeds to step S912, in which it is determined that the ray does not intersect the primitive. More specifically, if the coordinate p in the ray space is 0 、p 1 and p 2 All signs of are strictly positive, then this indicates that all v 0 、v 1 and v 2 is located on the right-hand side of the PQ plane in ray space. Since all vertices in the primitive have (strictly) positive p-coordinates, it can be deduced that the primitive does not intersect the Q axis. Therefore, similar to the reference above Fig.10 As described, primitives cannot intersect with rays that define this origin, which is the intersection of the P and Q axes.
[0207] Fig. 9 The method may include checking the p-coordinate and q-coordinate of the primitive in ray space to determine whether these coordinates are (i) all strictly negative, or (ii) all strictly positive. If the primitive does not satisfy the test of step S904 (i.e., if the answer to the test is no), then analyzing v 0 、v 1 and v 2 The q coordinate of the vertex is determined to determine whether the non-intersection condition is satisfied. That is, in steps S906 and S908, the method determines whether the sign of the second coordinate in the ray space is the same for all vertices in the complete set of ordered vertices defining the primitive. The second coordinate of the vertex can be measured along the second axis of the two non-parallel axes defining the ray coordinate system. The second coordinate of the vertex can be measured along the Q axis in the ray space. Therefore, more specifically, in step S906, the method determines whether the vertex v is defined respectively. 0 、v 1 and v 2 The full coordinates of the position q 0 ,q 1 and q 2 is less than zero along the Q axis in ray space. That is, the method determines the coordinate q in ray space 0 ,q 1 and q 2 Is the overall sign of negative? The method can determine the coordinate q in the ray space 0 ,q 1 and q 2Whether all signs of are strictly negative. This test can be written mathematically as follows:
[0208] (q 0 <0∧q 1 <0∧q 2 <0)
[0209] If the coordinate q in the ray space 0 ,q 1 and q 2 If all signs of are strictly negative, the disjoint condition is satisfied because the coordinates share the same sign. Therefore, the method proceeds to step S912, in which it is determined that the ray does not intersect the primitive. More specifically, if the coordinate q in the ray space is 0 ,q 1 and q 2 All signs of are strictly positive, then this indicates that all v 0 、v 1 and v 2 Located in the lower half of the PQ plane in ray space. Since all vertices in the primitive have negative q coordinates, it can be derived that the primitive does not intersect the Q axis. Therefore, as in steps S902 and S904, the primitive cannot intersect the ray defining this origin, which is the intersection of the P axis and the Q axis.
[0210] If the primitive does not satisfy the test of step S906 (ie, if the answer to the test is no), the method proceeds to step S908, where the full coordinates q are determined. 0 ,q 1 and q 2 Is it greater than zero? That is, the method determines the coordinate q in the ray space 0 ,q 1 and q 2 Whether all signs of are positive. The method can determine the coordinates q in the ray space 0 ,q 1 and q 2 Whether all signs of are strictly positive. This test can be written mathematically as follows:
[0211] (q 0 >0∧q 1 >0∧q 2 >0)
[0212] If the coordinate q in the ray space 0 ,q 1 and q 2 If all signs of are strictly positive, the disjoint condition is satisfied because the coordinates share the same sign. Therefore, the method proceeds to step S912, in which it is determined that the ray does not intersect the primitive. More specifically, if the coordinate q in the ray space is 0 ,q1 and q 2 All signs of are strictly positive, then this indicates that all v 0 、v 1 and v 2 Located on the right hand side of the PQ plane in ray space. Since all vertices in the primitive have positive q coordinates, it can be derived that the primitive does not intersect the Q axis. Therefore, as in steps S902, S904 and S906, the primitive cannot intersect the ray defining this origin, which is the intersection of the P axis and the Q axis.
[0213] although Fig. 9 The method shown in includes looking at both the p-coordinates and the q-coordinates of the primitive vectors in ray space, but alternative methods may include looking at only the p-coordinates of these vectors or only the q-coordinates of these vectors. Fig. 9 If the answer to the test of any of steps S904 or S906 in is "yes", the method can determine that the ray does not intersect the primitive without analyzing the q coordinate of the vertex. As mentioned above, method steps S902 to S908 can be performed in any suitable order, or alternatively can be performed in parallel. Fig. 9 and Fig.10 The examples in are provided for primitives defined by three ordered vertices, but it will be understood that the same method can be performed for primitives including any number of vertices greater than or equal to three.
[0214] Fig. 9 An advantage of the method shown in is that it does not require determining the orientation of a primitive edge to determine whether a ray intersects a primitive.
[0215] Using the method described above, if the non-intersection condition is met, it is determined that the light does not intersect with the primitive, and no additional intersection test is performed on this primitive. If no additional intersection test is performed on the primitive, this primitive can be described as having been "rejected". The term "reject" can be defined as removing the primitive from the intersection test pipeline so that no additional test is performed on this primitive. The primitive can be removed by removing the data defining this primitive from the temporary storage for processing this primitive. The primitive can be removed alternatively by associating a flag with the primitive to indicate that no additional processing is performed on this primitive. Alternatively, the primitive that requires additional intersection testing can be marked (for example, using a data flag), and the primitive that does not require additional testing can be unmarked. Therefore, the intersection test module can know to select only the marked primitives for additional testing. As described above, it is advantageous to remove the primitive when it is determined that the light does not intersect with the primitive, because this reduces the number of subsequent processor-intensive intersection tests that can be performed on all primitives.
[0216] In the example detailed above, the coordinate data for each vertex in the set of two or more vertices in the ray space includes (i) a first coordinate of the coordinate data measured along a first axis of two non-parallel axes, and (ii) a second coordinate measured along a second axis of the two non-parallel axes. In other words, in Figures 4 to 6 and Fig. 9 The vertex coordinates analyzed in the method are the coordinates along two non-parallel axes (i.e., the P axis and the Q axis) that may be perpendicular to the direction of the light. The axis may also be called the minor axis of the light because no axis corresponds to the component of the light direction vector with the largest magnitude. That is, the minor axis in the light space represents the two smaller components of the light direction. The major axis of the light that may be orthogonal to the P axis and the Q axis is the axis corresponding to the component of the light direction vector with the largest magnitude. Since in Figures 4 to 6 and Fig. 9 Only two ray space axes are considered in the approach, and vertex coordinates can be described as being projected into a two-dimensional (or 2D) ray space.
[0217] The above methods are used to improve the efficiency of intersection testing in a ray tracing system. These methods can use coordinate data that has been determined from vertex projections to perform a series of inexpensive tests that determine whether a ray does not intersect a primitive. Using coordinate data determined from vertex projections is advantageous because this is data determined at the beginning of the intersection testing process, and this data is only determined once per vertex. Therefore, efficiencies can be gained when using pre-prepared data to perform the methods described herein.
[0218] A second method of processing primitives as part of intersection testing in a ray tracing system is Fig.11 As shown in Figure 4 The method shown in Fig.11 The method is performed before performing floating point calculations on the ray for the primitive. If the result of the method is a determination that the ray does not intersect the primitive, then no additional intersection tests may be performed on the ray with respect to the primitive. In other words, the substantial floating point calculations of the intersection test process may not be performed on the ray with respect to the primitive. As mentioned above, each primitive is defined by an ordered set of vertices. The method may be performed by an intersection test module (such as Figure 1 Module 108 shown in FIG. 1 is executed.
[0219] Fig.11 Steps S1102 and S1104 are the same as Figure 4 The corresponding steps S402 and S404 are the same. That is, the method starts at step S1102, in which data defining the direction and origin of the light to be tested for the primitive is received. In other words, data defining the light to be tested for the primitive is received. The light data can be obtained by Figure 1The ray data may define a primary ray or a secondary ray. The ray data may be obtained by the intersection test module 108 from a memory accessible to the intersection test module. As described above, the direction and origin of the ray are used to project the vertices of the primitive into the ray coordinate system of the ray.
[0220] In step S1104, coordinate data of a primitive is received. More specifically, coordinate data of a set of vertices defining the primitive may be received. Fig.11 In the method, the coordinate data includes coordinates of a set of three or more vertices defining a primitive. The set of three or more vertices may be a complete set of vertices defining the primitive. That is, the set of vertices may include all vertices of the primitive. The coordinate data may be received simultaneously with the ray data. The coordinate data may be received sequentially after or before the ray data. The coordinate data may be received from a pipeline of primitive data, where the primitives are to be processed sequentially by the rays. The coordinate data may be received from a different location than the ray data. The set of two or more vertices defines at least one edge of the primitive. It is worth noting at this point that similar to reference Figure 6 As described, the distance (as a function of ray length) can be performed once for all vertices "in advance" (i.e., immediately before the intersection test, but after the ray data has been acquired), and pre-stored in memory local to the intersection test unit. Based on the pre-stored results, the distance can then be determined for each primitive by retrieving the data defining the vertices of this primitive.
[0221] Once the ray data and coordinate data have been received by the intersection test module, then at step S1106, the coordinate data of each vertex is used to determine the distance component of the vertex along the direction / length of the ray. 0 The coordinate data of the first vertex of the image can be used to determine the direction / length of the ray along which this vertex is located. 0 ,v 1 …v n This determination is performed for each vertex in the scene. The 'ray length' may be given by the magnitude of the ray's direction vector D. The ray direction / length extends from the ray's origin (which may or may not be the origin of the scene) to positive infinity (relative to its parameter space), while the ray as a line segment may extend towards positive and / or negative infinity (based on t min and t max The determination of the distance component along the direction / length of the ray at which the vertex is located is explained in further detail below.
[0222] In step S1108, the determined distance component of each of the vertices is compared with at least one of the minimum valid distance value and the maximum valid distance value of the ray. That is, the determined distance component of each vertex of the defining primitive along the direction / length of the ray is compared with at least one of the minimum valid distance value and the maximum valid distance value of the ray. The minimum valid distance value and the maximum valid distance value of the ray may also be referred to as the minimum culling distance and the maximum culling distance of the ray, or the culling distance, or collectively referred to as the distance culling interval (t min and t max ). The minimum culling distance and maximum culling distance define the range of distance values along the length of the ray within which the ray is valid, so that intersections between the ray and primitives can occur. min and t max The initial values of are usually predetermined before the intersection test, but their values can be dynamically changed from these initial values during the intersection test. For example, during the intersection test, t max and / or min can be updated to a value equal to the distance between the ray origin and the determined intersection point (e.g., an opaque intersection point is t max and / or the transparent / semi-transparent intersection point is t min ). This is usually done so that t max Only the continuous decrease and t min t only grows over time, so that as more information about the scene is gained during traversal, the culling interval only decreases in size over time (culling more geometry). During an intersection test of a ray against a node or against a primitive, if the value of t on the ray is t int If there is an intersection at the point of min , so that if t int <t min (Or in an alternative example, if t int ≤t min ), then the intersection is not accepted and the maximum culling distance t is used max , so that if t int >t max (Or in an alternative example, if t int ≥t max ), the intersection is not accepted. Therefore, by comparing the distance component of the primitive vertex along the direction / length of the ray with t min and t max This comparison is used to determine if the ray does not intersect the primitive.
[0223] Fig.11The method comprises at least one determination step S1110, S1112. In step S1110, it is determined whether the determined distance components of all vertices in the set of vertices defining the primitive are less than (or alternatively less than or equal to) t min That is, it is determined whether all determined distance components of the vertices are less than the minimum valid distance of the ray. In other words, in order for the condition in step S1110 to be true, all vertices in the set of vertices must have a distance along the direction / length of the ray that is less than t min If all vertices have a distance value less than t min , then this means that the ray does not intersect the primitive because the primitive is not within the range of distance values within which the ray is valid. In detail, the primitive is not within the range of distance values within which the ray intersects the ray, where the distance value to any such intersection point is the normalized linear combination of the union of the distance values given by the set of vertices defining the primitive (because primitives are planar), and so will also satisfy the same t min Comparison standard. Fig.11 If the answer to the test at step S1110 is no, the method proceeds to step S1112.
[0224] Similar to step S1110, in step S1112, it is determined whether the determined distance components of all vertices in the set of vertices defining the primitive are greater than (or alternatively greater than or equal to) t max In other words, in order for the condition in step S1112 to be true, all vertices in the set of vertices must have a distance along the direction / length of the ray greater than t max That is, determine whether all the determined distance components of the vertex are greater than the maximum effective distance of the ray. If all vertices have a distance greater than t max , then this means that the ray does not intersect the primitive because the primitive is not within the range of distance values within which the ray is valid. The reasoning for this is similar to the minimum case.
[0225] Fig.11 The method includes both steps S1110 and S1112. That is, Fig.11 The method includes comparing the determined distance component of each of the vertices with both the minimum valid distance value and the maximum valid distance value of the ray. It should be understood that in some examples, the method may only include one of method steps S1110 and S1112. That is, the method may compare the determined distance component of each of the vertices with only one of the minimum valid distance value or the maximum valid distance value of the ray. In other words, the method may include determining whether all vertices are less than t min The method may alternatively include determining whether all vertices are greater than tmax . Note that if the answer to step S1112 is yes, then step S1112 need not be performed. Alternatively, in another example, method steps S1112 and S1110 may be reversed, such that step S1112 is performed first, and if the answer to the test at step S1112 is no, then step S1110 is performed. In this example, if the answer to step S1112 is yes, then step S1110 would not need to be performed. In yet another example (which may be particularly beneficial if the method is implemented in hardware, such as in a fixed function circuit), method steps S1110 and S1112 may be performed in parallel.
[0226] If the answer to step S1110 is yes (i.e., all of the determined distance components of the vertices are less than the minimum effective distance of the ray), the method proceeds to step S1114, where it is determined that the ray does not intersect the primitive. Similarly, if the answer to step S1112 is yes (i.e., all of the determined distance components of the vertices are greater than the maximum effective distance of the ray), the method proceeds to step S1112. That is, the distance values of the primitives are all less than t min or all greater than t max , then this means that there is a "gap" between the ray and the primitive. Alternatively, if the answer to the test of both steps S1110 and S1112 is no (i.e., the non-intersection condition is not satisfied), the method proceeds to step S1116, at which the primitive is submitted for additional intersection testing. That is, at S1116 it is determined that the intersection test module does not have sufficient information to determine whether there is no intersection between the ray and the primitive. In other words, the intersection test module is configured to perform additional intersection tests on the primitive in response to determining the following situations: (i) the determined distance component of not all vertices of the primitive is less than the minimum valid distance, and (ii) the determined distance component of not all vertices of the primitive is greater than the maximum valid distance. Therefore, a subsequent intersection test (e.g., a floating point calculation) must be performed to reach this determination.
[0227] The distance component of each vertex along the direction / length of the ray is determined by observing the first coordinate of each of the vertices. That is, the distance component of each vertex along the direction / length of the ray can be determined by observing a single set of coordinates measured along a single axis of the coordinate system. The coordinate system along which the distance of each vertex along the direction / length of the ray is determined can be a spatial coordinate system, or alternatively it can be a ray coordinate system. Note that reference Fig.11 The first coordinate may be the same as the one referenced above. Figure 4 Observing a single coordinate for each primitive vertex is advantageous because it simplifies the intersection testing method described in this article.
[0228] As already described above, each vertex defining a primitive has a set of coordinate values in a spatial coordinate system, where each coordinate value is a measurement of the vertex along a corresponding axis of the spatial coordinate system. 0 can have a set of coordinates (x 0 ,y 0 ,z 0 ).like Figure 2 As shown, a ray extending through a spatial coordinate system may have a directional component measured along each of the X, Y, and Z axes. The principal axis of the ray may be identified as the axis along which the component of the ray's directional vector has the largest magnitude. Figure 2 In the example, the principal axis of the light is the Z axis, because the amplitude of the light direction is the largest along this axis (i.e., D z >D x ,D y , so D z =D maj ). The remaining two axes not identified as major axes (e.g. Figure 2 The X and Y axes in the ray are identified as the minor axis. Note that the component of the ray direction along the ray's major axis is not zero, as this would mean that the direction vector is zero, which would be invalid.
[0229] Comparing the determined distance component of each vertex with at least one of the minimum valid distance value and the maximum valid distance value of the light can include observing the coordinate data of the vertex in the spatial coordinate system in which the primitive is defined. As mentioned above, the spatial coordinate system can be a world space coordinate system or an instance space coordinate system. The first coordinate observed to determine the distance of each vertex along the direction / length of the light can be measured along the main axis of the light (expressed as its main axis coordinate of the light). That is, the first vertex coordinate can be along the axis corresponding to the component with the maximum magnitude of the light direction vector. The advantage of observing the distance in this way is that the coordinates of the primitive vertex along this axis are most aligned with the coordinates of the light direction / length, and therefore when the coordinate values are measured along this axis, the correct result can be obtained. In contrast, observing the distance along the minor axis of the light (wherein the light direction has a zero component along this minor axis) may result in erroneous distance measurements (due to division / multiplication by zero, see below for more details).
[0230] Fig.11The method may also include projecting coordinate data for the set of three or more vertices into a ray space using the ray data, wherein the ray space has two non-parallel axes that are both transverse to the direction of the ray, and a ray space reference system associated with the two non-parallel axes is centered on a point on the ray, such that the ray is represented as this point on the two non-parallel axes in the ray space, and wherein this point is the origin of the ray space. In other words, in ray space, the ray is located at the intersection of the two non-parallel axes, and when considered in world / instance space, the origin of the ray space is located on the ray. This origin of the ray space (which is located on the ray) may or may not be the same point as the ray origin (when considered in world / instance space). When v 0 When the vertex coordinates of are projected from the space coordinate system to the light coordinate system, they can be expressed as (p 0 ,q 0 ,r 0 ). As mentioned above, the p- and q-coordinates of the vertices in ray space can be transverse to the direction of the ray. In contrast, the r-coordinate is parallel to the direction of the ray (and in some cases may coincide with the direction of the ray). Therefore, the r-coordinate can be used to provide an indication of the distance of each primitive vertex along the direction / length of the ray.
[0231] Once the coordinate data for the set of three or more vertices has been projected into ray space (which may be performed as a step of intersection testing), a comparison of the determined distance of each of the vertices with at least one of a pair of minimum and maximum distance values of the ray may be performed using the projected coordinate data. That is, Fig.11 The method can use the projected vertex coordinates in ray space along the third ray space axis to calculate the distance of the primitive along the ray direction / length. This can be done by interpolating r iThe method may include using the original coordinate data to calculate an indication of the coordinate value of each vertex along an axis in the spatial coordinate system for which the component of its ray direction vector has the largest magnitude. That is, the projected coordinate data may be used to calculate an indication of the coordinate value of each vertex along a principal axis. This may be accomplished by interpolating the ray principal coordinates with the corresponding barycentric data of the ray principal coordinates (or another similar set of parameters for higher-order primitives) to produce the ray principal coordinates of the intersection point between the ray and the primitive. This ray space coordinate is then divided by the magnitude of the ray direction vector (i.e., the ray length) to obtain the (signed) Euclidean distance of the intersection. This distance may then be divided again by the magnitude of the ray direction vector (i.e., the ray length) to obtain a distance that is a (signed) multiple of the ray length. Alternatively, the method may include using the original coordinate data to calculate an indication of the coordinate value of each vertex along an axis in the spatial coordinate system for which the component of its ray direction vector has the largest magnitude. That is, the projected coordinate data may be used to calculate an indication of the coordinate value of each vertex along a principal axis. This may be accomplished by interpolating the ray principal coordinates with the corresponding barycentric data of the ray principal coordinates (or another similar set of parameters for higher-order primitives) to produce the ray principal coordinates of the intersection point between the ray and the primitive. The coordinates of the intersection point are then divided by the principal components of the ray to obtain a distance that is a (signed) multiple of the ray length. This distance can then be multiplied by the magnitude of the ray direction vector (i.e., the ray length) to obtain the (signed) Euclidean intersection distance. The second approach involves reduced floating point operations and therefore offers an efficiency advantage over the first approach. Note that the sign of the intersection distance indicates whether the distance traveled is in the direction of the ray or opposite to this direction. Viewing the intersection distance as a (signed) multiple of the ray length is generally preferred to the (signed) Euclidean distance because the former distance is not affected by any scaling component of the instance transformation operation applied to the ray.
[0232] Further references Fig.11 , the indication of the coordinate value along the principal axis of the ray may include performing a scaling operation on this coordinate value. That is, the indication of the coordinate value along the principal axis of the ray may include a rescaled version of the vertex coordinate of the indicated spatial coordinate value in the ray space. In other words, the method may initially include looking at the components of these distances measured along the principal axis. Then, in order to correctly adjust these components to calculate the distance as a multiple of the ray length, each of the first coordinates may be rescaled by a predetermined scaling factor. This scaling factor may be constant or ray-dependent. This scaling factor may be the inversion (i.e., the inverse) of the principal component of the ray direction (where this may be pre-calculated ray by ray and stored as ray data). Rescaling with a predetermined scaling factor may include multiplying the principal axis component of the vertex by this scaling factor. For example, this may involve multiplying these values by the inversion of the principal component of the ray direction. That is, the components may be rescaled by multiplying D maj Inversion of (for example, about Figure 2 D z ), that is, 1 / Dmaj to scale each coordinate in the coordinates.
[0233] The calculation of the components of the first vertex coordinates projected onto the principal axes can be performed more specifically such that:
[0234]
[0235] In the above equation, r i is the i-th vertex v i Coordinates in ray space, and 0≤i <n,D maj is the principal component of the light direction, and r i ′ are the rescaled vertex coordinates of the ith vertex. These rescaled ray principal coordinates of the vertex are then compared with t as outlined above. min and t max The culling margin is given as a multiple of the ray length, e.g. a t of 1.0 min Value indicating that the valid segment of a ray begins after traveling a single ray direction / length from the ray origin.
[0236] Rather than rescaling each ray principal coordinate of each vertex for each ray-to-primitive test, and since the rescaled values may have no use other than for such early primitive culling (e.g., they are not output as intersection attributes), t is instead rescaled. min and t max values may be more cost-effective. This provides cost savings because these two values are typically per-ray attributes (i.e., stored as part of the ray data), and so the algorithm can be pre-executed and only executed once per ray. In other words, Fig.11 The method may alternatively include using the principal component of the light direction vector (D maj ), i.e., the inverse / reciprocal scaling factor in the case of vertices, to scale the minimum and maximum effective distance values for a ray. As mentioned above, the principal axis is the axis along which the maximum magnitude of the ray direction is measured. min and t max Each of these values can be scaled by multiplying them by the principal components of the light direction vector. That is, each of these values can be scaled by multiplying them by D maj (For example, regarding Figure 2 D z ) to scale t min and t max Each of them.
[0237] Projection onto the principal axis t min The calculation of the components of can be performed more specifically such that:
[0238] t′ min=D maj t min
[0239] In the above equation, t min is the minimum effective distance of the light, D maj is the principal component of the light direction (in the spatial coordinate system), and t′ min is the rescaled minimum effective distance value of the ray. The above calculation can include t min That is, the above calculation can be rescaled by a factor of D maj t min Rescaling is performed.
[0240] Similarly, the projection of t onto the principal axis max The calculation of the components of can be performed more specifically such that:
[0241] t′ max =D maj t max
[0242] In the above equation, t max is the maximum effective distance of the light, D maj is the principal component of the light direction (in the spatial coordinate system), and t′ min is the rescaled maximum effective distance value of the ray. That is, the above calculation can be reduced by a factor D maj t max The ray principal coordinates of the vertex are then compared with these rescaled t as outlined above. min and t max The t′ values are compared to the t′ values. Rescaling the culling bounds by the opposite scaling factor to that used when rescaling the vertex coordinates results in the same logical comparison. These modified culling bounds are now given not in terms of multiples of the ray length, but as absolute distances along the ray's major axis. For example, a t′ of 1.0 min A value indicating that the ray's valid segment begins after traveling a unit distance from the ray's origin along the ray's major axis.
[0243] As described above Figure 4In the same way as in the method, if the non-intersection condition is met, it is determined that the ray does not intersect with the primitive, and no additional intersection test is performed for this primitive with respect to the ray. If no additional intersection test is performed for the primitive with respect to the ray, the primitive can be described as having been "rejected". The term "reject" can be defined as removing the primitive from the intersection test pipeline so that no additional test is performed from this primitive. The primitive can be removed by removing the data defining this primitive from the temporary storage for processing this primitive. The primitive can be removed alternatively by associating a flag with the primitive to indicate that no additional processing is performed on this primitive. Alternatively, the primitives that require additional intersection tests can be marked (for example, using a data flag), and the primitives that do not require additional tests can be unmarked. Therefore, the intersection test module can know to select only the marked primitives for additional testing. As described above, it is advantageous to remove the primitive when it is determined that the ray does not intersect with the primitive, because this reduces the number of subsequent processor-intensive intersection tests that can be performed on this primitive.
[0244] Conversely, if it is determined that the non-intersection condition is not met, it cannot be determined that the ray does not intersect the primitive. Note that this does not mean that the ray intersects the primitive. Conversely, if the non-intersection condition is not met, it can be determined that there is insufficient data at the current step in the processing pipeline to determine whether there is no intersection between the ray and the primitive. Therefore, additional intersection tests must be performed on the primitive to explicitly determine whether there is an intersection. Therefore, in response to determining that the non-intersection condition is not met, the method described above may further include performing additional intersection tests on the primitive. Additional intersection tests may include floating point operations (e.g., edge tests performed by calculating 2D cross product values).
[0245] Fig.12 It is shown that you can use Fig.11 An example of a primitive 1202 that is culled using the method shown in FIG. The primitive 1202 includes three vertices (v 0 ,v 1 ,v 2 ). Each vertex of the primitive is associated with a set of coordinates in the spatial coordinate system. The intersection of the primitive is tested against a ray 1204. The ray 1204 has a direction defined in the spatial coordinate system (shown as the third ray space axis R) and an origin O. The ray also has a minimum culling distance and a maximum culling distance t min ,t max , which indicates the range of distances along the direction / length of the ray within which an intersection between the ray and the primitive can be determined to be valid. In this example, the principal axis of the ray (i.e., the axis along which the magnitude of the ray direction is greatest) is the X axis. Using the method described above, the vertex coordinates of the primitive along the ray (r o ,r 1 ,r 2) along the major axis (i.e., the X axis). These vertex coordinates are combined with the coordinates along the major axis (t′ min , t′ max ) measured by the modified culling boundary t min and t max For comparison. Fig.12 In the example, the vertex coordinates along the main axis are all smaller than t′ measured along the main axis. min Component. Therefore, it can be determined that primitive 1202 is outside the effective intersection range of the light. This means that it can be determined that there is no intersection between the light and the primitive. Therefore, the primitive can be eliminated so that no additional intersection test is performed on it.
[0246] If multiple primitives share one or more edges, then the advantages of the methods described herein may be obtained. In these examples, analysis of the coordinates of the vertices defining the edges of the primitives may be used to eliminate all primitives that share these edges. For example, for Figure 5 The method in, which includes eliminating primitives based on the direction of a single edge of this primitive, and the method can be used to eliminate all primitives sharing this edge. This elimination of multiple primitives can be obtained by storing references to the edges that link primitives to define them. Similarly, the analysis of the coordinates of the vertices shared by multiple edges / primitives can be used to reduce the cost of the analysis of each edge / primitive that shares this vertex. That is, the vertex analysis described in this article can be performed in advance, rather than performing once for each edge (each primitive) or each primitive. The results of the vertex analysis (also referred to as intermediate results) can be stored in a test unit or in a local memory of the test unit. The result can be obtained using a reference to the primitive that points to the vertex that defines each primitive, or alternatively by using the corresponding reference to each edge of the primitive that points to the vertex that defines this edge.
[0247] Fig.13 A computer system is shown in which the graphics processing system described herein can be implemented. The computer system includes a CPU 1302, a GPU 1304, a memory 1306, a neural network accelerator (NNA) 1308, and other devices 1314, such as a display 1316, a speaker 1318, and a camera 1322. Processing block 1310 is implemented on GPU 1304. In other examples, one or more of the components depicted can be omitted from the system, and / or processing block 1310 can be implemented on CPU 1302 or within NNA 1308. The components of the computer system can communicate with each other via a communication bus 1320. Storage area 1312 is implemented as part of memory 1306.
[0248] Figure 1 , Figure 4 and Figure 6The module is shown as comprising a plurality of functional blocks. This is merely illustrative and is not intended to define a strict division between different logical elements of such an entity. Each functional block may be provided in any suitable manner. It should be understood that the intermediate values described herein as being formed by the intersection test module need not be physically generated by the intersection test module at any point, and may merely represent logical values that conveniently describe the processing performed by the intersection test module between its input and output.
[0249] The intersection test module described herein can 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. In general, any of the functions, methods, techniques or components described above can 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" can be used herein to generally represent software, firmware, hardware or any combination thereof. In the case of software implementation, a module, function, component, element, unit, block or logic represents a program code, which performs a specified task when executed on a processor. The algorithms and methods described herein can be performed by one or more processors that execute code, and the code causes (one or more) processors to perform the algorithm / method. Examples of computer-readable storage media include random access memory (RAM), read-only memory (ROM), optical disk, flash memory, hard disk storage, and other memory devices that can use magnetic, optical and other technologies to store instructions or other data and can be accessed by a machine.
[0250] As used herein, the terms computer program code and computer readable instructions refer to any kind of executable code for a processor, including code expressed in machine language, interpreted language, or scripting language. Executable code includes binary code, machine code, byte code, code that defines an integrated circuit (e.g., hardware description language or netlist), and code expressed in programming language code such as C, Java, or OpenCL. Executable code can be, for example, any kind of software, firmware, script, module, or library that, when properly executed, processed, interpreted, compiled, run in a virtual machine or other software environment, causes a processor of a computer system supporting the executable code to perform the tasks specified by the code.
[0251] A processor, computer or computer system may be any kind of device, machine or special purpose circuit, or a collection or part thereof, which has processing capabilities so that it can execute instructions. A processor may be or include any kind of general or special purpose processor, such as a CPU, GPU, NNA, system on chip, state machine, media processor, application specific integrated circuit (ASIC), programmable logic array, field programmable gate array (FPGA), etc. A computer or computer system may include one or more processors.
[0252] The present invention is also intended to cover software that defines the 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 on which is encoded computer-readable program code in the form of an integrated circuit definition data set, which, 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 including any of the devices described herein. The integrated circuit definition data set may be, for example, an integrated circuit description.
[0253] Thus, a method of manufacturing an intersection test module as described herein at an integrated circuit manufacturing system may be provided. In addition, an integrated circuit definition data set may be provided which, when processed in an integrated circuit manufacturing system, enables the method of manufacturing an intersection test module to be performed.
[0254] 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 that defines hardware 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. The higher-level representation that logically defines hardware suitable for fabrication in an integrated circuit (e.g., RTL) may be processed at a computer system configured to generate a manufacturing definition of the integrated circuit in the context of a software environment that includes definitions of circuit elements and rules for combining those elements to generate a manufacturing definition of the integrated circuit so defined by the representation. As is typically the case with software 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 for generating a manufacturing definition of the integrated circuit to execute code that defines the integrated circuit to generate the manufacturing definition of the integrated circuit.
[0255] Now about Figure 8 An example of processing an integrated circuit definition data set at an integrated circuit manufacturing system to configure the system to manufacture an intersection test module is described.
[0256] Figure 8 An example of an integrated circuit (IC) manufacturing system 1402 is shown, which is configured to manufacture an intersection test module as described in any of the examples herein. Specifically, the IC manufacturing system 1402 includes a layout processing system 1404 and an integrated circuit generation system 1406. The IC manufacturing system 1402 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 (e.g., which embodies an intersection test module as described in any of the examples herein) based on the IC definition data set. The processing of the IC definition data set configures the IC manufacturing system 1402 to manufacture an integrated circuit that embodies an intersection test module as described in any of the examples herein.
[0257] The layout processing system 1404 is configured to receive and process an IC definition data set to determine a circuit layout. Methods for determining a circuit layout based on an IC definition data set are known in the art and may, for example, involve synthesizing RTL code 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 location information for the logic components, the circuit layout may be determined by the gate-level representation of the circuit. This may be done automatically or with user involvement in order to optimize the circuit layout. When the layout processing system 1404 has determined the circuit layout, the layout processing system may output the circuit layout definition to the IC generation system 1406. The circuit layout definition may be, for example, a circuit layout description.
[0258] As is known in the art, IC generation system 1406 generates an IC according to a circuit layout definition. For example, IC generation system 1406 can implement a semiconductor device manufacturing process for generating an IC, which can involve a multi-step sequence of photolithography and chemical processing steps during which electronic circuits are gradually formed on a wafer made of semiconductor material. The circuit layout definition can be in the form of a mask that can be used in a photolithography process to generate an IC according to the circuit definition. Alternatively, the circuit layout definition provided to IC generation system 1406 can be in the form of a computer readable code that IC generation system 1406 can use to form an appropriate mask for generating an IC.
[0259] The different processes performed by IC manufacturing system 1402 can all be implemented in one location, for example, by one party. Alternatively, IC manufacturing system 1402 can be a distributed system such that some of the processes can be performed at different locations and can be performed by different parties. For example, some of the following stages can be performed at different locations and / or by different parties: (i) synthesizing RTL code representing an IC definition data set to form a gate-level representation of a circuit to be generated; (ii) generating a circuit layout based on the gate-level representation; (iii) forming a mask based on the circuit layout; and (iv) using the mask to manufacture the integrated circuit.
[0260] In other examples, processing the integrated circuit definition data set at the integrated circuit manufacturing system may configure the system to manufacture the intersection test module without processing the IC definition data set to determine the circuit layout. For example, the integrated circuit definition data set may define the configuration of a reconfigurable processor such as an FPGA, and processing the data set may configure the IC manufacturing system to generate (e.g., by loading the configuration data into the FPGA) the reconfigurable processor having the defined configuration.
[0261] In some embodiments, the integrated circuit manufacturing definition data set, when processed in the integrated circuit manufacturing system, can cause the integrated circuit manufacturing system to generate an apparatus as described herein. Figure 8 An integrated circuit manufacturing system may be configured in the manner described to manufacture the apparatus described herein.
[0262] In some examples, the integrated circuit definition data set may include software that runs on, or in combination with, hardware defined at the data set. Figure 8 In the example shown, the IC generation system can be further configured by the integrated circuit definition dataset to load firmware onto the integrated circuit according to the program code defined in the integrated circuit definition dataset when manufacturing the integrated circuit, or otherwise provide the integrated circuit with program code for use with the integrated circuit.
[0263] Compared to known implementations, the implementation of the concepts set forth in this application in devices, equipment, modules and / or systems (and in the methods implemented herein) can cause performance improvements. Performance improvements can include one or more of improved computing performance, reduced latency, increased throughput and / or reduced power consumption. During the manufacture of such devices, devices, modules and systems (e.g., in integrated circuits), a trade-off can be made between performance improvements and physical implementations to improve manufacturing methods. For example, a trade-off can be made between performance improvements and layout area to match the performance of known implementations, but using less silicon. For example, this can be accomplished by reusing functional blocks in a serial manner or sharing functional blocks between elements of devices, devices, modules and / or systems. In contrast, the concepts set forth in this application that cause improvements in the physical implementations of devices, devices, modules and systems (e.g., reduced silicon area) can be weighed against performance improvements. This can be accomplished, for example, by manufacturing multiple instances of a module within a predefined area budget.
[0264] Applicants hereby independently disclose each individual feature described herein and any combination of two or more such features, to the extent that such feature or combination can be implemented based on the specification as a whole in view of the common general knowledge of a person skilled in the art, regardless of whether such feature or combination of features solves any problem disclosed herein. In view of the foregoing description, it will be clear to a person skilled in the art that various modifications can be made within the scope of the invention.
Claims
1. A method for performing intersection testing of rays about primitives in a ray tracing system, wherein the primitives are defined by an ordered set of vertices, the method comprising: receiving (i) data defining a direction and an origin of the ray to be tested against the primitive, and (ii) coordinate data of a set of two or more of the vertices, the set of two or more vertices defining at least one edge of the primitive; projecting the coordinate data of the set of two or more vertices into a ray space using the ray data, wherein the ray space has two non-parallel axes each transverse to the direction of the ray, wherein a ray space reference system associated with the two non-parallel axes is centered on a point on the ray such that the ray is represented as the point on the two non-parallel axes in the ray space, and wherein the point is the origin of the ray space; analyzing signs of the coordinate data of the set of two or more vertices in the ray space to determine whether a disjoint condition is satisfied, wherein satisfaction of the disjoint condition indicates that the ray does not intersect the primitive; as well as In response to determining that the non-intersection condition is satisfied, it is determined that the ray does not intersect the primitive.
2. A method for performing intersection testing of rays about primitives in a ray tracing system, the primitives being defined by an ordered set of vertices, the method comprising: receiving (i) data defining a direction and an origin of the ray to be tested against the primitive, and (ii) coordinate data of a set of two or more of the vertices, the set of two or more vertices defining at least one edge of the primitive; projecting the coordinate data of the set of two or more vertices into a ray space using the ray data, wherein the ray space has two non-parallel axes each transverse to the direction of the ray, wherein a ray space reference system associated with the two non-parallel axes is centered on a point on the ray such that the ray is represented as the point on the two non-parallel axes in the ray space, and wherein the point is the origin of the ray space; analyzing signs of the coordinate data of the set of two or more vertices in the ray space to determine whether a disjoint condition is satisfied, wherein satisfaction of the disjoint condition indicates that the ray does not intersect the primitive; as well as In response to determining that the non-intersection condition is not satisfied, performing an additional intersection test on the primitive with respect to the ray.
3. A method as claimed in claim 1 or 2, wherein the analyzing the signs of the coordinate data of the set of two or more vertices in the ray space is performed as part of the intersection test of the ray with respect to the primitive without performing any floating point calculations in advance.
4. A method as claimed in any preceding claim, wherein the sign of the coordinate data of the set of two or more vertices in the analysis ray space indicates whether the at least one edge of the primitive has intersected an axis of the two non-parallel axes in the ray space.
5. A method as claimed in any preceding claim, further comprising performing a zero comparison on the coordinate data for each vertex in the set of two or more vertices.
6. The method of any preceding claim, wherein the set of two or more vertices comprises a first pair of vertices defining a first edge of the primitive, and wherein analyzing the sign of the coordinate data of the set of two or more vertices in ray space comprises determining whether: The sign of a first coordinate of a first vertex in the first pair of vertices in the ray space is different from the sign of the first coordinate of a second vertex in the first pair of vertices, and the sign of a second coordinate of the first vertex in the first pair of vertices in the ray space is the same as the sign of the second coordinate of the second vertex in the first pair of vertices; or The sign of the second coordinate of the first vertex in the first pair of vertices in the light space is different from the sign of the second coordinate of the second vertex in the first pair of vertices, and the sign of the first coordinate of the first vertex in the first pair of vertices in the light space is the same as the sign of the first coordinate of the second vertex in the first pair of vertices.
7. The method of claim 6, using said analysis of said signs of said coordinate data of said first pair of vertices in ray space to determine an orientation of said first edge of said primitive.
8. The method of claim 6 or 7, wherein the non-intersection condition is satisfied if the orientation of the first edge of the primitive matches a predetermined orientation, the predetermined orientation indicating that the ray does not intersect a primitive including an edge having the orientation.
9. A method as claimed in claim 7 or 8, wherein the orientation of the first side of the primitive is defined according to the orientation of the two non-parallel axes, and the orientation of the two non-parallel axes is indicated by data flags used to translate the coordinates of the first pair of vertices in the ray space.
10. The method of claim 9, wherein the data flag is a single bit.
11. The method of claim 6, wherein the set of two or more vertices is a set of three or more vertices forming at least two pairs of vertices, the first pair of vertices defining the first edge of the primitive and the second pair of vertices defining a second edge of the primitive, and wherein analyzing the sign of the coordinate data of the set of two or more vertices in ray space comprises determining whether: The sign of the first coordinate of the first vertex in the second pair of vertices in the ray space is different from the sign of the first coordinate of the second vertex in the second pair of vertices, and the sign of the second coordinate of the first vertex in the second pair of vertices in the ray space is the same as the sign of the second coordinate of the second vertex in the second pair of vertices; or The sign of the second coordinate in the light space of the first vertex in the second pair of vertices is different from the sign of the second coordinate of the second vertex in the second pair of vertices, and the sign of the first coordinate in the light space of the first vertex in the second pair of vertices is the same as the sign of the first coordinate of the second vertex in the second pair of vertices.
12. The method of claim 11, wherein the analysis of the signs of the coordinate data of the first and second pairs of vertices in ray space is used to determine the orientations of the first and second edges of the primitive.
13. The method of claim 12, wherein the non-intersection condition is satisfied if the orientation of the first edge of the primitive is different from the orientation of the second edge of the primitive.
14. The method of any one of claims 1 to 5, wherein the set of two or more vertices is a complete set of ordered vertices defining the primitive.
15. A method as claimed in claim 14, wherein the analyzing the sign of the coordinate data of the set of two or more vertices in the ray space includes analyzing the sign of at least the first coordinate in the ray space of all of the vertices in the complete set of vertices defining the primitive.
16. The method of claim 15, wherein the non-intersection condition is satisfied if at least one of the following is true: said sign of the first coordinate in ray space is the same for all said vertices in said complete set of ordered vertices; or The sign of the second coordinate in ray space is the same for all of the vertices in the complete set of ordered vertices.
17. A method as claimed in any preceding claim, wherein if it is determined that the ray does not intersect the primitive, no further intersection tests are performed with respect to the ray for the primitive.
18. An intersection test module for performing intersection tests of rays about primitives in a ray tracing system, the primitives being defined by an ordered set of vertices, the intersection test module being configured to: receiving (i) data defining a direction and an origin of the ray to be tested against the primitive, and (ii) coordinate data of a set of two or more of the vertices, the set of two or more vertices defining at least one edge of the primitive; projecting the coordinate data of the set of two or more vertices into a ray space using the ray data, wherein the ray space has two non-parallel axes each transverse to the direction of the ray, wherein a ray space reference system associated with the two non-parallel axes is centered on a point on the ray such that the ray is represented as the point on the two non-parallel axes in the ray space, and wherein the point is the origin of the ray space; analyzing signs of the coordinate data of the set of two or more vertices in the ray space to determine whether a disjoint condition is satisfied, wherein satisfaction of the disjoint condition indicates that the ray does not intersect the primitive; as well as In response to determining that the non-intersection condition is satisfied, it is determined that the ray does not intersect the primitive.
19. The intersection testing module of claim 18, wherein the intersection testing module is further configured to perform an additional intersection test on the primitive with respect to the ray in response to determining that the non-intersection condition is not satisfied.
20. A computer-readable storage medium having computer-readable code stored thereon, the computer-readable code being configured to cause the method according to any one of claims 1 to 17 to be executed when the code is run.
21. A computer-readable storage medium having an integrated circuit definition data set stored thereon, wherein when the integrated circuit definition data set is processed in an integrated circuit manufacturing system, the integrated circuit manufacturing system is configured to manufacture the intersection test module as claimed in claim 18 or 19.