Intersection testing in ray tracing systems
By using the rate of change calculation of the ray coordinate system and intersection attributes in the ray tracing system, the intersection test of rays and primitives is simplified, the problems of high power consumption and large hardware requirements in the prior art are solved, and more efficient calculations are achieved.
Patent Information
- Application Number
- CN202411850517.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2024-01-08
- Filing Date
- 2024-12-16
- Publication Date
- 2025-07-08
AI Technical Summary
When conducting intersecting tests, existing ray tracing systems require a large number of computationally intensive and complex floating-point operations, resulting in high power consumption, large hardware requirements and long delay, which is difficult to effectively reduce.
By using the ray coordinate system for intersection testing in the ray tracing system, the intersection attribute values between the ray and the primitive are determined, and the rate of change is calculated in the direction parallel to the axis of the ray coordinate system, simplifying the intersection testing process.
Reduces the delay, power consumption and silicon area of the ray tracing system, improves computing efficiency, and implements simplified intersection testing in hardware.
Smart Images

Figure CN120279154A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to intersection testing in a ray tracing system. Background Art
[0002] Ray tracing is a computational rendering technique used to generate an image of a scene by tracing the path of light from the perspective of a camera through the scene. The path of light may alternatively be referred to as a ray. Each ray is modeled as originating from the camera and entering the scene through a pixel. As the ray traverses the scene, it may intersect with objects within the scene. The intersection between the ray and the object it intersects can be modeled to create realistic visual effects. For example, in response to determining that a ray intersects with an object, a shader program can be executed for the intersection. A programmer can write a shader program to define how the system reacts to the intersection, which can cause one or more secondary rays to be emitted into the scene. For example, if the object is transparent or translucent, the secondary rays can represent the reflection of light from the intersected object or the refraction of light through the object. As another example, the shader program can cause one or more rays to be emitted into the scene to determine whether the object is in shadow at the intersection point. The result of executing the shader program (and processing the related secondary rays) can be the color value of the pixel through which the ray passes.
[0003] Some operations performed in a ray tracing system involve determining differential data. The differential data indicates the rate of change of an attribute with respect to a change in positioning (e.g., a change in horizontal or vertical positioning). For example, the distance from the viewpoint to an object in the scene affects the magnitude of the shift in scene space, which corresponds to a shift in rendering space, such as from one pixel position to an adjacent pixel position. This in turn may affect the level of detail (LOD) suitable for representing the object. As another example, if a surface is at an oblique angle, i.e., if the surface is tilted with respect to the viewpoint from which the scene is being rendered, a vertical shift of one pixel in the rendering space (or "screen space") may correspond to a different shift in scene space than a horizontal shift of one pixel in the rendering space. Gradient data (i.e., differential data) can be used for various functions in the rendering process, such as selecting an appropriate mipmap level of a texture to be applied to a surface in the scene.
[0004] Rendering an image of a scene using ray tracing may involve performing many intersection tests for different rays against the objects present in the scene. A ray tracing system can 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 require a large amount of physical silicon area in the case where the ray tracing system is implemented in hardware. Therefore, methods for reducing the power consumption, hardware requirements, and latency of intersection tests are desirable. Summary of the Invention
[0005] The present invention content is provided to introduce a series of concepts further described below in the detailed description in a simplified form. The present invention content is not intended to identify the key features or essential features of the claimed subject matter, nor is it intended to limit the scope of the claimed subject matter.
[0006] A method for performing an intersection test for a ray with respect to a primitive in a ray tracing system is provided, the method comprising:
[0007] Determining values of one or more intersection attributes for a primary sample of the ray related to an intersection between the ray and the primitive in a ray coordinate system, wherein the ray coordinate system has two non-parallel axes, both of which are transverse to the direction of the ray, and wherein the origin of the ray coordinate system is located on the ray;
[0008] For one or both of the two non-parallel axes of the ray coordinate system, determining data indicating a change in one or more intersection attributes in a direction parallel to the axis; and
[0009] Using the determined values of one or more intersection attributes for the primary sample of the ray and the determined data indicating a change in one or more intersection attributes in one or both directions parallel to the two non-parallel axes to process the intersection between the ray and the primitive.
[0010] The one or more intersection attributes may describe one or more characteristics of the intersection between the ray and the primitive.
[0011] The one or more intersection attributes may include one or more of the following: (i) one or more barycentric coordinates, (ii) one or more area coordinates, and (iii) intersection distance.
[0012] For each of the one or two axes of the two non-parallel axes of the ray coordinate system, the data indicating a change in one or more intersection attributes in a direction parallel to the axis may include a rate of change of each intersection attribute among the one or more intersection attributes in a direction parallel to the axis.
[0013] The one or more intersection attributes may include one or more barycentric coordinates. Processing the intersection between the ray and the primitive may include using the rate of change of each barycentric coordinate among the one or more barycentric coordinates in one or both directions parallel to the one or two axes of the two non-parallel axes to determine a level of detail (LOD) for the primitive.
[0014] Processing the intersection between the ray and the primitive may include:
[0015] Using the determined level of detail for the primitive to select a mipmap level of a texture; and
[0016] Apply a texture to a primitive at a selected level of mipmapping.
[0017] The one or more intersection attributes can include two barycentric coordinates. The rate of change of the barycentric coordinates in directions parallel to two non-parallel axes can be given by:
[0018]
[0019] where (u, v) are the barycentric coordinates, p and q are the coordinates on two non-parallel axes, (a p , a q ) are the coordinates on two non-parallel axes for the first vertex of the primitive, (b p , b q ) are the coordinates on two non-parallel axes for the second vertex of the primitive, (c p , c q ) are the coordinates on two non-parallel axes for the third vertex of the primitive, and A Σ represents the area of the primitive in the ray coordinate system.
[0020] The one or more intersection attributes include an intersection distance, and the rate of change of the intersection distance in directions parallel to two non-parallel axes is given by:
[0021]
[0022] where t is the intersection distance, p and q are the coordinates on two non-parallel axes, (u, v) are the barycentric coordinates associated with the intersection between the ray and the primitive, D z is the component with the largest magnitude among the components of the ray direction vector for the ray in the spatial coordinate system defining the primitive, a z is the coordinate on the same dimension of the spatial coordinate system as D z for the first vertex of the primitive, b z is the coordinate on the same dimension of the spatial coordinate system as D z for the second vertex of the primitive, and c z is the coordinate on the same dimension of the spatial coordinate system as D z for the third vertex of the primitive.
[0023] For each of the one or both of the two non-parallel axes of the ray coordinate system, data indicating the change of the one or more intersection attributes in a direction parallel to the axis can include the value of each intersection attribute among the one or more intersection attributes for a subsample of the ray associated with the intersection between the ray and the primitive, the subsample of the ray being offset from the primary sample of the ray in a direction parallel to the axis.
[0024] The value of each intersection property among one or more intersection properties for a subsample of a ray can be determined by applying one or more logical operations to the value of the corresponding intersection property among one or more intersection properties determined for a primary sample of the ray, where the one or more logical operations can include: (i) one or more addition operations, (ii) one or more subtraction operations, and / or (iii) one or more multiplication operations.
[0025] Processing the intersection between the ray and the primitive can include using one or more intersection properties of the subsample of the ray to determine whether the subsample of the ray hits the primitive.
[0026] The method can include determining the values of one or more intersection properties for a plurality of subsamples of the ray that are at different offsets from the primary sample of the ray.
[0027] The method can further include:
[0028] Determining whether the sample of the ray hits the primitive based on the determined values of one or more intersection properties for each sample in the samples of the ray; and
[0029] Using the determination of whether each sample in the samples of the ray hits the primitive to determine an output value representing the intersection of the ray with the scene geometry, where the intersection of the ray with the scene geometry includes the intersection between the ray and the primitive, and
[0030] where the samples of the ray include the primary sample of the ray and a plurality of subsamples.
[0031] The using the determination of whether each sample in the samples of the ray hits the primitive to determine an output value representing the intersection of the ray with the scene geometry can include:
[0032] For each sample in the samples of the ray that is determined to hit the primitive, determining the contribution of the primitive to the output value; and
[0033] Using the determined contributions for the samples of the ray that are determined to hit the primitive to determine an output value representing the intersection of the ray with the scene geometry.
[0034] For each sample in the samples of the ray, the contribution can be weighted based on the positioning of the sample relative to the primary sample.
[0035] The one or more intersection attributes may include multiple area coordinates. Determining the values of the one or more intersection attributes for multiple sub-samples of a ray may include determining at least two area coordinates for each of the multiple sub-samples by adding values to and / or subtracting values from corresponding area coordinates determined for a primary sample of the ray. Determining whether each sample of a ray hits a primitive may include determining whether each sample of the ray hits a primitive based on the signs of the area coordinates determined for the sample.
[0036] The area coordinates (A0, A1A2) for the primary sample may be given by:
[0037] A0 = b p c q -b q c p
[0038] A1 = c p a q -c q a p
[0039] A2 = a p d q -a q d p
[0040] And the area coordinates (A′0, A′1A′2) for the sub-sample may be given by:
[0041] A′0 = A0 + p′(b q -c q ) + q′(c p -b p )
[0042] A′1 = A1 + p′(c q -a q ) + q′(a p -c p )
[0043] A′2 = A2 + p′(a q -b q ) + q′(b p -a p )
[0044] where p′ and q′ represent the offsets of the sub-sample relative to the primary sample on two non-parallel axes, (a p , a q ) are the coordinates of the first vertex of the primitive on two non-parallel axes, (b p , b q(a, b) are the coordinates of the second vertex of the primitive on two non-parallel axes, and (c p , c q ) are the coordinates of the third vertex of the primitive on two non-parallel axes.
[0045] The plurality of sub-samples of the ray can include four sub-samples of the ray that are at corresponding offsets of (-1, 0), (+1, 0), (0, -1), and (0, +1) from the primary sample of the ray in the ray coordinate system.
[0046] The plurality of sub-samples of the ray can include eight sub-samples of the ray that are at corresponding offsets of (-1, -1), (-1, 0), (-1, +1), (0, -1), (0, +1), (+1, -1), (+1, 0), and (+1, +1) from the primary sample of the ray in the ray coordinate system.
[0047] The diffusion value for the ray can be used to determine the offset of the sub-sample of the ray from the primary sample of the ray.
[0048] The diffusion value can be set such that the offset of the sub-sample of the ray from the primary sample of the ray is less than the offset between the primary samples of different rays corresponding to adjacent pixels of the frame to be rendered.
[0049] The diffusion value can represent orthogonal diffusion or pseudo-perspective diffusion of the ray.
[0050] The method can further include obtaining coordinate data for vertices of the primitive in the ray coordinate system. Obtaining the coordinate data for vertices of the primitive in the ray coordinate system can include projecting the coordinate data for vertices of the primitive from the spatial coordinate system defining the primitive to the ray coordinate system using ray data defining the ray.
[0051] Processing the intersection between the ray and the primitive can include:
[0052] Providing the determined values of the one or more intersection attributes for the primary sample of the ray and the determined data indicating the change of the one or more intersection attributes in one or both directions parallel to the two non-parallel axes as input to a shader program; and
[0053] Executing the shader program using the provided input.
[0054] Processing the intersection between the ray and the primitive can include determining an output value representing the intersection of the ray and the primitive for rendering an image of a scene including the primitive.
[0055] The two non-parallel axes of the ray coordinate system can both be orthogonal to the direction of the ray.
[0056] A ray tracing unit is provided, which is configured to perform an intersection test for a ray with respect to a primitive, and the ray tracing unit is configured to:
[0057] Determine values of one or more intersection attributes for a primary sample of the ray related to the intersection between the ray and the primitive in a ray coordinate system, where the ray coordinate system has two non-parallel axes, both of which are transverse to the direction of the ray, and where the origin of the ray coordinate system lies on the ray;
[0058] For one or both of the two non-parallel axes of the ray coordinate system, determine data indicating the variation of one or more intersection attributes in a direction parallel to the axis; and
[0059] Use the determined values of one or more intersection attributes for the primary sample of the ray and the determined data indicating the variation of one or more intersection attributes in one or both of the directions parallel to the two non-parallel axes to process the intersection between the ray and the primitive.
[0060] A ray tracing unit can be provided, which is configured to perform any of the methods described herein.
[0061] A method of manufacturing any of the ray tracing units described herein using an integrated circuit manufacturing system can be provided.
[0062] A computer-readable code can be provided, which is configured to cause any of the methods described herein to be executed when the code runs.
[0063] An integrated circuit definition data set can be provided, which, when processed in an integrated circuit manufacturing system, configures the integrated circuit manufacturing system to manufacture any of the ray tracing units described herein.
[0064] The ray tracing unit can be implemented in hardware on an integrated circuit. A method of manufacturing a ray tracing unit in an integrated circuit manufacturing system can be provided. An integrated circuit definition data set can be provided, which, when processed in an integrated circuit manufacturing system, configures the system to manufacture a ray tracing unit. A non-transitory computer-readable storage medium can be provided, on which a computer-readable description of a ray tracing unit is stored, and the computer-readable description, when processed in an integrated circuit manufacturing system, causes the integrated circuit manufacturing system to manufacture an integrated circuit embodying the ray tracing unit.
[0065] An integrated circuit manufacturing system can be provided, which includes: a non-transitory computer-readable storage medium storing a computer-readable description of the ray tracing unit; a layout processing system configured to process the computer-readable description to generate a circuit layout description of an integrated circuit implementing the ray tracing unit; and an integrated circuit generation system configured to manufacture the ray tracing unit according to the circuit layout description.
[0066] Computer program code for performing any of the methods described herein can be provided. A non-transitory computer-readable storage medium can be provided, having computer-readable instructions stored thereon that, when executed in a computer system, cause the computer system to perform any of the methods described herein.
[0067] As will be apparent to those skilled in the art, the above features can be combined as appropriate and can be combined with any aspect of the examples described herein. BRIEF DESCRIPTION OF THE DRAWINGS
[0068] Examples will now be described in detail with reference to the drawings, in which:
[0069] Figure 1 A ray tracing system configured to perform an intersection test for a ray with respect to a primitive is shown;
[0070] Figure 2 is a flowchart of a method for performing an intersection test for a ray with respect to a primitive in a ray tracing system;
[0071] Figure 3 An intersection between a ray and a primitive in a spatial coordinate system defining the primitive is shown;
[0072] Figure 4 The primitive in the ray coordinate system is shown Figure 3 is shown;
[0073] Figure 5 A first example is shown, in which the positioning of a primary sample and two sub-samples of a ray with respect to a primitive in the ray coordinate system is shown;
[0074] Figure 6 A second example is shown, in which the positioning of a primary sample and four sub-samples of a ray with respect to a primitive in the ray coordinate system is shown;
[0075] Figure 7 A third example is shown, in which the positioning of a primary sample and eight sub-samples of a ray with respect to a primitive in the ray coordinate system is shown;
[0076] Figure 8 is a flowchart showing an example of steps that can be performed as part of step S208.
[0077] Figure 9 shows a graphic element and a light ray having orthogonal diffusion in the spatial coordinate system defining the graphic element;
[0078] Figure 10 shows a graphic element and a light ray having pseudo-perspective diffusion in the spatial coordinate system defining the graphic element;
[0079] Figure 11 shows a computer system in which a ray tracing unit is implemented; and
[0080] Figure 12 displays an integrated circuit manufacturing system for fabricating an integrated circuit embodying the ray tracing unit.
[0081] The accompanying drawings show various examples. Those skilled in the art will appreciate that the element boundaries shown in the drawings (e.g., boxes, groups of boxes, or other shapes) represent one example of a boundary. In some examples, it may be the case that one 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 drawings to indicate similar features. DETAILED DESCRIPTION
[0082] The following description is presented by way of example to enable those skilled in the art to make and use the invention. The invention is not limited to the embodiments described herein, and various modifications to the disclosed embodiments will be apparent to those skilled in the art.
[0083] Embodiments will now be described by way of example only.
[0084] As described above, differential data (or "delta values") indicate the rate of change of the intersection property for a positioning change (e.g., from one pixel to the next). The differential data can be used for a variety of different purposes during rendering, such as for level of detail (LOD) selection. Two of the main techniques used to implement graphics rendering are rasterization and ray tracing. Determining differential data in a ray tracing system is relatively difficult compared to determining differential data in a rasterization system. This is because the rays processed in a ray tracing system tend to be divergent (and thus generally independently manipulated). In particular, the rays for adjacent pixels diverge from each other as they pass through the scene and may intersect different objects and / or surfaces at different angles, such that the secondary rays for adjacent primary rays may be in significantly different directions. The divergence between the rays tends to increase when considering more reflections (or "bounces"). For the purpose of determining differential data, it would be possible to send additional rays through the scene, but this would result in a significant increase in the number of rays processed (e.g., 4 times), which is not feasible from a performance perspective, especially for real-time ray tracing on low-cost devices (e.g., devices such as mobile devices that have strict size and / or power consumption limitations).
[0085] A ray r is typically considered as an infinitely thin line represented by an origin O and a direction vector D, such that r = O + tD, where t indicates the positioning along the ray from the ray origin. In the examples described herein, the ray is considered as a line with a finite (but greater than zero in the standard case) thickness (i.e., not an infinitely thin line), where the primary sample of the ray represents the conventional line of the ray, and where one or more subsamples of the ray are slightly offset from the primary ray and are used to determine the differential data. As described in more detail below, the spread value (σ) for the ray represents the thickness of the ray and is used to determine the offset of the subsample relative to the primary sample of the ray. Given two examples, the spread of the ray can be processed as orthogonal spread or pseudo-perspective spread, as described in more detail below.
[0086] In the examples described herein, the intersection test is performed in a ray coordinate system. The ray coordinate system is dedicated to the ray for which the intersection test is being performed. In particular, the ray coordinate system in the examples described herein has one axis parallel to the ray direction (represented as "S" in the description below) and two non-parallel axes both orthogonal to the ray direction (represented as "P" and "Q" in the description below). The origin of the ray coordinate system is located at a point on the ray, such as at the ray origin. Thus, in these examples, the intersection test can be performed in the plane of the two non-parallel axes (P and Q) of the ray coordinate system, where the primary sample of the ray is represented as a point at the origin in the PQ plane.
[0087] For example, values of one or more intersection properties (such as barycentric coordinates, area coordinates, and / or intersection distance) are calculated for a primary sample of light in a conventional manner. In the examples described herein, data indicating changes in the intersection property in directions parallel to the P-axis and Q-axis of the light coordinate system is determined. For example, in a fixed-function circuit, determination of data indicating changes in the intersection property in directions parallel to the P-axis and Q-axis in the light coordinate system is readily achievable. For example, this determination can involve operations that are readily implemented in hardware, such as addition and / or subtraction. The simplicity of the determination reduces the latency, power consumption, and / or silicon area of the ray tracing system. For example, the data indicating changes in the intersection property in directions parallel to the P-axis and Q-axis can include the rate of change of the intersection property in directions parallel to the P-axis and Q-axis in the light coordinate system. As another example, the data indicating changes in the intersection property in directions parallel to the P-axis and Q-axis can include the values of the intersection property for subsamples of the light that are offset from the primary sample of the light in directions parallel to the P-axis and Q-axis.
[0088] In the examples described herein, each subsample of the light is offset from the primary sample of the light (i.e., offset from the origin of the light coordinate system) in the PQ plane by a set of one or more steps having an amplitude of 1 (i.e., a unit amount) in a direction parallel to the P-axis or Q-axis. The set of one or more steps for a subsample can have at most a maximum number of steps. The maximum number of steps is a small number, such as 1, 2, 3, 4, or 5. In some of the examples described below (such as Figure 5 and Figure 6 the examples shown therein), the set of one or more steps for a subsample each has a single step, i.e., the maximum number of steps is 1. Determining the intersection property for a subsample of the light is very simple, for example, by applying one or more increments and / or decrements (i.e., addition and / or subtraction) to the value of the corresponding intersection property determined for the primary sample of the light.
[0089] In different naive methods, the value of the intersection property can be determined for individual sub-rays that are slightly offset from the primary ray by performing the following operations: passing these individual sub-rays through the scene and performing individual intersection test calculations for these individual sub-rays in a conventional manner (in a manner similar to the intersection test calculations performed for the primary samples of the ray). The value of the intersection property for the sub-rays can then be used to determine differential data indicating the rate of change of the intersection property for the positioning change. However, compared to the method described herein in which data is determined to indicate the change of the intersection property in the directions parallel to the P-axis and Q-axis of the ray coordinate system, this naive method would involve passing a far greater number of rays across the scene, and thus the amount of processing required would increase significantly (resulting in a longer latency, higher power consumption, and / or larger silicon area for the ray tracing system). In other words, compared to the traditional intersection test, the method described herein provides sub-ray data (i.e., supersampling information) with reduced overhead, does not have to trace multiple rays for each pixel, and does not have all the potential divergence problems of these rays (as in the naive method) to achieve a similar result in terms of the quality of the rendered image.
[0090] Figure 1 A ray tracing system 100 configured to perform intersection tests is shown. Intersection tests are performed to render an image of a scene (e.g., a 3D scene). Rendering a scene image using ray tracing may involve performing a number of 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 test module 108, and processing logic 110. Although not shown in Figure 1 it, the intersection test module 108 may include one or more box intersection testing modules and / or one or more primitive intersection test modules. In operation, the ray tracing unit 102 receives geometric data defining an object within a 3D scene. An object may be represented using one or more primitives, and the geometric data may include primitive data defining the primitives. The primitives may have a planar shape (e.g., a triangular shape) and may be represented as a set of vertices, where the primitive data defining the primitives may include vertex data associated with the vertices of the primitives. The processing module 106 is configured to generate an acceleration structure based on the geometric data and send the acceleration structure to the memory 104 for storage therein. After the acceleration structure has been stored in the memory 104, the intersection test module 108 may retrieve nodes of the acceleration structure from the memory 104 to perform ray intersection tests for the retrieved nodes. The results of the intersection tests are provided to the processing logic 110. The processing logic 110 is configured to process the results of the intersection tests to determine processing values representing an image of the 3D scene. The processing values determined by the processing logic 110 may be transmitted back to the memory 104 for storage therein to represent an image of the 3D scene.
[0091] Typically, when performing a ray-primitive intersection test, a ray is defined according to components (i.e., coordinates) in the spatial coordinate system in which the primitive is defined. However, the ray data that defines the ray can be used to derive a ray coordinate system relative to the ray itself, such that a primitive to be tested for intersection with a given ray can be mapped onto the ray coordinate system derived from the data of that ray. The term "spatial coordinate system" is used herein to refer to the coordinate system in which the primitive is defined. For example, the "spatial coordinate system" can be a world space coordinate system or an instance space coordinate system. In most of the examples described herein, the spatial coordinate system is a three-dimensional coordinate system. The shape, size, and positioning of a primitive can be defined as a region of three-dimensional space that is completely contained within a plane of the three-dimensional coordinate system and can be bounded by n≥3 line segments. Each interior angle of the primitive can be less than or equal to 180°. A primitive with all interior angles less than or equal to 180° is called a convex polygon. A strictly convex polygon is a convex polygon with all interior angles strictly less than 180°.
[0092] The terms "ray coordinate system" and "ray space" are used herein to refer to a coordinate system dedicated to a ray and having the origin of the coordinate system located 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, any point on the ray (i.e., any point along the line of the ray) can be used as the origin of the ray coordinate system, where the minimum culling distance and the maximum culling distance (t min and t max)Make appropriate adjustments. The ray coordinate system has three basis vectors corresponding to three axes. The first basis vector among the basis vectors is aligned with the ray direction. The second and third basis vectors are transverse to the first basis vector (i.e., transverse to the direction of the ray) (or not parallel to the first basis vector). The second and third basis vectors may (but do not have to) both be orthogonal to the first basis vector (i.e., orthogonal to the ray direction) and not parallel to each other. The second and third basis vectors of the ray coordinate system are generally not orthogonal to each other, but in some examples they may be orthogonal to each other. The ray space reference frame associated with two non-parallel axes (the P-axis and Q-axis described below) corresponding to the second and third basis vectors is centered at a point on the ray such that the ray is represented as that point on two non-parallel axes in the ray space, and where that point is the origin of the ray space. In other words, in the ray space, the ray lies at the intersection of two non-parallel axes corresponding to the second and third basis vectors, and when considered in the world / instance space, the origin of the ray space lies on the ray. In the examples described herein, when expressed in the spatial coordinate system, the second and third basis vectors of the ray coordinate system have 0 as one component. In some examples, when expressed in the spatial coordinate system, the second and third basis vectors among the basis vectors of the ray coordinate system have a value of ±1 (i.e., magnitude 1) for one component.
[0093] In the examples described below, the ray coordinate system is used by the intersection test module 108 to perform an intersection test to determine whether the ray intersects a primitive. The result of performing the intersection test of the ray with respect to the primitive is output from the intersection test module 108 for use by the ray tracing system 100, for example, to determine which shader program(s) the processing logic 110 executes to handle the intersection between the ray and the primitive.
[0094] Refer to Figure 2 The flowchart shown in describes the method of performing an intersection test of a ray with respect to a primitive in the ray tracing system 100.
[0095] In addition, Figure 3 shows the intersection between the ray 302 and the primitive 304 in the spatial coordinate system defining the primitive. The ray 302 and the primitive 304 are presented for the intersection test. In this example, the primitive 304 is a (strictly) convex polygon. More specifically, the primitive 304 is a triangle. From the perspective of the ray, the orientation of the primitive is indicated as counterclockwise (i.e., the ray direction "enters the page"). The primitive 304 is defined by an ordered set of vertices (a, b, c). Each vertex has a set of coordinate values in the spatial coordinate system, where each coordinate value is the measurement of the vertex along the corresponding axis of the spatial coordinate system. For the primitive 304, in the spatial coordinate system, the first vertex a may have a coordinate set (a x , a y , az ), the second vertex b may have a set of coordinates (b x , b y , b z ), and the third vertex c may have a set of coordinates (c x , c y , c z ). Each pair of vertices of the primitive 304 may define a corresponding edge of the primitive. The primitive 304 includes three edges: a first edge defined by the vertices (a, b), a second edge defined by the vertices (b, c), and a third edge defined by the vertices (c, a). As described above, the ray 302, i.e., r(t), may be represented as r(t) = O + Dt, where O is a vector representing the origin of the ray and D is the direction vector of the ray, where O = (O x , O y , O z ) and D = (D x , D y , D z ). Figure 3 shows the x, y, and z basis vectors of the spatial coordinate system. As described above, the spatial coordinate system may be the world space coordinate system of the scene being rendered, or the spatial coordinate system may be the example spatial coordinate system of a set of example geometries within the scene being rendered.
[0096] In step S202, the ray tracing unit 102 (specifically, the intersection test module 108) obtains the coordinate data for the vertices of the primitive 304 in the ray coordinate system. As described above, the ray coordinate system has two non - parallel axes (P and Q) that are both transverse (e.g., orthogonal) to the direction of the ray, and the origin of the ray coordinate system is located on the ray. In particular, in the example shown in Figure 3 , the origin of the ray coordinate system used in the intersection test is the origin of the ray 302. The positioning of the vertices defining the primitive 304 is translated by subtracting the ray origin from the vertex positioning. Figure 3 shows the primitive 304 after this translation has been performed, where the origin of the spatial coordinate system is located at the origin of the ray 302. In the example shown in Figure 3 , the ray 302 intersects the primitive 304 at the intersection point 306. In Figure 3 , the basis vectors of the ray coordinate system are represented as P, Q, and S.
[0097] The x, y, and z axes are selectively arranged and / or reversed. In particular, the x, y, and z components of the ray and the vertices defining the convex polygon are selectively arranged and / or reversed such that D z ≥ D x ≥ 0 and D z ≥ D y ≥ 0. This ensures that D zis the major component of the ray direction vector, i.e., for the components that are arranged but not reversed, |D z | ≥ |D x | and |D z | ≥ |D y |. Additionally, since any valid ray direction vector has a non - zero magnitude, this means that for the components that are arranged but not reversed, |D z | > 0.
[0098] The first basis vector S of the ray coordinate system is set to be along the direction of the ray, S = A(D x , D y , D z ), where A is a non - zero scalar value. Thus, the S - axis of the ray coordinate system is parallel to the ray direction vector. Figure 3 The origin of the ray coordinate system shown in
[0099] is located at the intersection point at the positioning O among the P - axis, Q - axis, and S - axis. z , 0, - D x ) and Q = C(0, D z , - D y ), where B and C are non - zero scalar values. As shown in the example of Figure 3 , S is orthogonal to P and Q, which can be seen from P.S = Q.S = 0. However, depending on the values of D x and D y , P and Q are not necessarily orthogonal to each other. For example, P and Q are not orthogonal to each other unless D x or D y is zero. It should also be noted that due to the selective arrangement of the axes, D z cannot be zero, such that D z is the major component of the ray direction. As described in more detail below, a (strictly positive) diffusion value (σ) for the ray is used to determine the offset of the sub - samples of the ray from the primary sample of the ray. As a first example, the diffusion of the ray can be treated as orthogonal diffusion, in which case the scalar values B and C can be defined as and where dividing by the square - root term normalizes each of the P - axis and Q - axis, and dividing by the diffusion value (σ) shortens the two axes, such that the gap between samples in the ray space is larger. These divisions occur once per ray generation, so they do not need to be performed on - the - fly during the ray - primitive intersection test. As a second example, the diffusion of the ray can be treated as pseudo - perspective diffusion, in which case the scalar values B and C can be defined as and When scaling the sampling points in response to a distance value (given as a multiple of the ray length), the product with the magnitude of the principal component (|D z |) accounts for the ray length. This operation is used when the spread of perspective samples is expected to be proportional to the Euclidean distance; otherwise, the numerator can be set to 1, as in the orthogonal case. This scenario will be explained in more detail below.
[0100] Figure 4 The primitive 304 in the ray coordinate system is shown. In particular, Figure 4 the primitive 304 is shown projected onto a pair of axes aligned with the basis vectors P and Q (i.e., the second and third basis vectors of the ray coordinate system). Thus, the Figure 4 primitive that is "going into the page" as observed from the ray's perspective (i.e., with the "eye" positioned at the origin of the ray and "looking" along the ray direction vector). In the Figure 4 example shown, the P-axis and Q-axis are perpendicular to (i.e., orthogonal to) the direction of the ray 302 and perpendicular to each other. The P-axis and Q-axis, together with the S-axis pointing into the page, define the "ray space" of the ray 302. The ray origin O from Figure 3 is shown located at the origin of the reference frame defined by the P-axis and Q-axis, and the reference frame is shown from the ray's perspective, i.e., the ray origin O and the intersection point 306 now coincide. The ray direction points into the page, e.g., where the components of the ray direction vector along the P-axis and Q-axis are zero. Thus, the ray is Figure 4 a point at the origin of the PQ plane of the ray coordinate system shown in Figure 4 , and in particular, the intersection location (intersection point 306) representing the intersection of the ray with the primitive 304 is located at the Figure 4 origin in Figure 4 . The orientation of the primitive 404 is indicated as counterclockwise in Figure 4 , which is determined by the winding order of its vertices. The winding order of a primitive is the order in which the vertices of this primitive are defined, ignoring any cyclic factors. In other words, only the "odd" permutations of the vertices are considered to represent different winding orders between one primitive and another. Thus, if the order of those vertices differs by an odd permutation (e.g., sorted from back to front) between a first primitive and a second primitive, the first primitive can be determined to be different from the second primitive even if the two primitives are defined by the same vertices. In Figure 4 , the ray coordinate system basis vectors P and Q are shown at right angles to each other, even if they may not be orthogonal in the spatial coordinate system, where this implicit "shearing" does not affect subsequent hit or intersection property calculations. Each vertex of the primitive 304 is defined by a set of coordinate values in the ray coordinate system, where each coordinate value is a measure of the vertex along the corresponding axis of the ray coordinate system. For the primitive 304, in the ray coordinate system, the first vertex a can have a first set of ray space coordinates (ap , a q , a s ), the second vertex b may have a second set of coordinates (b p , b q , b s ), and the third vertex c may have a third set of coordinates (c p , c q , c s ). In some examples, when performing an intersection test on a primitive, the vertex coordinates along the S axis for each ray space vertex (a s , b s , and c s ) may not be calculated. That is, by explicit projection along the S axis, it is possible to determine the intersection distance without calculating the third ray space coordinates of each vertex in the primitive.
[0101] The ray coordinate system can be a left-handed coordinate system or a right-handed coordinate system. In Figure 4 , the ray coordinate system (where the axes are sorted as PQS, SPQ, or QSP) is a left-handed coordinate system. In this coordinate system, the second axis (Q axis) points upward, and the first axis (P axis) points from left to right. In a right-handed system, one of the P axis or the Q axis is reversed, such that the Q axis points downward, or the P axis points from right to left (or alternatively these axes are reordered as QPS, SQP, or PSQ). The left-handed coordinate system can be described as a counterclockwise coordinate system because, as observed in Figure 4 , the rotation from the first basis vector to the second vector is in the counterclockwise direction. The right-handed system can be described as a clockwise coordinate system because, as observed in Figure 4 , the rotation from the first basis vector to the second vector will be in the clockwise direction. The handedness of the coordinate system may affect the perceived orientation of the primitive (given a fixed primitive winding). For example, as shown in Figure 4 , relative to the angle of the ray, the right-handed coordinate system can reverse the primitive orientation, and the left-handed coordinate system can maintain the primitive orientation. To indicate the handedness of the ray coordinate system, a winding flag can be provided to the user to set when a spatial coordinate system with a handedness opposite to the expected handedness is required. This winding flag indicates that any intersection orientation result should be reversed; one way to achieve this is to indicate that all primitive edges should be considered to point in the opposite direction.
[0102] In some examples, in step S202, the intersection test module 108 obtains the coordinate data of the vertices of the primitive in the ray coordinate system by projecting the coordinate data of the vertices of the primitive from the space coordinate system defining the primitive to the ray coordinate system using the ray data defining the ray. The projection into the ray coordinate system can be performed as described above. The ray data defining the ray includes the ray origin O and the ray direction vector D for the ray, as well as the diffusion value σ. In other examples, the intersection test module 108 does not perform the projection of the coordinate data of the vertices of the primitive from the space coordinate system to the ray coordinate system. In these other examples, the projection is performed by a different module in the ray tracing system, such as in a preprocessing step, and the result of the projection is provided to the intersection test module 108. Thus, in these other examples, in step S202, the intersection test module 108 obtains the coordinate data of the vertices of the primitive (a, b, and c) in the ray coordinate system by receiving the coordinate data of the vertices of the primitive 304 in the ray coordinate system.
[0103] In step S204, the ray tracing unit 102 (specifically, the intersection test module 108) determines the values of one or more intersection attributes for the primary sample of the ray 302 related to the intersection between the ray 302 and the primitive 304. As described above, the primary sample of the ray represents the line of the ray, i.e., is represented as O + Dt. In the PQ plane of the ray coordinate system, the primary sample of the ray is represented as a point at the origin. In Figure 3 and Figure 4 the example shown in, the primary sample of the ray 302 intersects the primitive 304 at the intersection point 306. The intersection attributes describe the characteristics of the intersection between the ray and the primitive. The values of the intersection attributes can be output from the intersection test module 108 and provided to the processing logic 110. The intersection attributes can (e.g., by a shader program executed on the processing logic 110) be used to determine how to handle the intersection between the ray and the primitive, e.g., for rendering an image of the scene. By way of example, each of the one or more intersection attributes can be a barycentric coordinate, an area coordinate, and / or an intersection distance. Techniques for determining the values of the intersection attributes for the primary sample of the ray 302 are known in the art.
[0104] Performing the intersection test on the primitive 304 in the ray space is advantageous because it reduces the test to a 2D problem. The primary sample of the ray is determined to intersect the primitive only if the primitive covers the origin of the P-axis and the Q-axis in the ray space. Area coordinates A0, A1, and A2 can be determined for the intersection between the primary sample of the ray 302 and the primitive 304, where the first area coordinate A0 = b p c q -b q c p , the second area coordinate A1 = cp a q -c q a p , and the third area coordinate A2 = a p b q -a q b p , where (a p , a q ) are the coordinates on the P-axis and Q-axis for vertex a of primitive 304, (b p , b q ) are the coordinates on the P-axis and Q-axis for vertex b of primitive 304, and (c p , c q ) are the coordinates on the P-axis and Q-axis for vertex c of primitive 304. Each area coordinate in the area coordinates is calculated as the "2D cross product" of two projected vertices that define the edge of primitive 304, and indicates on which side of the edge of primitive 304 the light ray passes (which is embedded in the order of the components in the definition of A i ). The area coordinates have signed values and can be positive, negative, or zero.
[0105] Once area coordinates have been determined for the intersection between the primary sample of ray 302 and primitive 304, the intersection test module 108 can determine whether the primary sample of ray 302 intersects primitive 304 based on the signs of the area coordinates. In an example, if all of the area coordinates (A0, A1, and A2) among the area coordinates determined for the intersection between ray 302 and primitive 304 have the same sign, it is determined that the primary sample of the ray intersects the primitive, while if all of the area coordinates (A0, A1, and A2) among the area coordinates determined for the intersection between ray 302 and primitive 304 do not have the same sign, it is determined that the primary sample of the ray does not intersect the primitive. That is, the intersection test for the primary sample of a ray relative to a primitive can include using the area coordinates determined for the intersection between the primary sample of the ray and the primitive to determine whether the primary sample of the ray passes through the "inside" of the edges of the (convex) primitive when the primitive is considered as a whole, where if it is determined that the primary sample of the ray passes through the inside of all of the edges of the primitive, it is determined that the primary sample of the ray intersects the primitive. Similarly, if it is determined that the primary sample of the ray passes through the "outside" of one or more of the edges of the primitive, it is determined that the primary sample of the ray does not intersect the primitive. It should be noted that it is not possible to determine which side (specifically, which side of the infinitely long line extending from the edge) the primary sample of the ray passes through until all of the edges have been examined, and it is not known which side corresponds to the "inside" and which side corresponds to the "outside". Thus, once all of the edges of the polygon have been examined, it is possible to determine whether the primary sample of the ray passes through the inside or outside of the edges. If no intersection occurs, i.e., there are some edges with one sign and some edges with the other sign, it is known that the primary sample of the ray passes through the "outside" of one or more of the edges, but it may not be known which subset of the edges those are. This is because when the orientation of the polygon is known, the signs can be matched to the meaning of "outside", but the orientation is generally not known for a miss.
[0106] Barycentric coordinates can be determined for the intersection between the primary sample of ray 302 and primitive 304. The barycentric coordinates indicate where the intersection point 306 lies on primitive 304. A complete set of barycentric coordinates typically includes three barycentric coordinates (u, v, w), and can be determined by normalization from the area coordinates as and where A Σ is the sum of the area coordinates and represents the total area of primitive 304 in the PQ plane of the ray coordinate system, i.e., A Σ= A0 + A1 + A2. It can be understood from the way of defining barycentric coordinates with respect to area coordinates that the sum of barycentric coordinates will always be 1 (i.e., barycentric coordinates are normalized). Thus, generally, only two of the barycentric coordinates (e.g., u and v) are explicitly determined, and the third barycentric coordinate (e.g., w) is not explicitly determined but can be inferred from the values of the other two barycentric coordinates, for example, inferred as w = 1 - u - v.
[0107] It can be based on Use the barycentric coordinates (u, v, w) to determine the (signed) intersection distance t, where as described above, D z is the main component of the ray direction vector in the space coordinate system, where a z , b z and c z are the z-components of the vertices a, b, and c in the space coordinate system, and O z is the z-component of the ray origin in the space coordinate system. It should also be noted that u + v + w = 1. The sign of the intersection distance t indicates whether the intersection occurs in front of or behind the ray origin relative to the direction of the ray.
[0108] In step S206, for one or both of the P-axis and Q-axis of the ray coordinate system, the ray tracing unit 102 (e.g., the intersection test module 108) determines data indicating the change of the intersection property in the direction parallel to this axis.
[0109] As described above, performing the intersection test by projecting vertex coordinates into the ray coordinate system for the ray and determining area coordinates as 2D cross-products can be considered computationally expensive. For this reason, it is beneficial to minimize the number of individual rays for which this intersection test process is performed (e.g., the number of sampled rays per pixel). Thus, to determine the differential data, it will be necessary to avoid projecting vertex coordinates into a slightly offset ray coordinate system for a slightly offset ray (i.e., a sub-ray) and avoid performing a separate 2D cross-product for each of those sub-rays (i.e., sub-samples) to determine whether those sub-samples of the ray intersect the primitive and where they intersect. As described in more detail below, in various examples, the manner of performing step S206 is different.
[0110] In step S208, the ray tracing unit 102 (e.g., the intersection test module 108 and / or the processing logic 110) processes the intersection between the ray and the primitive using the determined value of the intersection property for the primary sample of the ray and the determined data indicating the variation of the intersection property in one or both directions parallel to the P-axis and the Q-axis. For example, in step S208, the intersection test module 108 may provide the determined value of the intersection property for the primary sample of the ray and the determined data indicating the variation of the intersection property in one or both directions parallel to the P-axis and the Q-axis as input to the shader program, and the processing logic 110 may use the provided input to execute the shader program. In particular, step S208 may involve determining an output value (e.g., a pixel value) representing the intersection of the ray 302 and the primitive 304 for rendering an image of a scene including the primitive 304. The rendered pixel value may be output from the ray tracing system 100 and used in any suitable manner, such as being displayed on a display, stored in a memory, or transmitted over a network to another device.
[0111] Figure 5 An example is shown where the primary sample 502 of the ray 302 is positioned relative to the primitive 304 in the ray coordinate system and two sub-samples 504 and 506 of the ray 302 are positioned relative to the primitive. The primary sample of the ray 302 corresponds to Figure 3 and Figure 4 the intersection point 306 shown in. In the example shown in Figure 5 the divergence of the ray is processed as an orthogonal divergence. As described above, for the orthogonal divergence of a ray, the second basis vector P and the third basis vector Q of the ray coordinate system are defined as and where σ is the divergence value for the ray 302. In this case, the positioning offset of the sub-samples of the ray has a magnitude of 1 in the PQ plane. If the divergence value σ of the ray increases, the magnitudes of the P and Q basis vectors will decrease, such that when the positioning of the vertices of the primitive 304 is projected into the ray coordinate system, the magnitudes of the components of the projected vertex positioning will be smaller (i.e., the primitive will appear smaller in the PQ plane), such that an offset of magnitude 1 in the PQ plane corresponds to a larger step relative to the size of the primitive. In contrast, if the divergence value σ of the ray decreases, the magnitudes of the P and Q basis vectors will increase, such that when the positioning of the vertices of the primitive 304 is projected into the ray coordinate system, the magnitudes of the components of the projected vertex positioning will be larger (i.e., the primitive will appear larger in the PQ plane), such that an offset of magnitude 1 in the PQ plane corresponds to a smaller step relative to the size of the primitive.
[0112] In some examples (including Figure 5In the example shown in , the data indicating the change of the intersection property determined for each of one or both of the P-axis and the Q-axis in step S206 includes the change rate of each intersection property in the direction parallel to the axis. In particular, the change rate of each intersection property among one or more intersection properties defined by the planar primitive is determined. In these examples, step S206 is intended to determine the change rate of the intersection property, rather than necessarily determining the value of the intersection property at the location of the subsample of the ray. Since the primitive 304 is planar and since the subsample 504 is located at the position (1, 0) in the PQ plane, the difference (or "δ") between the value of the intersection property for the subsample 504 of the ray and the value of the intersection property for the primary sample 502 of the ray is equal to the change rate of the intersection property in the direction parallel to the P-axis. Similarly, the difference (or "δ") between the value of the intersection property for the subsample 506 of the ray and the value of the intersection property for the primary sample 502 of the ray is equal to the change rate of the intersection property in the direction parallel to the Q-axis.
[0113] For example, the intersection property may include two barycentric coordinates u and v. As described above, the first barycentric coordinate u of the primary sample 502 for the ray 302 is given by and the second barycentric coordinate v of the primary sample 502 for the ray 302 is given by . For a subsample of the ray that is offset (p, q) from the primary sample of the ray in the PQ plane of the ray coordinate system, the area coordinates A′0, A′1, and A′2 can be given by the 2D cross product described above for the primary sample, but shifted by the offset (p, q) in the PQ plane. Thus, for the first area coordinate A′0 of the subsample = (b p -p)(c q -q)-(b q -q)(c p -p), for the second area coordinate A′1 of the subsample = (c p -p)(a q -q)-(c q -q)(a p -p), and for the third area coordinate A′2 of the subsample = (a p -p)(b q -q)-(a q -q)(b q -p). Thus, the difference of the area coordinates (ΔA0, ΔA1, and ΔA2) between the subsample location (at (p, q) in the PQ plane) and the primary sample location (at (0, 0) in the PQ plane) is:
[0114] ΔA0 = A′0 - A0 = p(b q -cq ) + q(c q -b p )
[0115] ΔA1 = A′1 - A1 = p(c q -a q ) + q(a p -c p )
[0116] ΔA2 = A′2 - A2 = p(a q -b q ) + q(b p -a p )
[0117] Thus, the rates of change of the area coordinates in the directions parallel to the P-axis and Q-axis are:
[0118]
[0119] As described above, the centroid coordinates (u, v, w) of the primary sample for a ray are related to the area coordinates (A0, A1, A2). Similarly, the centroid coordinates (u′, v′, w′) of the sub-sample of the ray at the offset (p, q) are related to the area coordinates (A′0, A′1, A′2). Since A Σ and A′ Σ represent the area of the primitive 304 in the PQ plane of the ray coordinate system, and this area is the same when considering both the primary sample and the sub-sample of the ray, it can be understood that A Σ = A′ Σ . It should be noted that since A0 + A1 + A2 = A Σ = A′0 + A′1 + A′2 = A′ Σ , thus when the positioning changes, the sum of the changes (and rates of change) of the area coordinates is zero, i.e., ΔA0 + ΔA1 + ΔA2 = 0, and Therefore, step S206 may only determine the values of the rates of change for two of the area coordinates (e.g., A0 and A1) in the area coordinates in each dimension, where the value of the rate of change for the third area coordinate (e.g., A2) is not explicitly determined but can be inferred from the rates of change for the other two area coordinates (e.g., A0 and A1).
[0120] Therefore, the differences in the centroid coordinates (Δu, Δv, and Δw) between the sub-sample positioning (at (p, q) in the PQ plane) and the primary sample positioning (at (0, 0) in the PQ plane) are:
[0121]
[0122] Thus, the rates of change of the barycentric coordinates in the directions parallel to the P-axis and the Q-axis are:
[0123]
[0124] It should be noted that since u + v + w = 1, when the positioning changes, the sum of the changes (and rates of change) of the barycentric coordinates is zero, that is, Δu + Δv + Δw = 0. And Thus, step S206 may only determine the values of the rates of change for two of the barycentric coordinates (e.g., u and v) in the barycentric coordinates in each dimension, where the value of the rate of change for the third barycentric coordinate (e.g., w) is not explicitly determined, but can be inferred from the rates of change for the other two barycentric coordinates (e.g., u and v). In other words, as an example, step S206 may involve determining for and the values, but not determining for and the values. As can be seen from the equations given above, the values of the rates of change of the area coordinates and the barycentric coordinates in the directions parallel to the P-axis and the Q-axis are easy to determine. For example, for the area coordinates, these values only involve subtracting one primitive vertex component from another primitive vertex component in the ray coordinate system, and for the barycentric coordinates, these values only involve subtracting one primitive vertex component from another primitive vertex component in the ray coordinate system, and dividing by a value (A Σ ) that is constant for a particular ray-primitive pair. It should be noted that dividing by A Σ can be implemented as multiplying by Multiplication is generally easier to implement (e.g., in logic components with lower latency, power consumption, and / or silicon area), and the value of
[0125] In an example where step S206 involves determining a rate of change in one or both of the directions parallel to the P-axis and the Q-axis for each of one or more barycentric coordinates, step S208 may involve using the determined rate of change in one or both of the directions parallel to the P-axis and the Q-axis for each of one or more barycentric coordinates to determine a level of detail (LOD) for a primitive. The LOD for a primitive gives a sense of the scale of the primitive relative to screen space, which may be useful for a variety of reasons. For example, in step S208, the determined level of detail for a primitive may be used to select a mipmap level of a texture, and the texture may subsequently be applied to the primitive at the selected mipmap level. Additionally, the determined LOD for a primitive may be used to select a model LOD in a subsequent frame, or for generating a dynamic geometry LOD (e.g., for tessellation), or for calculating a curvature estimate for advanced lighting techniques. In some cases, the rate of change of the barycentric coordinates may be significantly different in the direction parallel to the P-axis compared to the direction parallel to the Q-axis. This difference may be used to select different LODs in different directions for a primitive, e.g., for applying anisotropic texturing / effects to the primitive.
[0126] As another example, the intersection property may include an intersection distance t. The intersection distance t for a primary sample of a ray may be determined as the difference between the intersection distance (Δt) between a subsample location (at (p,q) in the PQ plane) and the primary sample location (at (0,0) in the PQ plane) is
[0127] Thus, the rate of change of the intersection distance in the directions parallel to the P-axis and the Q-axis is given by:
[0128]
[0129] As described above, D z is the major component of the ray direction vector in the spatial coordinate system, i.e., D z is the component with the largest magnitude among the components of the ray direction vector for a ray in the spatial coordinate system that defines the primitive. a z is the coordinate of the first vertex of the primitive in the same dimension of the spatial coordinate system as D z b z is the coordinate of the second vertex of the primitive in the same dimension of the spatial coordinate system as D z c z is the coordinate of the third vertex of the primitive in the same dimension of the spatial coordinate system as D z It should be noted that as given above for and the division by D implicit in the equation z can be implemented as a multiplication by and the value of may have been generated as part of the original distance calculation for the primary sample.
[0130] and the values of are easily determined using the subtraction and multiplication operations described above, and subsequently it is easy to perform the addition and multiplication operations according to the equation given in the previous paragraph to determine and In particular, compared to tracking individual sub-rays passing through the scene, by implementing addition, subtraction, and multiplication according to the equations given above (e.g., in a fixed-function circuit), the values of the rates of change of the intersection distance in directions parallel to the P-axis and Q-axis are more easily determined in the ray coordinate system. The values of the rates of change of the intersection distance in directions parallel to the P-axis and Q-axis ( and ) can be used, for example, by the shader program executed by the processing logic 110 in step S208 to determine how to handle the intersection of the ray 302 with the primitive 304. For example, and the values of can be used to indicate the angle of the planar surface of the primitive 304 relative to the ray direction. In particular, values with a low magnitude and indicate that the normal of the surface of the primitive 304 is closely aligned with the ray direction (i.e., the primitive is viewed essentially head-on from the perspective of the ray); while values with a high magnitude and indicate that the normal of the surface of the primitive 304 is not closely aligned with the ray direction (i.e., the primitive is viewed at an oblique angle from the perspective of the ray).
[0131] It should be noted that operations such as addition, subtraction, and multiplication can be efficiently implemented in hardware (e.g., in a fixed-function circuit). In particular, compared to conventional ray-tracing techniques that may involve tracking individual sub-rays passing through the scene, the logic for determining the rates of change of the intersection properties in directions parallel to the P-axis and Q-axis can be implemented with reduced latency, reduced power consumption, and / or reduced silicon area.
[0132] As described above, in some examples, the data determined in step S206 includes the rate of change of the intersection property in directions parallel to the P-axis and the Q-axis. As another example, the data determined in step S206 can include values of the intersection property for subsamples of the ray that are offset from the primary sample of the ray in directions parallel to the P-axis and the Q-axis. In these other examples, for each of one or both of the P-axis and the Q-axis of the ray coordinate system, the data (determined in step S206) indicating the change of one or more intersection properties in a direction parallel to that axis includes the value of each intersection property of one or more intersection properties for subsamples of the ray that are related to the intersection between the ray and the primitive, where the subsamples of the ray are offset from the primary sample of the ray in a direction parallel to that axis. Figure 6 illustrates an example in which the positioning of the primary sample 602 of the ray 302 relative to the primitive 304 in the ray coordinate system and the positioning of four subsamples 604, 606, 608, and 610 of the ray 302 relative to the primitive are shown. The primary sample 602 of the ray corresponds to Figure 3 and Figure 4 the intersection point 306 shown therein. The subsample 604 is offset from the primary sample 602 by (+1,0) in the PQ plane of the ray coordinate system; the subsample 606 is offset from the primary sample 602 by (0,+1) in the PQ plane of the ray coordinate system; the subsample 608 is offset from the primary sample 602 by (-1,0) in the PQ plane of the ray coordinate system; and the subsample 610 is offset from the primary sample 602 by (0,-1) in the PQ plane of the ray coordinate system. Thus, the primary sample and the four subsamples are arranged in an axis-aligned cross pattern (rotated plum blossom shape) centered on the positioning of the primary sample.
[0133] Starting from the corresponding intersection properties determined for the primary samples of the rays, for example, by applying one or more logical operations (such as one or more addition operations, subtraction operations, and / or multiplication operations) to the values of the corresponding intersection properties determined for the primary samples of the rays, the value of each intersection property among the intersection properties of the sub-samples of the rays is determined. For example, starting from the corresponding intersection properties determined for the primary samples of the rays, by applying one or more increments or decrements to the values of the corresponding intersection properties determined for the primary samples of the rays, the value of each intersection property among the intersection properties of the sub-samples of the rays can be determined. In particular, the value of each intersection property among the intersection properties of the sub-samples of the rays is determined as an integer linear combination of difference values. This is simpler (and thus more efficient to implement in hardware, for example) than calculating the values of the intersection properties for the sub-samples by treating the sub-samples as separate rays traced through the scene. More specifically, the use of the integer linear combination provides an improvement to the method itself: the ray space axes are rescaled by the diffusion value σ, which only incurs a small number of additional operations (such as four) for each ray; instead of placing the samples at (±σ, 0) and (0, ±σ), which would require additional multiplications for each sample of each ray compared to the primitive intersection test that requires a large number of additional operations in total.
[0134] For example, the area coordinates (A′0, A′1, A′2) of the sub-samples of the rays can be determined by adding values to and subtracting values from the corresponding area coordinates (A0, A1, A2) of the primary samples of the rays according to the following equations:
[0135] A′0 = A0 + p′(b q -c q ) + q′(c p -b p )
[0136] A′1 = A1 + p′(c q -a q ) + q′(a p -c p )
[0137] A′2 = A2 + p′(a q -b q ) + q′(b p -a p )
[0138] where p′ and q′ represent the offsets of the sub-samples relative to the primary samples along the P-axis and Q-axis.
[0139] For sub-sample 604, p′ = 1 and q′ = 0, so for sub-sample 604, A′0 = A0 + b q -c q , A′1 = A1 + cq -a q and A′2 = A2 + a q -b q 。
[0140] For subsample 606, p′ = 0 and q′ = 1, so for subsample 606, A′0 = A0 + c p -b p , A′1 = A1 + a p -c p , and A′2 = A2 + b p -a p 。
[0141] For subsample 608, p′ = -1 and q′ = 0, so for subsample 608, A′0 = A0 - b q +c q , A′1 = A1 - c q +a q , and A′2 = A2 - a q +b q 。
[0142] For subsample 610, p′ = 0 and q′ = -1, so for subsample 610, A′0 = A0 - c p +b p , a′1 = A1 - a p +c p , and A′2 = A2 - b p +a p 。
[0143] Thus, it can be seen that the area coordinates for the four subsamples 604, 606, 608, and 610 can be determined from the corresponding area coordinates for the primary sample 602 by adding the value of a primitive vertex coordinate in the ray coordinate system and subtracting the value of another primitive vertex coordinate in the ray coordinate system. One addition operation and one subtraction operation are very easy to implement, for example, in hardware such as a fixed function circuit, so the latency, power consumption, and / or silicon area for determining the area coordinates for the subsamples are relatively small.
[0144] As another example, the centroid coordinates (u′, v′, w′) for a subsample of a ray can be determined from the corresponding centroid coordinates (u, v, w) for the primary sample of the ray according to the following formula:
[0145]
[0146] where p′ and q′ represent the offsets of the subsample relative to the primary sample along the P-axis and Q-axis.
[0147] For sub-sample 604, p′ = 1 and q′ = 0. Thus, for sub-sample 604, and
[0148] For sub-sample 606, p′ = 0 and q′ = 1. Thus, for sub-sample 606, and
[0149] For sub-sample 608, p′ = -1 and q′ = 0. Thus, for sub-sample 608, and
[0150] For sub-sample 610, p′ = 0 and q′ = -1. Thus, for sub-sample 610, and
[0151] Thus, it can be seen that the centroid coordinates for the four sub-samples 604, 606, 608, and 610 can be determined from the corresponding centroid coordinates for the primary sample 602 by adding terms determined by the following operations: (i) subtracting the value of one primitive vertex coordinate in the ray coordinate system from the value of another primitive vertex coordinate in the ray coordinate system, and (ii) multiplying the result of the subtraction by An addition operation, a subtraction operation, and a multiplication operation are easy to implement in hardware such as a fixed-function circuit, for example, so the latency, power consumption, and / or silicon area for determining the area coordinates for the sub-samples are small.
[0152] As another example, the intersection distance (t′) for a sub-sample of a ray can be determined starting from the intersection distance (t) for the primary sample of the ray according to the following formula:
[0153]
[0154] where p′ and q′ represent the offsets of the sub-sample relative to the primary sample along the P-axis and Q-axis.
[0155] For sub-sample 604, p′ = 1 and q′ = 0. Thus, for sub-sample 604,
[0156] For sub-sample 606, p′ = 0 and q′ = 1. Thus, for sub-sample 606,
[0157] For subsample 608, p′ = -1 and q′ = 0, thus for subsample 608,
[0158] For subsample 610, p′ = 0 and q′ = 1, thus for subsample 610,
[0159] Therefore, it can be seen that the intersection distances for the four subsamples 604, 606, 608, and 610 can be determined from the corresponding intersection distances for the primary sample 602 by performing addition, subtraction, and multiplication operations, which is significantly easier to implement than tracking each sub-ray in the sub-rays through the scene individually. It should also be noted that division can be implemented as multiplying by the reciprocal of the value. The value of has been calculated and divided by D z has been done as multiplication in the centroid calculation. It should also be noted that the values of Δu, Δv, and Δw have been generated as intermediate values in the above centroid calculation, so these values can be used as inputs for this distance calculation to reduce the additional amount of subtraction / multiplication performed in this distance calculation.
[0160] The step S208 of handling the intersection between ray 302 and primitive 304 may include determining whether a subsample of the ray hits the primitive using the intersection properties determined for each subsample in the subsamples of the ray. As described above, the determination of whether a sample of the ray (the primary sample or subsample of the ray) hits the primitive can be based on the signs of the area coordinates determined for the sample. In particular, if all the area coordinates in the area coordinates determined for the intersection between the sample of ray 302 and primitive 304 have the same sign, it is determined that the sample of the ray intersects the primitive, and if all the area coordinates in the area coordinates determined for the intersection between the sample of ray 302 and primitive 304 do not have the same sign, it is determined that the sample of the ray does not intersect the primitive.
[0161] Figure 7 An example is shown, in which the positioning of the primary sample 702 of ray 302 relative to primitive 304 in the ray coordinate system and the positioning of the eight subsamples 704, 706, 708, 710, 712, 714, 716, and 718 of ray 302 relative to the primitive are shown. The primary sample 702 of the ray and Figure 3 and Figure 4corresponds to the intersection point 306 shown in. The subsample 704 is offset from the primary sample 702 by (+1, 0) in the PQ plane of the ray coordinate system; the subsample 706 is offset from the primary sample 702 by (0, +1) in the PQ plane of the ray coordinate system; the subsample 708 is offset from the primary sample 702 by (-1, 0) in the PQ plane of the ray coordinate system; the subsample 710 is offset from the primary sample 702 by (0, -1) in the PQ plane of the ray coordinate system; the subsample 712 is offset from the primary sample 702 by (+1, +1) in the PQ plane of the ray coordinate system; the subsample 714 is offset from the primary sample 702 by (-1, +1) in the PQ plane of the ray coordinate system; the subsample 716 is offset from the primary sample 702 by (-1, -1) in the PQ plane of the ray coordinate system; and the subsample 718 is offset from the primary sample 702 by (+1, -1) in the PQ plane of the ray coordinate system. Thus, the primary sample and the eight subsamples are arranged in a 3x3 axis-aligned square pattern centered on the location of the primary sample.
[0162] In this case, the value of the intersection property for a sample can be determined, for example, in one or more sequences starting from the primary sample. Here, the "sample" refers to the primary sample and subsamples of the ray. The one or more sequences cause the value of the intersection property for a subsample to be determined based on (i.e., relative to) the already determined corresponding intersection property value for the sample. Additionally, the one or more sequences can cause the current subsample for which the intersection property value is being determined to be positioned horizontally adjacent or vertically adjacent in the 3×3 square sample pattern to the previous sample for which the intersection property value has been determined and based on which the intersection property value for the current subsample is determined. In this way, the same increments / decrements as described above with respect to Figure 6 the increments / decrements can be used to determine for Figure 7The intersection property of all subsamples in the subsamples shown. For example, one or more sequences of a sample for which the intersection property is determined may include a first sequence and a second sequence, where the first sequence reaches subsample 704 horizontally from the primary sample 702, reaches subsample 712 vertically, reaches subsample 706 horizontally, and then reaches subsample 714 horizontally; and where the second sequence reaches subsample 708 horizontally from the primary sample 702, reaches subsample 716 vertically, reaches subsample 710 horizontally, and then reaches subsample 718 horizontally. As another example, one or more sequences of a sample for which the intersection property is determined may include four sequences, where the first sequence reaches subsample 704 horizontally from the primary sample 702 and then reaches subsample 712 vertically; where the second sequence reaches subsample 706 vertically from the primary sample 702 and then reaches subsample 714 horizontally; where the third sequence reaches subsample 708 horizontally from the primary sample 702 and then reaches subsample 716 vertically; and where the fourth sequence reaches subsample 710 vertically from the primary sample 702 and reaches subsample 718 horizontally. As another example, one or more sequences of a sample for which the intersection property is determined may include a single sequence, for example where the single sequence reaches subsample 704 horizontally from the primary sample 702, reaches subsample 712 vertically, reaches subsample 706 horizontally, reaches subsample 714 horizontally, reaches subsample 708 vertically, reaches subsample 716 vertically, reaches subsample 710 horizontally, and then reaches subsample 718 horizontally. Many other sequences may be implemented in different examples. In the case of multiple sequences, the processing for different sequences may be performed in parallel or serially with respect to each other. Figure 7 An example pattern of the subsamples in a 3×3 axis-aligned grid is shown, and other patterns with different numbers of samples may be used, such as a 5×5 axis-aligned grid.
[0163] The value of the intersection property a' at the subsample location can be calculated as The subsample location is offset by a displacement (p,q) in the PQ plane of the ray coordinate system from the location of the sample for which the intersection property a has previously been determined. In the examples given in the previous paragraph, the processing to calculate the value of the intersection property at the subsample location is performed by stepping away from the primary sample location, where each step is strictly horizontal or strictly vertical in the ray coordinate space, such that the calculation of the intersection property (such as area coordinates, centroid coordinates, and / or intersection distance) at different subsample locations can be performed in a simple manner based on the previously determined intersection property for horizontally or vertically adjacent samples, as described above with respect to Figure 6 As described. For a strictly horizontal step, the q coordinate of the offset of the subsample relative to the previous subsample is zero, such that In addition, for a strict horizontal step of magnitude 1 in the PQ plane (i.e., the p coordinate of the offset of the subsample relative to the previous subsample is one), the value of the intersection property a' at the subsample location is given by Similarly, for a strict vertical step, the p coordinate of the offset of the subsample relative to the previous subsample is zero, such that In addition, for a strict vertical step of magnitude 1 in the PQ plane (i.e., the q coordinate of the offset of the subsample relative to the previous subsample is one), the value of the intersection property a' at the subsample location is given by In other examples, rather than stepping strictly horizontally or vertically in the PQ plane of the ray coordinate system, one can step (or offset) to any arbitrary location (p,q), where the value of the intersection property a' at the subsample location is given by It should be noted that and are constant for a primitive (since the primitive is a planar polygon), so these values only need to be calculated once for each primitive (e.g., where a represents any intersection property such as area coordinates, centroid coordinates, or intersection distance). Once and are determined for a primitive, stepping to an arbitrary location (p,q) will involve performing two multiplications and two additions for each intersection property for each subsample; while stepping strictly horizontally or vertically with a step size of 1 in the PQ plane will involve performing one addition for each intersection property for each subsample. However, this alternative method provides a greater degree of parallelism, which will provide a reduction in latency at the cost of additional area / power (due to performing more operations simultaneously and a generally larger number of operations).
[0164] Figure 8 is a flowchart showing an example of steps that can be performed as part of step S208. Performing step S208 as shown in Figure 8 allows for the determination of a fractional coverage indication for the intersection between ray 302 and primitive 304. As explained above, a ray can be considered to have a finite width, where the fractional coverage indication can be used to indicate the proportion of the ray that intersects the primitive. The fractional coverage indication can have a value between 0 and 1, where a coverage indication of zero can indicate that the ray completely misses the primitive, and a coverage indication of one can indicate that the entire ray hits the primitive. Being able to determine fractional coverage can be useful for processes such as anti-aliasing.
[0165] In step S802, the ray tracing unit 102 (e.g., the intersection test module 108) determines a plurality of subsamples for the ray that are at different offsets from the primary sample of the ray (e.g., four subsamples for the ray in the example shown in Figure 6 and in Figure 7the value of the intersection property for the eight subsamples of the ray as shown in
[0166] In step S804, the ray tracing unit 102 (e.g., the intersection test module 108 or the processing logic 110) determines whether the sample of the ray hits a primitive based on the determined value of one or more intersection properties for each sample of the samples of the ray. The determination of whether the sample of the ray hits a primitive can be based on a comparison of the intersection distance t with a minimum valid distance and a maximum valid distance for the ray (t min and t max ), and this comparison can be performed independently of the intersection test module 108 and only if a barycentric / winding-based hit has been established first. A "sample" of a ray includes a primary sample of the ray and a subsample of the ray. For example, as described above, the area coordinates or barycentric coordinates of a sample of a ray can be used to determine whether the sample of the ray hits a primitive. For example, if all three area coordinates (A0, A1, and A2) in the area coordinates of the sample of the ray have the same sign, or if all three barycentric coordinates (u, v, and w) in the barycentric coordinates of the sample of the ray have the same sign, this indicates that the sample of the ray hits a primitive (if the intersection distance is between t min and t max ). Since A0 + A1 + A2 = A Σ and u + v + w = 1, the determination of whether the sample of the ray hits a primitive can use only two of the area coordinates (e.g., A0 and A1) and the value of A Σ , or only two of the barycentric coordinates (e.g., u and v), for example, by determining whether all three of A0, A1, and (A Σ - A0 - A1) have the same sign, or by determining whether all three of u, v, and (1 - u - v) have the same positive sign (equivalently, greater than zero, where a result of exactly zero may or may not result in an intersection, depending on the outcome of any tie-breaking rules used for watertightness). Given some other examples, the determination of whether the sample of the ray hits a primitive can be made by determining whether the following hold: (i) A0 + A1 < A Σ and A Σ > 0, (ii) A0 + A1 > A Σ and A Σ<0, or (iii) u + v < 1. For each sample of the ray, during the intersection test, the identifier (e.g., index) of the closest intersecting primitive is stored (or some null value if the sample misses all geometries in the scene's geometry), as well as the distance value associated with this intersection. If a sample of the ray is found to intersect multiple primitives, the intersection with the smallest intersection distance (i.e., the "closest") can be selected as the hit for the sample of the ray (by comparing the current intersection distance with the previously stored intersection distance). For two intersections with equal distances, some other tie-breaking logic can be used to select between the intersections. It should be noted that different samples of the ray can intersect different geometries in the scene (i.e., different primitives). Since it may be necessary to store intersection data for each sample of the ray, each ray may require a large storage capacity.
[0167] Given two examples, the determination of the intersection distance t for subsamples of a ray can be achieved using a relatively expensive but relatively accurate technique or a relatively cheap but relatively inaccurate technique. The relatively expensive but relatively accurate technique uses the distance δ values outlined above to fully calculate the t value for each subsample associated with the ray. This involves many additional additions and multiplications, not just calculating area coordinates or barycentric coordinates. In contrast, the relatively cheap but relatively inaccurate technique only calculates the t value for the primary sample of the ray and shares this t value with all subsamples in the ray's subsamples (but each subsample still uses its own correct area coordinates or barycentric coordinates). This reduces the number of additional additions and multiplications, but this only provides an approximate solution. In particular, the relatively cheap but relatively inaccurate technique will tend to work well for primitives close to the camera-facing primitives and with a reasonable spacing between geometry layers, but this technique may not work as well for primitives at an angle to the camera or for geometry layers that are close together (e.g., decals). Any error introduced into the determination of the intersection distance for the subsamples of the ray is limited to the subsamples, not the primary sample, making any resulting artifacts less noticeable.
[0168] In step S806, the ray tracing unit 102 (e.g., the processing logic 110) uses the determination of whether each sample in the samples of the ray 302 hits the primitive 304 to determine an output value representing the intersection of the ray 302 with the scene geometry, where the intersection of the ray 302 with the scene geometry includes the intersection between the ray 302 and the primitive 304.
[0169] The determination of the output value representing the intersection of ray 302 with the scene geometry in step S806 may include performing a weighted sum of the contributions of the samples of the ray with the intersection of one or more primitives to the output value. For each sample of the ray, a color value representing the intersection of the sample of the ray with the primitive intersected by the sample (as indicated by the corresponding identifier of the closest intersected primitive determined for the sample of the ray in step S804) may be determined. If the sample of the ray does not hit all of the geometries in the scene geometry (as indicated by the null value stored for the sample of the ray in step S804), a default or 'background' color value may be determined for the sample of the ray. Subsequently, the color values determined for the samples of the ray may be blended together in the weighted sum using a predetermined weight associated with the location of the sample. The weights may be uniform (i.e., the same for all samples in the samples of the ray), or the weights may be different for different samples of the ray. For example, the weight for the color value determined for a sample in the weighted sum may depend on the location of the sample relative to the primary sample of the ray, e.g., a sample closer to the primary sample of the ray has a greater weight. The result of the weighted sum may be the final color value representing the intersection of the ray with the scene geometry (e.g., the anti-aliased color value).
[0170] The determination of the color value may be performed by running a shader program (e.g., the closest hit shader). There are options for the shader to implement supersampling anti-aliasing (SSAA) or multisampling anti-aliasing (MSAA), i.e., (i) a shader may be executed for each sub-sample, or (ii) a shader may be executed for each intersected primitive. In case (i), i.e., for SSAA, the barycentric coordinates corresponding to each sub-sample are used as input to its corresponding called shader. In case (ii), i.e., for MSAA, the barycentric coordinates corresponding to each sub-sample are used to determine the intersection, but only the barycentric coordinates corresponding to the primary sample of the ray are used as input and as input to a shader that is called only once for each intersected primitive (intersected by one or more samples). The δ value is only used to calculate the fractional weight for the coverage.
[0171] As an example, step S806 may include: for each sample of the ray 302 determined to hit the primitive 304, determining the contribution of the primitive 304 to the output value. It should be noted that any sample of the ray 302 that does not hit the primitive 304 does not provide a contribution from the primitive 304 (but these samples may provide contributions from different primitives that the sample of the ray is determined to hit). As described above, the determined contributions for the samples of the ray are used to determine the output value representing the intersection of the ray with the scene geometry. As described above, for each sample of the ray, the contribution may be weighted based on the location of the sample relative to the primary sample.
[0172] In Figure 6 the example shown, three of the five samples of ray 302 intersect the primitive 304 (i.e., hit), and two of the five samples of ray 302 do not intersect the primitive 304 (i.e., these two samples miss). In particular, the primary sample 602, the sub-sample 604, and the sub-sample 606 hit the primitive 304, while the sub-samples 608 and 610 miss the primitive. In this example, the weights used to combine the color values from different samples can be uniform for different samples. For example, since there are five samples, each weight can be 0.2. As another example, the weights used to combine the color values from different samples depend on the positioning of the samples and can be represented by a kernel such as . In this example, the color value determined according to the primary sample is weighted by , and the color value determined according to each of the sub-samples in the sub-samples is weighted by . It should be noted that this example kernel is normalized (i.e., the sum of the components of the kernel is 1), and this example kernel is horizontally symmetric and vertically symmetric.
[0173] In Figure 7 the example shown, three of the nine samples of ray 302 intersect the primitive 304 (i.e., hit), and six of the nine samples of ray 302 do not intersect the primitive 304 (i.e., these six samples miss). In particular, the primary sample 702, the sub-sample 704, and the sub-sample 706 hit the primitive 304, while the sub-samples 708, 710, 712, 714, 716, and 718 miss the primitive 304. In this example, the weights used to combine the color values from different samples can be uniform for different samples. For example, since there are nine samples, each weight can be . As another example, the weights used to combine the color values from different samples depend on the positioning of the samples and can be represented by a (normalized) kernel such as . In this example, the color value determined according to the primary sample is weighted by , the color values determined according to the sub-samples 704, 706, 708, and 710 that are horizontally or vertically adjacent to the primary sample in the PQ plane are weighted by , and the color values determined according to the sub-samples 712, 714, 716, and 718 that are diagonally adjacent to the primary sample in the PQ plane are weighted by Weighting. Note that this example kernel is normalized (i.e., the sum of the components of the kernel is 1), and this example kernel is horizontally symmetric and vertically symmetric. This example kernel is also a separable kernel, i.e., the kernel is the matrix product of a column vector and a row vector given by [1 / 4, 1 / 2, 1 / 4]. In addition, the values of the weights shown in this example kernel are very easy to implement, for example, in binary logic, because all the weights in the weights represent division by a power of two. Division by a power of two can be achieved by shifting the bits to the right in fixed-point format. Bit shifting is very easy to implement in hardware (e.g., in fixed-function circuits). For example, dividing by 2 n can be achieved by shifting the bits of the input value n positions to the right. For floating-point format, division by a power of two can be achieved by decrementing the exponent by n times (i.e., subtracting n).
[0174] The technique for implementing fractional coverage for ray intersections is most useful for non-occluding rays rather than occluding rays. For occluding rays, the sole purpose of the intersection test often is to determine whether a hit occurs. However, for occluding rays, the hit-to-miss ratio for samples of the ray may be useful, for example, for implementing a penumbra effect for shadow rays.
[0175] As described above, the spread value for ray 302 is used to determine the offset of the sub-samples of the ray from the primary sample of the ray. In particular, the spread value is used to project primitive 304 into the ray coordinate system. As described above, the second basis vector P and the third basis vector Q of the ray coordinate system are defined as P = B(D z , 0, -D x ) and Q = C(0, D z , -D y ), where B and C are non-zero scalar values.
[0176] The spread value can represent the orthogonal spread of the ray. In this example, the scalar values B and C can be defined as and In other words, in the example of implementing orthogonal spread, the basis vectors P and Q are defined as and The four not necessarily zero components of P and Q can be calculated once for each ray (e.g., offline or at the point where these components are generated in the shader) and stored as data for each ray. Subsequently, these stored values can be reused for each ray's primitive test against the ray instead of being regenerated on the fly at increasing cost. As Figure 5 , Figure 6 and Figure 7As shown, in an example of implementing orthographic diffusion, the offset of the subsample positioning relative to the primary sample positioning is in steps of magnitude 1 in the PQ plane of the ray coordinate system. In these examples, the positioning of the subsamples of the ray is at coordinates (p, q) in the PQ plane of the ray coordinate system, where p and q are -1, 0, or +1 in the ray coordinate system. Figure 9 FIG. 904 and a ray having orthographic diffusion in the spatial coordinate system defining FIG. 904 are shown. In Figure 9 FIG. 904, the primary sample of the ray is denoted as 902, and the two subsamples of the ray are denoted as 906 and 908. It can be seen that the primary sample 902 and the two subsamples 906 and 908 are parallel, thus representing orthographic diffusion. The primary sample 902 of the ray intersects FIG. 904 at point 910; the subsample of ray 906 intersects FIG. 904 at point 912; and the subsample of ray 908 intersects FIG. 904 at point 914. In this example, the primary sample and the subsamples of the ray are parallel, and FIG. 904 is planar, so the offset of the subsamples of the ray from the primary sample has the same magnitude in each direction. The magnitude of this offset is determined by the σ parameter, i.e., a unit step in ray space (i.e., of magnitude 1) corresponds to a step of magnitude σ in its original spatial coordinate system.
[0177] The diffusion value can represent the pseudo-perspective diffusion of the ray. In this example, the scalar values B and C can be defined as and In other words, in an example of implementing pseudo-perspective diffusion, the basis vectors P and Q are defined as and As mentioned above, the four non-necessarily zero components of P and Q can be calculated once for each ray (e.g., offline or at the point of generation of these components in the shader) and stored as data for each ray. Subsequently, these stored values can be reused for each ray's primitive test against the ray, rather than being regenerated on the fly at increasing cost each time. It should be noted that |D z | in the numerator of B and C normalizes the step with Z (given as the minimum absolute distance along the long axis Z from the ray origin to the polygon primitive). In other words, the diffusion value σ is related to the number of ray lengths traveled, rather than to the Euclidean distance. That is, when the ray has traveled a distance equal to its own length, the subsamples will spread by an amount σ along each short axis.
[0178] In an example of implementing pseudo-perspective diffusion, the offset of the subsample positioning relative to the primary sample positioning is in steps of magnitude z in the PQ plane of the ray coordinate system (rather than in steps of magnitude as in Figure 5 , Figure 6 and Figure 7(step of magnitude 1 as shown). For example, the positioning of the subsamples of the ray can be at coordinates (p, q) in the PQ plane of the ray coordinate system, where p and q are -z, 0, or +z in the ray coordinate system. Figure 10 shows the primitive 1004 and a ray with a pseudo-perspective spread in the spatial coordinate system defining the primitive 1004. In Figure 10 , the primary sample of the ray is represented as 1002, and the two subsamples of the ray are represented as 1006 and 1008. It can be seen that the primary sample 1002 and the two subsamples 1006 and 1008 originate from point 1016 and spread from this point, thus representing a perspective spread. Point 1016 can be the origin of the ray. Figure 10 indicates the major axis of the spatial coordinate system (i.e., the axis along which the direction vector of the ray has a component with the largest magnitude), which is the Z-axis in this example. Figure 10 shows the value z, which indicates the distance along the major axis (i.e., the Z-axis in this example) from the ray origin 1016 to the primitive 1004. Figure 10 The dashed line 1018 in indicates the minimum value of the z-component of the vertex of the primitive 1004 (relative to the ray origin). The value of z can be taken as the (non-negative) difference between the z value at the dashed line 1018 and the z value of the ray origin. The value of z can be clamped to zero so that the value is not negative, thus ensuring that the ray space samples are not inverted (corresponding to an intersection "behind the camera"). For this purpose, when using pseudo-perspective spread, it is recommended that t min value be 0 or greater. To express this situation mathematically, z = max{min{sgn(D z )a z , sgn(D z )b z , sgn(D z )c z}} - sgn(D z )O z , 0} = max{min{sgn(D z )(a z - O z ) sgn(D z )(b z - O z ), sgn(D z )(c z - O z)},0}, where the sign of the main component of the light manipulates the negative coordinate. Outside the dashed line 1018 (from the perspective of the light origin 1016), the subsamples 1006 and 1008 are considered primary samples 1002 parallel to the light. The primary sample 1002 of the light intersects the primitive 1004 at point 1010; the subsample 1006 of the light intersects the primitive 1004 at point 1012; and the subsample 1008 of the light intersects the primitive 1004 at point 1014.
[0179] The z - value is used to separate the subsample points in a pseudo - perspective manner. This is pseudo - perspective (not true perspective) because this is only correct for triangles in front of the light. For triangles at a grazing angle to the light, the subsample points will be skewed in some way (e.g., the distance on one side of the light - space origin is greater than the distance on the other side), but the skewed subsample positioning will produce the correct result (even if the skewed subsample positioning is not precisely at the location where it would be for true - perspective spreading).
[0180] The definition of z given above is just an example. In an alternative example, the value of z can be the actual intersection distance of the primary sample of the light with the primitive (or the actual intersection distance with the plane of the primitive if the primary sample of the light misses the primitive). However, since this intersection distance may be a late output calculated in the primitive intersection - test algorithm, using the value of this intersection distance to determine all subsample data may significantly increase the latency of the algorithm (i.e., the length of the critical path). In contrast, before the start of the intersection - test process, the z - components of the vertices of the primitive are known, so setting z as the minimum of the z - components of the vertices of the primitive 1004 relative to the light origin as described above will not (significantly) increase the latency of the algorithm.
[0181] In an example implementing pseudo - perspective spreading, the δ - values of the intersection properties (e.g., ΔA0, ΔA1, ΔA2, Δu, Δv, Δw, Δt) can be calculated as described above for orthogonal spreading, but then these values are multiplied by z. For a given pair of light and primitive, the z - value acts as a constant scaling factor for subsample positioning, so when calculating the δ - values (i.e., the total difference from the origin to the subsample positioning in the PQ plane), these values are rescaled by the factor z. It is important to note that this does not mean that the absolute values of the intersection properties at the subsample positioning are ultimately multiplied by z, as these values are calculated by accumulating the rescaled δ - values on top of the original intersection - property values at the primary sample of the light.
[0182] Note that uniform scaling of the rays can involve modifying (i.e., rescaling) the ray space basis vectors to maintain consistent spread, i.e., consistent separation (in the orthogonal case) or consistent angles (in the perspective case). It should also be noted that rescaling the ray basis vectors once per ray and obtaining integer coordinates for subsample positioning in the PQ plane is cheaper than rescaling for each subsample positioning where each primitive intersects each ray.
[0183] In both the orthogonal spread example and the pseudo-perspective spread example, the spread value σ can be set such that the offset of the subsamples of a ray from the primary sample of the ray is less than the offset between the primary samples of different rays corresponding to adjacent pixels of the frame to be rendered. In other words, the offset of the subsamples from the primary sample of the ray can be a sub-pixel offset, i.e., an offset smaller than the offset between the primary rays of adjacent pixels. For example, σ can be given as half or a third of the minimum offset between two primary rays.
[0184] In the above example, there is a single (strictly positive) spread value σ, and the spread is isotropic, i.e., the same in both the direction parallel to the P axis and the direction parallel to the Q axis. However, other examples can implement anisotropic spread for the rays, where two (strictly positive) spread values σ p and σ q . The σ p value can represent the spread of the ray in the direction parallel to the P axis, and the σ q value can represent the spread of the ray in the direction parallel to the Q axis. This allows for implementing anisotropic spread of the rays, but will require exposing the directions of the P axis and the Q axis, i.e., the user will need to know the relationship between the P axis and the Q axis and the X, Y, and Z axes of the spatial coordinate system to calculate the values for this pair of spread values. The spread values σ q and σ q will be used to define the basis vectors of the ray coordinate system in place of the single spread value described above. For example, in the orthogonal spread example, the scalar values B and C can be defined as and i.e., the basis vectors P and Q are defined as and In the pseudo-perspective spread example, the scalar values B and C can be defined as and i.e., the basis vectors P and Q are defined as and These methods can then proceed as described above. A diffusion value can be received as part of the ray data defining the ray. The diffusion value can be predefined or can be provided by the user. It should be noted that the diffusion value of a secondary ray can be derived from the diffusion value of the primary ray. Some examples are given: the diffusion value may be exactly the same as before (since the ray is reflected / refracted by the surface but otherwise unmodified); for the convex / concave neighborhood of the surface intersected by the ray, the diffusion value can be increased / decreased; when the ray passes into the interior of the surface of a different medium, the diffusion value may change; or the diffusion value may increase due to bouncing off a rough (i.e., diffuse) surface. Additionally, the diffusion value of a secondary ray can be defined based on the diffusion value of the primary ray from which it is generated, but modified due to surface curvature or material properties, etc.
[0185] In the main example described above, two non - parallel axes (P - axis and Q - axis) of the ray coordinate system are orthogonal to the ray direction vector, and the vertices of the primitive are projected onto these two non - parallel axes. As described above, the basis vectors P and Q are defined as P = B(D z , 0, -D x ) and Q = C(0, D z , -D y ). The projection of the vertices of the primitive onto these axes is an orthogonal projection. The vertex v of the primitive (after an initial translation through the ray origin) has relative coordinates (v x , v y , v z ) in the space coordinate system, and this vertex is projected onto the location w, where the coordinates (w p , w q ) lie on the two non - parallel axes of the ray coordinate system. The projection is parallel to the ray direction, and in the main example described above, P and Q are orthogonal to the ray direction D. This projection can be explicitly given by calculating w p = P.v = B(D z v x - D x v z ) and w q = Q.v = C(D z v y - D y v z ).
[0186] However, in other examples, the two non - parallel axes of the ray coordinate system are not orthogonal to the ray direction vector, and the vertices of the primitive are projected onto these two non - parallel axes. The projection of the vertices of the primitive onto these axes is an oblique projection. This projection is parallel to the ray direction (similar to the orthogonal projection described in the previous paragraph). For example, the two non - parallel axes can be the X - axis and the Y - axis, and it should be noted that the X - axis and the Y - axis are generally not orthogonal to D (but by the definition of the long axis Z, D does not lie in the XY - plane). The projection of the vertex v=(v x ,v y ,v z ) can be explicitly given by finding the point w=(w x ,w y ) onto which this vertex projects back onto the XY - plane. In other words, we need to find the position of v - tD along the line z = 0. This is exactly the position of v z =tD z , that is, the position of (where it should be noted that D z cannot be zero). This value of t can be used to find the projection coordinates in the XY - plane when and . It can be seen that these equations for w x and w y are the same as the equations given in the previous paragraph for w p and w q , where Thus, the results of the calculations in the two examples given in this paragraph and the previous paragraph are the same, but the descriptions of the 2D basis vectors are different (and for the example given in this paragraph, these 2D basis vectors are not necessarily orthogonal to the ray), and we use different projections. In both examples, even if the plane being projected changes, the direction of the projection remains the same (so the direction "seen" by the ray is accurate). The remaining methods described above related to the example of orthogonal projection onto the PQ - plane can be applied in the same way to an example involving, for example, oblique projection onto the XY - plane.
[0187] Figure 11A computer system in which the ray tracing unit described herein can be implemented is shown. The computer system includes a CPU 1102, a GPU 1104, a memory 1106, a neural network accelerator (NNA) 1108, and other devices 1114, such as a display 1116, a speaker 1118, and a camera 1122. A processing block 1110 (corresponding to the ray tracing unit 102) is implemented on the GPU 1104. In other examples, one or more of the depicted components may be omitted from the system, and / or the processing block 1110 may be implemented on the CPU 1102 or within the NNA 1108. The components of the computer system may communicate with each other via a communication bus 1120. A storage device 1112 (corresponding to the memory 104) is implemented as part of the memory 1106.
[0188] Figure 1 The ray tracing unit 102 is shown as including several functional blocks. This is merely illustrative and is not intended to define a strict division between different logical elements of such entities. 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 ray tracing unit need not be physically generated by the ray tracing unit at any point in time and may only represent logical values that facilitate the description of the processing performed by the ray tracing unit between its input and output.
[0189] The ray tracing unit described herein may be embodied as hardware on an integrated circuit. The ray tracing unit described herein may be configured to perform any of the methods described herein. In general, any of the functions, methods, techniques, or components described above may be implemented in software, firmware, hardware (e.g., fixed logic circuitry), or any combination thereof. The terms "module", "function", "component", "element", "unit", "block", and "logic" may be used herein generically to represent software, firmware, hardware, or any combination thereof. In the case of a software implementation, a module, function, component, element, unit, block, or logic represents program code that, when executed on a processor, performs the specified task. The algorithms and methods described herein may be executed by one or more processors executing code that causes the processor to perform the algorithm / method. Examples of computer-readable storage media include random access memory (RAM), read-only memory (ROM), optical disks, flash memory, hard disk memory, and other memory devices that can use magnetic, optical, and other technologies to store instructions or other data and that are accessible by a machine.
[0190] 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 defining an integrated circuit (e.g., a hardware description language or a netlist), and code expressed in a programming language such as C, Java, or OpenCL. The executable code can be, for example, any kind of software, firmware, script, module, or library that, when properly executed, processed, interpreted, compiled, or 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.
[0191] A processor, computer, or computer system can be any kind of device, machine, or dedicated circuit, or a collection or part thereof, having processing capabilities such that it can execute instructions. The processor can be or include any kind of general-purpose 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 can include one or more processors.
[0192] The present invention also intends to cover software that defines the configuration of hardware as described herein, such as hardware description language (HDL) software, for designing an integrated circuit or for configuring a programmable chip to perform the desired functions. That is, a computer-readable storage medium encoded with computer-readable program code in the form of an integrated circuit definition data set can be provided, which, when processed (i.e., run) in an integrated circuit manufacturing system, configures the system to manufacture a ray-tracing unit configured to perform any of the methods described herein, or to manufacture a ray-tracing unit including any of the devices described herein. The integrated circuit definition data set can be, for example, an integrated circuit description.
[0193] Therefore, a method of manufacturing a ray-tracing unit as described herein at an integrated circuit manufacturing system can be provided. In addition, an integrated circuit definition data set can be provided, which, when processed in an integrated circuit manufacturing system, causes the method of manufacturing a ray-tracing unit to be executed.
[0194] An integrated circuit definition dataset can be in the form of computer code, such as a netlist, code for configuring a programmable chip, a hardware description language 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). A higher-level representation (such as RTL) that logically defines hardware suitable for fabrication in an integrated circuit can be processed at a computer system configured to generate a fabrication 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 fabrication definition of the integrated circuit so defined by the representation. As is typically the case where software is executed at a computer system to define a machine, one or more intermediate user steps (such as providing commands, variables, etc.) may be required to configure the computer system to generate a fabrication definition of the integrated circuit, to execute code that defines the integrated circuit to generate a fabrication definition of the integrated circuit.
[0195] An example will now be described for Figure 12 processing an integrated circuit definition dataset at an integrated circuit fabrication system to configure the system to fabricate a ray tracing unit.
[0196] Figure 12 An example of an integrated circuit (IC) fabrication system 1202 is shown, the integrated circuit fabrication system being configured to fabricate a ray tracing unit as described in any of the examples herein. In particular, the IC fabrication system 1202 includes a layout processing system 1204 and an integrated circuit generation system 1206. The IC fabrication system 1202 is configured to receive an IC definition dataset (such as defining a ray tracing unit as described in any of the examples herein), process the IC definition dataset, and produce an IC according to the IC definition dataset (such as which embodies a ray tracing unit as described in any of the examples herein). Processing of the IC definition dataset configures the IC fabrication system 1202 to fabricate an integrated circuit embodying a ray tracing unit as described in any of the examples herein.
[0197] The layout processing system 1204 is configured to receive and process an IC definition data set to determine a circuit layout. Methods for determining a circuit layout from an IC definition data set are known in the art and may involve, for example, synthesizing RTL code to determine a gate-level representation of the circuit to be generated, for example, in terms of logic components (such as NAND, NOR, AND, OR, MUX, and FLIP-FLOP components). By determining the location information of the logic components, the circuit layout can be determined from the gate-level representation of the circuit. This can be done automatically or with user participation to optimize the circuit layout. When the layout processing system 1204 has determined the circuit layout, the layout processing system may output a circuit layout definition to the IC generation system 1206. The circuit layout definition may be, for example, a circuit layout description.
[0198] As is known in the art, the IC generation system 1206 generates an IC according to the circuit layout definition. For example, the IC generation system 1206 may implement a semiconductor device manufacturing process for generating an IC, which may involve a multi-step sequence of lithography and chemical processing steps during which an electronic circuit is gradually formed on a wafer made of semiconductor material. The circuit layout definition may be in the form of a mask, which may be used in a lithography process for generating an IC according to the circuit definition. Alternatively, the circuit layout definition provided to the IC generation system 1206 may be in the form of computer-readable code, and the IC generation system 1206 may use the computer-readable code to form a suitable mask for generating the IC.
[0199] The different processes performed by the IC manufacturing system 1202 may all be implemented in one location, for example, by one party. Alternatively, the IC manufacturing system 1202 may be a distributed system such that some processes may be performed at different locations and may be performed by different parties. For example, some of the following stages may be performed at different locations and / or by different parties: (i) synthesizing RTL code representing the IC definition data set to form a gate-level representation of the circuit to be generated; (ii) generating a circuit layout based on the gate-level representation; (iii) forming a mask according to the circuit layout; and (iv) manufacturing an integrated circuit using the mask.
[0200] In other examples, the processing of an integrated circuit definition data set at an integrated circuit manufacturing system may configure the system to manufacture a ray tracing unit without processing the IC definition data set to determine a circuit layout. For example, the integrated circuit definition data set may define the configuration of a reconfigurable processor, such as an FPGA, and the processing of the data set may configure the IC manufacturing system to generate (e.g., by loading configuration data into the FPGA) a reconfigurable processor with the defined configuration.
[0201] In some embodiments, when processed in an integrated circuit manufacturing system, an integrated circuit manufacturing definition dataset can cause the integrated circuit manufacturing system to generate a device as described herein. For example, by configuring the integrated circuit manufacturing system in the manner described above with reference to Figure 12 the device described herein can be manufactured.
[0202] In some examples, the integrated circuit definition dataset can include software that runs on hardware defined at the dataset, or software that runs in combination with the hardware defined at the dataset. In the example shown in Figure 12 , the IC production system can be further configured by the integrated circuit definition dataset to load firmware onto the integrated circuit according to program code defined at the integrated circuit definition dataset when manufacturing the integrated circuit, or otherwise provide program code for use with the integrated circuit.
[0203] Compared with known specific implementations, the specific implementation of the concepts set forth in the present application in devices, apparatuses, modules, and / or systems (and in the methods implemented herein) can improve performance. Performance improvements can include one or more of increased computing performance, reduced latency, increased throughput, and / or reduced power consumption. During the manufacture of such devices, apparatuses, modules, and systems (e.g., in an integrated circuit), a trade-off can be made between performance improvement and the physical implementation, thereby improving the manufacturing method. For example, a trade-off can be made between performance improvement and layout area to match the performance of known implementations but use less silicon. For example, this can be done by reusing functional blocks serially or sharing functional blocks among the elements of the apparatus, device, module, and / or system. Conversely, the concepts set forth in the present application that cause improvements in the physical implementation of devices, apparatuses, modules, and systems (e.g., reduced silicon area) can be traded off against performance improvement. This can be done, for example, by manufacturing multiple instances of a module within a predefined area budget.
[0204] The applicant hereby independently discloses each individual feature described herein and any combination of two or more such features to the extent that such features or combinations can be implemented based on the entire specification in view of the common general knowledge of those skilled in the art, regardless of whether such features or combinations of features solve any of the problems disclosed herein. In view of the foregoing description, it will be apparent to those skilled in the art that various modifications can be made within the scope of the present invention.
[0205] Cross - reference to related applications
[0206] This application claims priority to UK Patent Application No. 2400246.1, filed on January 8, 2024, which is incorporated herein by reference in its entirety.
Claims
1. A method for performing an intersection test on a ray relative to a primitive in a ray tracing system, the method comprising: Determining values of one or more intersection attributes for a primary sample of the ray that are relevant to an intersection between the ray and the primitive in a ray coordinate system, wherein the ray coordinate system has two non-parallel axes, both of the two non-parallel axes are transverse to the direction of the ray, and wherein the origin of the ray coordinate system is located on the ray; For one or both of the two non-parallel axes of the ray coordinate system, determining data indicative of a change in the one or more intersection attributes in a direction parallel to the axis; And Processing the intersection between the ray and the primitive using the determined values of the one or more intersection attributes for the primary sample of the ray and the determined data indicative of a change in the one or more intersection attributes in one or both of the directions parallel to the two non-parallel axes.
2. The method of claim 1, wherein the one or more intersection attributes include one or more of the following: (i) one or more barycentric coordinates, (ii) one or more area coordinates, and (iii) an intersection distance.
3. The method of claim 1 or 2, wherein for each of the one or two of the two non-parallel axes of the ray coordinate system, the data indicative of a change in the one or more intersection attributes in a direction parallel to the axis includes a rate of change of each of the one or more intersection attributes in the direction parallel to the axis.
4. The method of claim 3, wherein the one or more intersection attributes include one or more barycentric coordinates, and wherein processing the intersection between the ray and the primitive includes using the rate of change of each of the one or more barycentric coordinates in one or both of the directions parallel to the one or two of the two non-parallel axes to determine a level of detail (LOD) for the primitive.
5. The method of claim 4, wherein processing the intersection between the ray and the primitive includes: Selecting a mipmap level of a texture using the determined level of detail for the primitive; And Applying the texture to the primitive at the selected mipmap level.
6. The method of any one of claims 3 to 5, wherein the one or more intersection attributes include two barycentric coordinates, and wherein the rate of change of the barycentric coordinates in the directions parallel to the two non-parallel axes is given by: where (u, v) are the barycentric coordinates, p and q are the coordinates on the two non-parallel axes, (a p , a q ) are the coordinates of the first vertex of the graphic primitive on the two non-parallel axes, (b p , b q ) are the coordinates of the second vertex of the graphic primitive on the two non-parallel axes, (c p , c q ) are the coordinates of the third vertex of the graphic primitive on the two non-parallel axes, and A Σ represents the area of the graphic primitive in the ray coordinate system.
7. The method of any one of claims 3 to 6, wherein the one or more intersection attributes include an intersection distance, and wherein the rate of change of the intersection distance in the directions parallel to the two non-parallel axes is given by: where t is the intersection distance, p and q are coordinates on the two non-parallel axes, (u, v) are the barycentric coordinates associated with the intersection between the ray and the primitive, D z is the component with the largest magnitude among the components of the ray direction vector for the ray in the spatial coordinate system defining the primitive, a z is the coordinate of the first vertex of the primitive in the same dimension of the spatial coordinate system as D z , b z is the coordinate of the second vertex of the primitive in the same dimension of the spatial coordinate system as D z , and c z is the coordinate of the third vertex of the primitive in the same dimension of the spatial coordinate system as D z .
8. The method according to any one of the preceding claims, wherein for each of the one or both of the two non-parallel axes of the ray coordinate system, the data indicating the change of the one or more intersection attributes in the direction parallel to the axis includes the value of each intersection attribute of the one or more intersection attributes for the sub-samples of the ray related to the intersection between the ray and the primitive, the sub-samples of the ray being offset from the primary sample of the ray in the direction parallel to the axis.
9. The method according to claim 8, wherein the value of each intersection property of the one or more intersection properties of the sub-sample of the ray is determined by applying one or more logical operations to the value of the corresponding one of the one or more intersection properties determined for the primary sample of the ray, wherein the one or more logical operations include: (i) One or more addition operations, (ii) one or more subtraction operations, and / or (iii) one or more multiplication operations.
10. The method according to claim 8 or 9, wherein processing the intersection between the ray and the primitive includes using the one or more intersection attributes of the sub-samples of the ray to determine whether the sub-samples of the ray hit the primitive.
11. The method according to any one of claims 8 to 10, the method further comprising: Determining the values of the one or more intersection attributes for a plurality of sub-samples of the ray that are at different offsets from the primary sample of the ray; Determining whether the samples of the ray hit the primitive based on the determined values of the one or more intersection attributes for each sample of the ray; And Using the determination of whether each sample of the ray hits the primitive to determine an output value representing the intersection of the ray with the scene geometry, wherein the intersection of the ray with the scene geometry includes the intersection between the ray and the primitive, and wherein the samples of the ray include the primary sample of the ray and the plurality of sub-samples.
12. The method according to claim 11, wherein using the determination of whether each sample of the ray hits the primitive to determine an output value representing the intersection of the ray with the scene geometry includes: For each sample of the ray determined to hit the primitive, determining the contribution of the primitive to the output value; And Using the determined contributions for the samples of the ray determined to hit the primitive to determine the output value representing the intersection of the ray with the scene geometry.
13. The method according to claim 11 or 12, wherein the one or more intersection attributes include a plurality of area coordinates, wherein determining the values of the one or more intersection attributes for a plurality of sub-samples of the ray includes determining at least two area coordinates for each of the plurality of sub-samples by adding to and / or subtracting from the corresponding area coordinates determined for the primary sample of the ray the values, and wherein determining whether each sample of the ray hits the primitive includes determining whether each sample of the ray hits the primitive based on the signs of the area coordinates determined for the sample.
14. The method according to claim 13, wherein the area coordinates (A0, A1, A2) for the primary sample of the ray are given by: A0 = b p c q -b q c p A1 = c p a q -c q a p A2 = a p b q -a q b p and wherein the area coordinates (A′0, A′1, A′2) for the sub - sample are given by: A′0 = A0 + p′(b q - c p ) + q′(c p - b p ) A′1 = A1 + p′(c q - a q ) + q′(a p - c p ) A′2 = A2 + p′(a q - b q ) + q′(b p - a p ) where p′ and q′ represent the offsets of the sub-sample relative to the primary sample on the two non-parallel axes, (a p , a q ) are the coordinates of the first vertex of the primitive on the two non-parallel axes, (b p , b q ) are the coordinates of the second vertex of the primitive on the two non-parallel axes, and (c p , c q ) are the coordinates of the third vertex of the primitive on the two non-parallel axes.
15. The method according to any one of claims 11 to 14, wherein: the plurality of sub - samples of the ray include four sub - samples of the ray that are at respective offsets of (-1, 0), (+1, 0), (0, -1), and (0, +1) from the primary sample of the ray in the ray coordinate system; or the plurality of sub - samples of the ray include eight sub - samples of the ray that are at respective offsets of (-1, -1), (-1, 0), (-1, +1), (0, -1), (0, +1), (+1, -1), (+1, 0), and (+1, +1) from the primary sample of the ray in the ray coordinate system.
16. The method according to any one of claims 8 to 15, wherein a diffusion value for the ray is used to determine the offset of the sub - sample of the ray from the primary sample of the ray, wherein the diffusion value represents orthogonal diffusion or pseudo - perspective diffusion of the ray.
17. The method according to any of the preceding claims, wherein processing the intersection between the ray and the primitive includes: providing the determined value of the one or more intersection attributes for the primary sample of the ray and the determined data indicating the change of the one or more intersection attributes in one or both of the directions parallel to the two non - parallel axes as an input to a shader program; and using the provided input to execute the shader program.
18. A ray - tracing unit configured to perform an intersection test for a ray with respect to a primitive, the ray - tracing unit being configured to: determine values of one or more intersection attributes for a primary sample of the ray that are related to an intersection between the ray and the primitive in a ray coordinate system having two non - parallel axes, both of the two non - parallel axes being transverse to the direction of the ray, and wherein the origin of the ray coordinate system lies on the ray; for one or both of the two non - parallel axes of the ray coordinate system, determine data indicating the change of the one or more intersection attributes in the direction parallel to the axis; and process the intersection between the ray and the primitive using the determined values of the one or more intersection attributes for the primary sample of the ray and the determined data indicating the change of the one or more intersection attributes in one or both of the directions parallel to the two non - parallel axes.
19. 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.
20. A computer-readable storage medium having an integrated circuit definition data set stored thereon, the integrated circuit definition data set being configured to configure the integrated circuit manufacturing system to manufacture the ray tracing unit as claimed in claim 18 when processed in the integrated circuit manufacturing system.