This application claims foreign priority under 35 U.S.C. 119 from United Kingdom patent application No. GB2315023.8 filed on 29 Sep. 2023, the contents of which are incorporated by reference herein in their entirety.
The present disclosure is directed to a method of processing a primitive as part of intersection testing in a ray tracing system, the primitive being defined by an ordered set of vertices, and to an intersection testing module that is configured to perform processing of a primitive as part of intersection testing in a ray tracing system.
Ray tracing is a computational rendering technique for generating an image of a scene by tracing paths of light from the viewpoint of a camera through the scene. The paths of light may otherwise be referred to as rays. Each ray is modelled as originating from the camera and passing through a pixel into the scene. As a ray traverses the scene it may intersect objects within the scene. The interaction between a ray and an object it intersects can be modelled to create realistic visual effects. For example, in response to determining an intersection of a ray with an object, a shader program may be executed in respect of the intersection. A programmer can write the shader program to define how the system reacts to the intersection which may, for example cause one or more secondary rays to be emitted into the scene. For example, secondary rays may represent a reflection of the ray off the intersected object or a refraction of the ray through the object if the object is transparent or translucent. As another example, the shader program could cause one or more rays to be emitted into the scene for the purposes of determining whether the object is in shadow at the intersection point. The result of executing the shader program (and processing the relevant secondary rays) can be the calculation of a colour value for the pixel the ray passed through.
Rendering an image of a scene using ray tracing may involve performing many intersection tests of different rays against the objects present in the scene. A ray tracing system may implement billions of intersection tests to render an image of a scene. Intersection testing typically involves complex floating-point arithmetic which is computationally intensive and, where the ray tracing system is implemented in hardware, requires a large amount of physical silicon area. Thus, methods for reducing the power consumption, hardware requirements and latency of intersection testing are desirable.
This Summary is provided to introduce a selection of concepts in a simplified form that are further described below in the Detailed Description. This Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
There is provided a method of performing intersection testing of a ray in respect of a primitive in a ray tracing system, the primitive being defined by an ordered set of vertices, the method comprising:
There is provided a method of performing intersection testing of a ray in respect of a primitive in a ray tracing system, the primitive being defined by an ordered set of vertices, the method comprising:
Said analysing signs of the coordinate data for the set of two or more vertices in ray space may be performed without having previously performed any floating-point calculations as part of the intersection testing of the ray in respect of the primitive.
The method may further comprise performing a zero comparison on the coordinate data for each vertex of the set of two or more vertices.
The signs of the coordinate data for the set of two or more vertices in ray space may indicate the orientation of the at least one edge of the primitive.
The signs of the coordinate data for the set of two or more vertices in ray space may be used to determine the winding order of the primitive.
The set of two or more vertices may comprise a first pair of vertices that defines a first edge of the primitive, and said analysing signs of the coordinate data for the set of two or more vertices in ray space may comprise determining whether:
The analysis of the signs of the coordinate data for first pair of vertices in ray space may be used to determine the orientation of the first edge of the primitive.
The non-intersection condition may be fulfilled if the orientation of the first edge of the primitive matches a predetermined orientation, the predetermined orientation indicating that the ray does not intersect a primitive comprising an edge that has that orientation.
The orientation of the first edge of the primitive may be defined according to an orientation of the two non-parallel axes, the orientation of two non-parallel axes being indicated by a data flag that is used to translate the coordinates of the first pair of vertices in ray space.
The data flag may be a single bit.
The set of two or more vertices may be a set of three or more vertices forming at least two pairs of vertices, the first pair of vertices defining the first edge of the primitive and a second pair of vertices defining a second edge of the primitive, and said analysing signs of the coordinate data for the set of two or more vertices in ray space may comprise determining whether:
The analysis of the signs of the coordinate data for the first and second pair of vertices in ray space may be used to determine the orientations of the first and second edges of the primitive.
The non-intersection condition may be fulfilled if the orientation of the first edge of the primitive is different from the orientation of the second edge of the primitive.
The set of two or more vertices may be a complete set of ordered vertices that define the primitive.
Said analysing signs of the coordinate data for the set of two or more vertices in ray space may comprise analysing the signs of at least a first coordinate, in ray space, for all of the vertices in the complete set of vertices that define the primitive.
The non-intersection condition may be fulfilled if at least one of the following is true:
The coordinate data for each vertex of the set of two or more vertices, in ray space, may comprise:
The first non-parallel axis may be perpendicular to the second non-parallel axis in ray space, and both the first and the second non-parallel axes may be perpendicular to the direction of the ray.
If it is determined that the ray does not intersect the primitive, then no further intersection testing may be performed in respect of the ray for that primitive.
The method may be used to render an image of a scene.
There is provided an intersection testing module for performing intersection testing of a ray in respect of a primitive in a ray tracing system, the primitive being defined by an ordered set of vertices, the intersection testing module being configured to:
The intersection testing module may be further configured to, in response to determining that the non-intersection condition is not fulfilled, perform further intersection testing in respect of the ray on the primitive.
There is provided a method of processing a primitive for intersection testing in a ray tracing system, the primitive being defined by an ordered set of vertices, the method comprising:
The method may further comprise comparing the determined distance component of each of the vertices to both of the minimum and maximum valid distance values for the ray.
The distance component of each vertex may be determined by observing a first coordinate of each of the vertices.
The ray may be represented using a ray direction vector, and the first coordinate may be along an axis that corresponds to the component of the ray direction vector that has the largest magnitude.
Comparing the determined distance component of each of the vertices to at least one of a minimum and a maximum valid distance value for the ray may comprise observing the coordinate data for the vertices in a space-coordinate system in which the primitive is defined.
The method may further comprise projecting the coordinate data for the set of three or more vertices into ray space using the ray data, wherein the ray space has two non-parallel axes that are both transverse to the direction of the ray, a ray-space frame of reference associated with the two non-parallel axes is centred at a point on the ray such that the ray is represented as that point on the two non-parallel axes in the ray space, and wherein the point is an origin of the ray space.
The comparison of the determined distance component of each of the vertices to at least one of a minimum and a maximum valid distance value for the ray may be performed based on the projected coordinate data.
The ray may be represented using a ray direction vector, and the method may further comprise using the projected coordinate data to calculate an indication of a coordinate value for each vertex along an axis in the space-coordinate system for which the component of the ray direction vector has the largest magnitude.
Calculating the indication of a coordinate value for a vertex along the axis in the space-coordinate system for which the component of the ray direction vector has the largest magnitude may comprise scaling the coordinate value by said component of the ray direction vector having the largest magnitude.
Scaling the coordinate value by said component of the ray direction vector having the largest magnitude may be performed such that:
The ray may be represented using a ray direction vector, and the method may comprise scaling the minimum and maximum valid distance values for the ray using the component of the ray direction vector having the largest magnitude.
Scaling the minimum and maximum valid distance values for the ray may comprise multiplying the minimum and maximum valid distance values by the component of the ray direction vector having the largest magnitude.
Rescaling the minimum valid distance value for the ray may be performed such that:
t′
min
=D
maj
t
min
Rescaling the maximum valid distance value for the ray may be performed such that:
t′
max
=D
maj
t
max
In response to determining that the ray does not intersect the primitive, no further intersection testing may be performed in respect of the ray for that primitive.
The method may be used to render an image of a scene.
There is provided an intersection testing module for processing a primitive as part of intersection testing in a ray tracing system, the primitive being defined by an ordered set of vertices, the intersection testing module being configured to:
The intersection testing module may be further configured to perform further intersection testing in respect of the ray on the primitive in response to determining that: (i) it is not the case that the determined distance components for all of the vertices of the primitive are less than the minimum valid distance, and (ii) it is not the case that the determined distance components for all of the vertices of the primitive are greater than the maximum valid distance.
The intersection testing module may be further configured to compare the determined distance component of each of the vertices to both of the minimum and maximum valid distance value for the ray.
The ray may be represented using a ray direction vector, and the determined distance component of each vertex may be determined by observing a first coordinate of each of the vertices, the first coordinate being along an axis that corresponds to the component of the ray direction vector that has the largest magnitude.
The intersection testing module may be configured to compare the determined distance component of each of the vertices to at least one of a minimum and a maximum valid distance value for the ray by observing the coordinate data for the vertices in a space-coordinate system in which the primitive is defined.
The intersection testing module may be further configured to project the coordinate data for the set of three or more vertices into ray space using the ray data, wherein the ray space has two non-parallel axes that are both transverse to the direction of the ray, a ray-space frame of reference associated with the two non-parallel axes is centred at a point on the ray such that the ray is represented as that point on the two non-parallel axes in the ray space, and wherein the point is an origin of the ray space, wherein the comparison of the determined distance component of each of the vertices to at least one of a minimum and a maximum valid distance value for the ray may be performed using the projected coordinate data.
The intersection testing module may be embodied in hardware on an integrated circuit. There may be provided a method of manufacturing, at an integrated circuit manufacturing system, an intersection testing module. There may be provided an integrated circuit definition dataset that, when processed in an integrated circuit manufacturing system, configures the system to manufacture an intersection testing module. There may be provided a non-transitory computer readable storage medium having stored thereon a computer readable description of an intersection testing module that, when processed in an integrated circuit manufacturing system, causes the integrated circuit manufacturing system to manufacture an integrated circuit embodying an intersection testing module.
There may be provided an integrated circuit manufacturing system comprising: a non-transitory computer readable storage medium having stored thereon a computer readable description of the intersection testing module; a layout processing system configured to process the computer readable description so as to generate a circuit layout description of an integrated circuit embodying the intersection testing module; and an integrated circuit generation system configured to manufacture the intersection testing module according to the circuit layout description.
There may be provided computer program code for performing any of the methods described herein. There may be provided non-transitory computer readable storage medium having stored thereon computer readable instructions that, when executed at a computer system, cause the computer system to perform any of the methods described herein.
The above features may be combined as appropriate, as would be apparent to a skilled person, and may be combined with any of the aspects of the examples described herein.
Examples will now be described in detail with reference to the accompanying drawings in which:
The accompanying drawings illustrate various examples. The skilled person will appreciate that the illustrated element boundaries (e.g., boxes, groups of boxes, or other shapes) in the drawings represent one example of the boundaries. It may be that in some examples, one element may be designed as multiple elements or that multiple elements may be designed as one element. Common reference numerals are used throughout the figures, where appropriate, to indicate similar features.
The following description is presented by way of example to enable a person skilled in the art to make and use the invention. The present invention is not limited to the embodiments described herein and various modifications to the disclosed embodiments will be apparent to those skilled in the art.
Embodiments will now be described by way of example only.
Generally, when performing intersection testing of a ray with a primitive, the ray is defined in terms of components (i.e., coordinates) in a space-coordinate system in which the primitive is defined. However, ray data that defines a ray may be used to derive a ray-coordinate system which is relative to the ray itself, such that primitives that are to be tested against a given ray can be mapped onto the ray-coordinate system derived from the data of that ray. The term “space-coordinate system” is used herein to refer to the coordinate system in which the primitive is defined. The “space-coordinate system” may be a world space-coordinate system or an instance space-coordinate system. In most of the examples described herein the space-coordinate system is a three-dimensional coordinate system. The shape, size and position of a primitive may be defined as a region of three-dimensional space contained entirely within a plane of the three-dimensional coordinate system and may be bounded by n≥3 line segments. Each of the interior angles of the primitive may be less than or equal to 180°. Primitives with all interior angles of less than or equal to 180° are referred to as convex polygons. A strictly convex polygon is a convex polygon such that all interior angles are strictly less than 180°.
The terms “ray-coordinate system” and “ray space”, are used herein to refer to a coordinate system that is specific to a ray, and which has its origin on the ray. In the examples described in detail herein the origin of the ray-coordinate system is the origin of the ray, but in other examples, any point on the ray (i.e. any point along the ray's line) could be used as the origin of the ray-coordinate system, with a suitable adjustment to the minimum and maximum culling distances for the ray (tmin and tmax). The ray-coordinate system has three basis vectors. A first of the basis vectors is aligned with the ray direction. The second and third basis vectors are transverse (or non-parallel relative) to the first basis vector. The second and third of the basis vectors may both be orthogonal to the first basis vector, and are not parallel with each other. The second and third basis vectors of the ray-coordinate system are not, in general, orthogonal to each other, although in some examples they may be orthogonal to each other. In examples described herein, the second and third basis vectors of the ray-coordinate system have a 0 as one component when expressed in the space-coordinate system. In some examples, the second and third of the basis vectors of the ray-coordinate system have a value of ±1 (i.e. a magnitude of 1) for one component when expressed in the space-coordinate system.
In examples described below, the ray-coordinate system is used by the intersection testing module 108 to perform intersection testing to determine whether a ray intersects a primitive, wherein the ray and the primitive are defined in a 3D space using a space-coordinate system. A result of performing the intersection testing for the ray is output from the intersection testing module 108 for use by the ray tracing system, e.g. for use in determining which shader program(s) is(are) executed for the ray by the processing logic 110.
The vertices defining the primitive may be translated for use in performing the intersection testing using the ray-coordinate system by subtracting the ray origin from the positions of the vertices defining the primitive in world space. Subtracting the ray origin from the positions of the vertices defining the primitive means that the position of the primitive is then defined relative to the origin of the ray. By shifting the vertices by the ray origin first, all relative error in downstream calculations is centred around the ray origin. In alternative examples, the vertices defining the primitive may be translated after ray-space projection by calculating the 2D coordinates of the ray origin in its own ray-space coordinate system upfront for each ray.
The second and third basis vectors, P and Q, may be defined to be
More generally, and as shown in the example in
The ray-coordinate system may either be left-handed or right-handed. In
Projecting a primitive into ray space during intersection testing is advantageous as it reduces the testing to a 2D problem. The ray is determined to intersect the primitive only if the primitive covers the origin of the P and Q axes in ray space. After the primitive 204 has been projected into ray space, intersection testing for that primitive further comprises determining a parameter w that is indicative of which side of the eth edge of primitive 204 the ray passes on. For primitive 204, e is a number between 1 and 3. For example, w may be a signed parameter which is determined using a function (which is referred to herein as a “2D cross product”), ƒ(vi, vj) of the positions of the two projected vertices vi and vj defining the eth edge of the primitive. The 2D cross product, ƒ(vi, vj), of the positions of two projected vertices, vi and vj, defining an edge, is defined as ƒ(vi, vj)=pi, qj−qi, pj, where pi and qi are components of the projected vertex vi along the respective axes of the pair of axes, and where pj and qj are components of the projected vertex vj along the respective axes of the pair of axes. In other examples, other functions of the positions of the two projected vertices defining the edge may be used to determine the parameter w. The sign of w for the eth edge of the primitive 204 indicates whether the ray passes on the left or the right of that edge, from the edge's perspective (directed from vi to vj). Passing on the “right” side of the edge corresponds to a clockwise rotation from the first endpoint to the second endpoint relative to the origin. With the form of the “2D cross product” given above as ƒ(vi, vj)=pi, qj−qi, pj, and with a first axis pointing rightwards and a second axis pointing upwards, left/anticlockwise corresponds to a positive result of ƒ and right/clockwise corresponds to a negative result of ƒ. Assuming a left-handed system (as per
Once the w parameter has been determined for all the edges of the primitive 204, then it can be determined whether the ray intersects the primitive based on the signs of the w parameters determined for the edges of the primitive. In an example, if the w parameters determined for the edges of the primitive all have the same sign then it is determined that the ray intersects the primitive, whereas if it is not the case that the w parameters determined for the edges of the primitive all have the same sign then it is determined that the ray does not intersect the primitive. That is, intersection testing comprises using the parameters determined for the edges of the primitive to determine whether the ray passes on the “inside” of the edges of the primitive when the (convex) primitive is considered as a whole, where it is determined that the ray intersects the primitive if it is determined that the ray passes on the inside of all the edges of the primitive. Similarly, it is determined that the ray does not intersect the primitive if it is determined that the ray passes “outside” one or more of the edges of the primitive.
Performing intersection testing by determining 2D cross products for each edge of a primitive, as described above, involves floating-point arithmetic and may therefore be seen to be computationally expensive. For this reason, it is advantageous if the number of cross product calculations that have to be performed by an intersection testing module can be minimised. The calculations can be minimised by culling, or removing, primitives from intersection processing before these advanced calculations are performed. The culling of a primitive from intersection testing processing can be performed if it can be determined, without performing floating-point arithmetic, that the primitive is not intersected by the ray. Culling primitives in this way may be achieved via the processing methods described below. The methods described below may otherwise be referred to as “pre-processing methods”, as they precede substantive intersection testing (i.e., 2D cross product calculations). The processing methods may be used to render an image in a scene, as they are used to inform the subsequent intersection testing that is required to render the scene.
A first method of processing a primitive as part of intersection testing in a ray tracing system is illustrated in
The method of
The method of
Once the ray data and the coordinate data have been received by the intersection testing module, then at step S406 the method comprises projecting the coordinate data for the set of two or more vertices into ray space using the ray data. That is, the coordinate data is projected into the ray-coordinate system from the space-coordinate system. As described above, the coordinate data is projected into ray space by defining the basis vectors P, Q and R, where R is set to be along the direction of the ray, R=A(Dx, Dy, Dz), where A is a scalar value. The second and third basis vectors, P and Q, are defined as P=B(Dz, 0, −Dx) and Q=C(0, Dz, −Dy). values. The P and Q axes of ray space are defined as two non-parallel axes that are both transverse to the direction R of the ray. The origin of the ray space on of the ray. The projection of vertex coordinates into ray-space may be performed as an initial step of intersection testing that precedes substantive (i.e., floating-point) intersection testing.
After the coordinate data for the primitive has been projected into ray space, then at step S408 the signs of the coordinate data for the set of two or more vertices in ray space are analysed to determine whether a non-intersection condition is fulfilled. That is, the signs of the coordinate data for the set of two or more vertices are compared to a non-intersection condition. The signs of the coordinate data indicate the orientation of the vertex coordinates along one or more axes of ray space when compared to the origin of ray space. That is, a sign of vertex coordinate data indicates, relative to a respective ray-space axis, whether the position of the vertex is positive or negative. The “non-intersection condition” may otherwise be referred to as a test, or a determination of whether a certain scenario is true. The non-intersection condition determines whether the signs of the coordinate data fulfil a predetermined criterion. The non-intersection condition may require that the signs of the vertex coordinates are compared to each other. Alternatively, the non-intersection condition may require that the signs of the vertex coordinates are compared to another value. Examples of non-intersection conditions that may be fulfilled at step S408 are provided below. In some examples, the non-intersection condition requires that the orientation of one or more edges of a primitive, each edge being defined by a respective pair of vertices, is the same as a corresponding predetermined orientation. In other examples, the non-intersection condition requires that the signs of certain vertex coordinates for the primitive are the same as each other.
If the non-intersection condition is fulfilled (i.e., the answer to the test at step S410 is yes), the method proceeds to step S412 at which it is determined that the ray does not intersect the primitive. In other words, for the method of
Alternatively to step S412, if the non-intersection condition is not fulfilled (i.e., the answer to the test in step S410 is no) then it is not determined that the ray does not intersect the primitive. That is, the intersection testing module may be configured to determine that, if the non-intersection condition is not fulfilled, further testing is required to determine whether there is an intersection between the ray and the primitive. Thus, the method proceeds to step S414 at which the primitive is submitted for further intersection testing. The further intersection testing may comprise performing floating-point arithmetic (e.g., 2D dot cross product calculations) to determine whether there is an intersection between the ray and the primitive.
Analysing the signs of the coordinate data may comprise comparing the sign of a first coordinate of a first vertex of a primitive, in ray space, to the sign of a first coordinate of one or more other vertices of the primitive, in ray space. For example, where each vertex of the primitive has a p and a q coordinate, in ray space, the method of
The method of
The signs of the coordinate data for the set of two or more vertices in ray space may be used to indicate the orientation of the edge. An edge may have either an anticlockwise or a clockwise orientation. An edge has a clockwise orientation, from the viewpoint of a ray, when that ray (i.e., the origin of ray space) passes on the right-hand side of the edge, with respect to the direction of that edge. An edge has an anticlockwise orientation, from the viewpoint of the ray, when that ray (i.e., the origin of ray space) passes on the left-hand side of the edge, with respect to the direction of that edge. The signs of vertex coordinate data for a primitive may be used to determine the orientation of an edge of a primitive when the vertices that are observed are a pair of vertices that define an edge. This is explained in further detail below.
The signs of the coordinate data for the set of two or more vertices in ray space may be used to determine the winding order of the primitive. The winding order of the primitive is determined using the order of the vertices within the primitive (which, for the edges, implies their direction). Thus, the winding order of the primitive affects the orientation of the edges of the primitive in ray space (i.e., from the point of view of the ray). Alongside this ordering, the orientation of the edges of the primitive depends on the vertex coordinates for the primitive in ray space. For example, if the signs of a pair of vertex coordinates that define an edge of a primitive indicate that that edge has an anticlockwise orientation, then it may be derived from that that the primitive as a whole will have an anticlockwise orientation if a hit occurs. Similarly, if a pair of vertex coordinates that define an edge of a primitive indicate that that edge has a clockwise orientation, then it may be derived from that that the primitive as a whole will have a clockwise orientation if a hit occurs. Determining the orientation of a primitive may be useful in determining what type of (if any) further processing is to be performed on that primitive, as is described in further detail below.
Steps S408-S414 make up the analytic steps of the method illustrated in
A first example of analytic steps 416 is illustrated in
The exemplary method illustrated in
More specifically, the method of
The method of
Whilst in
If it is determined that the sign of the first coordinate for a first vertex of the first pair of vertices, in ray space, is different from the sign of a first coordinate for a second vertex of the first pair of vertices (i.e., if the answer to the test at step S502 is yes), then the method proceeds to step S504 in which is determined whether the sign of a second coordinate for a first vertex of the first pair of vertices, in ray space, is the same as the sign of the second coordinate for a second vertex of the first pair of vertices. That is, at step S504 it is determined whether v0 and v1 share the same sign in a second of their coordinates. Specifically, step S504 comprises determining whether the sign of a second coordinate of v0 (q0) is the same as the sign of the corresponding second coordinate of v1 (q1). The signs of q0 and q1 are the same if the signs both of q0 and q1 are positive, or if the signs both of q0 and q1 are positive. In mathematical terms, the condition under which q0 and q1 are determined to be the same may be defined as follows:
Whilst in
If it is determined that the sign of the first coordinate for a first vertex of the first pair of vertices, in ray space, is the same as the sign of the first coordinate for a second vertex of the first pair of vertices (i.e., if the answer to the test at step S502 is no), then the method proceeds to step S506 in which is determined whether the sign of the second coordinate for a first vertex of the first pair of vertices, in ray space, is different from the sign of the second coordinate for a second vertex of the first pair of vertices. That is, at step S506 it is determined whether v0 and v1 have a different sign in a second of their coordinates. Specifically, step S506 comprises determining whether the sign of a second coordinate of v0 (q0) is different from the sign of the corresponding second coordinate of v1 (q1). The signs of q0 and q1 are different if the sign of q0 is positive and the sign of q1 is negative, or if the sign of q0 is negative and the sign of q1 is positive. In mathematical terms, the condition under which q0 and q1 are determined to be different may be defined as follows:
Whilst in
Thus, for the method illustrated in
It is worth noting that, whilst steps S502 to S506 in
At step S508, the analysis of the signs of the coordinate data for first pair of vertices in ray space is used to determine the orientation of the first edge of the primitive. The orientation of a primitive edge can be determined by observing the signs of the vertices that define that edge. For an edge that is defined by vertices v0, v1, the edge starts at v0 and ends at v1. Based on the signs of the coordinates that define each of these edges, the orientation of an edge can be determined based on whether it passes from the −p to +p space, from the +p to −p space, from −q to +q space and from +q to −q space. For example, for a left-handed coordinate system (i.e., first and second axes P and Q as shown in
The results that are summarised above may be stored in a look-up table that is accessible to the intersection testing module for use in determining edge orientation at step S508 of
In some instances, the ray-space coordinate of a primitive vertex may be equal to zero. In this scenario, as an edge having an endpoint coordinate as zero does not cross its respective coordinate axis. To account for scenarios in which primitive ray-space vertices are equal to zero, a trichotomy is defined where a different bit value is assigned to each of s>0, s<0 and s=0 (here s represents either the p or the q coordinate of a ray-space vertex). More specifically:
With the three-bit values given above an unsigned arithmetic calculation, modulo 8, may be performed as follows:
The result of this calculation will be one of 0, 1, 2, 6 and 7. An edge may then be defined as anticlockwise (for a left-handed system) if the result ƒ=1, 2 and as clockwise (for a left-handed system) if ƒ=6, 7. It may not be possible to determine the orientation of the edge if ƒ=0. Alternatively, a look-up table may be used to encode the functionality of this expression on a case-by-case basis. For example, an abbreviated list of edge orientations that may be derived from the signs of the p and q coordinates of a pair of vertices that define an edge, according to this technique, is provided below:
In some examples, the ray-coordinate system may only be observed in a left-handed coordinate system. In these examples, the intersection testing module does not need to have an indication of the handedness of the system to determine edge orientation. In other examples, the coordinate system may be observed in either a left-handed or a right-handed coordinate system. It has been explained above that, in a right-handed system, one of the P or Q axes is reversed so that either the Q axis is directed downwards or the P axis is directed from right to left (or, alternatively, the order of the first P axis and second Q axis is reversed). In other words, the handedness of the ray-coordinate system switches the orientation of the two non-parallel axes that may be orthogonal to the ray direction in ray space. Thus, in a right-handed system, the orientation of an edge from the viewpoint of a ray appears reversed. This reversal is indicated in the table above.
To take the handedness of the ray-coordinate system into account when determining the orientation of the edge of a primitive, a handedness flag indicating the handedness of the ray-coordinate system may be provided to the intersection testing module. In some examples, the flag may be a single bit in length. A bit value of zero may indicate that the orientation of the ray space is clockwise, and therefore that no edge reversal is required. If the flag has a value of one, the orientation of ray space may be reversed (i.e., it may be anticlockwise). The flag may be added to the primitive data such that it is supplied to the intersection testing module as part of that data and therefore can be modified per primitive/geometry/instance. The flag may alternatively be supplied to the intersection testing module, or may be available to that unit, independently of the primitive data: the flag may be added to the ray data such that it is supplied to the intersection testing module as part of that data and therefore can be modified per ray; the flag may be embedded or hardcoded into the system itself, either explicitly (e.g., such that it can be modified by a device context etc.), or implicitly (e.g., by pre-selecting the column in the look-up table above). In any case, the combination of the flag and the signs of the coordinate data for the ray-space primitive vertices is used, in combination with the table above, to determine the edge orientation. Once the edge orientation has been determined, the method proceeds to step S510.
At step S510 it is determined whether the orientation of the edge matches a predetermined edge orientation. Thus, the non-intersection condition of step S410 may be, according to the method of
A back-face culling method determines primitives with a predetermined particular orientation to be “back-facing”. The orientation of a primitive can be derived from the orientation of a single edge of the primitive because, for primitives that are intersected by a ray, all the edges of that primitive share the same orientation with respect to the ray. Thus, if the edge defined by vertices vi, vj is determined to have a first orientation, then it can be derived that either (i) the primitive as a whole has the first orientation, or (ii) one or more edges of the primitive has an opposing orientation and so the primitive is not intersected by the ray. If scenario (ii) is true, then it is desirable to cull the primitive as it can be derived that the ray will miss the primitive. If scenario (i) is true then a culling rule can be used to cull primitives with the first orientation. In one example, the culling method may determine that primitives with an anticlockwise orientation, in a left-handed ray-coordinate system, are back-facing. The method may then cull, or prevent further intersection testing of, primitives that are determined to have an anticlockwise orientation. In other words, if the orientation of the first edge of the primitive matches the predetermined (e.g., anticlockwise) primitive orientation, then it can be determined that there is not an intersection between the ray and the primitive. This is because the predetermined (e.g., anticlockwise) orientation indicates that the ray does not intersect a primitive comprising an edge that has that orientation.
Thus, if the orientation of an edge is determined to match the predetermined orientation (e.g., anticlockwise), then the method proceeds to step S512 at which it is determined that the ray does not intersect the primitive(s) containing that edge. That is, if it is determined that the orientation of the edge matches the predetermined orientation of the culling rule, then any primitives containing that edge are culled. The predetermined orientation may comprise one or more pre-determined orientations. That is the predetermined orientation may be a single orientation (e.g., clockwise or anticlockwise), or two orientations (e.g., both clockwise and anticlockwise). The indication of the predetermined orientation may be supplied to the intersection testing module as a flag. The flag may be a single bit. In this example, the single bit of the flag may be used to indicate one of two possible states. For example, a first bit value may indicate that primitives with a clockwise orientation should be culled, and a second bit value may indicate that primitives with an anticlockwise orientation should be culled. The flag may alternatively comprise two bits. In this example, the two bits of the flag may be used to indicate one of four possible states. For example, a first bit value may indicate that primitives with a clockwise orientation should be culled, a second bit value may indicate that primitives with an anticlockwise orientation should be culled, a third bit value may indicate that no primitives should be culled (i.e., neither clockwise nor anticlockwise) and a fourth bit value may indicate that all primitives should be culled (i.e., both clockwise and anticlockwise). This flag may be provided with primitive data, ray data, or embedded in the testing system, such that it can be modified per primitive/geometry/primitive/ray etc., in the same way as the handedness flag.
If the answer to the test at step S510 is no (i.e., the edge orientation doesn't match the predetermined edge orientation) then the method proceeds to step S514 at which the primitive is submitted for further intersection testing. That is, it is determined as a result of step S510 that the primitive is not one that can be culled early, based on the analysis of the particular edge being considered, and so subsequent intersection testing can be performed to determine whether there is an intersection between the primitive and the ray. In
If the answer to the test at either of steps S506 or S504 is no, then the method may also proceed to step S514 at which the primitive containing the edge is submitted for further intersection testing. By the end of steps S504 and S506 the method has derived from the signs of p0, p1, q0 and q1 whether the edge defined by vertices v0, v1 crosses one or more of the P and Q axes. If p0 and p1 have the same sign, then the edge does not cross the Q axis. If q0 and q1 have the same sign, then the edge does not cross the P axis. Thus, if the vertices v0, v1 share the same sign in both their p and q coordinates (i.e., if the answer to the test at S506 is no), then it can be derived that the edge crosses neither the P nor the Q axis. In this scenario, it may not be possible to determine the orientation of the edge from the signs of the p and q coordinates alone, and so further intersection testing must be performed at step S514. If p0 and p1 have different signs, then the edge does cross the Q axis. If q0 and q1 have different signs, then the edge does cross the P axis. Thus, if the vertices v0, v1 have different signs in both their p and q coordinates (i.e., if the answer to the test at S504 is no), then it can be derived that the edge crosses both the P and the Q axis. In this scenario, it may also not be possible to determine the orientation of the edge from the signs of the p and q coordinates alone. This is because, if an edge crosses both the ray-space exes, the endpoints of those edges are located in opposite quadrants of 2D ray space. In this situation, an edge can be continuously moved so that it crosses over the origin, but without its endpoints leaving their respective quadrants. This means that either a clockwise or an anticlockwise edge orientation can be derived from the same combination of signs. So, further intersection testing must again be performed at step S514 to determine the definitive orientation of the edge.
An example of a primitive that can be culled using the method illustrated in
An advantage of the method illustrated in
A second example of analysing the signs of coordinate data as illustrated in
The exemplary method illustrated in
The first three steps of
If the answer to the tests of either step S604 or step S606 is yes, then it can be derived that the first edge of the primitive (v0, v1) crosses (only) one of the P and Q axes. The method then proceeds to steps S610, S612 and S614 where the second of the two edges in the primitive is analysed. That is, the edge of the primitive defined by a second set of vertices, (v2, v0), is analysed. This method is broadly the same as the method of steps S502, S504 and S506, but is performed for a different edge of the primitive. That is, at step S610 it is determined whether the sign of a first coordinate for a first vertex of the second pair of vertices, in ray space, is different from the sign of a first coordinate for a second vertex of the second pair of vertices. That is, at step S610 it is determined whether the first and second vertices (v2, v0) do not share the same sign in one of their coordinates. Specifically, step S610 comprises determining whether the sign of a first coordinate of v2 (p2) is different to the sign of the corresponding first coordinate of v0 (p0). Similarly to what is described above with respect to
Whilst in
If it is determined that the sign of the first coordinate for a first vertex of the second pair of vertices, in ray space, is different from the sign of a first coordinate for a second vertex of the second pair of vertices (i.e., if the answer to the test at step S610 is yes), then the method proceeds to step S612 in which is determined whether the sign of a second coordinate for a first vertex of the second pair of vertices, in ray space, is the same as the sign of a second coordinate for a second vertex of the second pair of vertices. That is, at step S612 it is determined whether the first and second vertices v2, v0 share the same sign in a second of their coordinates. Specifically, step S612 comprises determining whether the sign of a second coordinate of v2, (q2) is the same of the sign of the corresponding second coordinate of v0 (q0). In mathematical terms, the condition under which q2 and q0 are determined to be the same may be defined as follows:
Whilst in
If it is determined that the sign of the first coordinate for a first vertex of the second pair of vertices, in ray space, is the same as the sign of the first coordinate for a second vertex of the second pair of vertices (i.e., if the answer to the test at step S610 is no), then the method proceeds to step S614 in which is determined whether sign of the second coordinate for a first vertex of the second pair of vertices, in ray space, is different from the sign of the second coordinate for a second vertex of the first pair of vertices. That is, at step S614 it is determined whether the first and second vertices v2, v0 have a different sign in a second of their coordinates. Specifically, step S614 comprises determining whether the sign of a second coordinate of v2 (q2) is different from the sign of the corresponding second coordinate of v0 (q0). In mathematical terms, the condition under which q2 and q0 are determined to be different may be defined as follows:
Whilst in
In summary, steps S602 to S614 of
As with the method illustrated in
At step S616, the analysis of the signs of the coordinate data for the first and second pairs of vertices in ray space is used to determine the orientations of the first and second edges of the primitive respectively. As defined above, the orientation of a primitive edge can be determined by observing the signs of the vertices that define that edge. For an edge that is defined by vertices v0, v1, the edge starts at v0 and ends at v1. Based on the signs of the coordinates that define each of these edges, the orientation of an edge can be determined based on whether it passes from the −p to +p half-space, from the +p to −p half-space, from −q to +q half-space, or from +q to −q half-space, for strictly positive measurements p and q. By observing of the signs of the p and q coordinates of both the first and second vertices, the orientations of the first and second edges can be determined. Unlike the method illustrated in
At step S618 it is determined whether the orientation of the first edge of the primitive is different from the orientation of the second edge of the primitive. In other words, it is determined whether the orientations of the first and second edges are not the same. For the method in
If the answer to the test at either of steps S604, S606, S610 or S612 is no, then the method may proceed to step S622 at which the primitive containing the edge is submitted for further intersection testing. By the end of steps S604 and S606 the method has derived from the signs of p0, p1, q0 and q1, whether the edge defined by vertices v0, v1 crosses one or more of the P and Q axes. If p0 and p1 have the same sign, then the edge does not cross the Q axis. If q0 and q1 have the same sign, then the edge does not cross the P axis. If p0 and p1 have different signs, then the edge does cross the Q axis. If q0 and q1 have different signs, then the edge does cross the P axis. Thus, if the vertices v0, v1 have different signs in both their p and q coordinates (i.e., if the answer to the test at S604 is no), then it can be derived that the edge crosses both the P and the Q axis. The same determination is made at steps S610 and S612 for the edge defined by vertices v2, v0. If it is determined that the edge crosses neither the P nor Q axis, or if it crosses both axes, then an orientation determination cannot be made for the edge and therefore the method proceeds to step S622 where the primitive is submitted for further intersection testing. In
If the answer to the test at step S618 is yes, then the method also proceeds to step S622 and the primitive is submitted from further intersection testing. In this situation, there is insufficient information for it to be derived that there is not an intersection between the ray and the primitive. The intersection testing module may then go on to test a different set of pairs of primitive vertices against each other, to determine if there is at least one edge of the primitive that has a different orientation from another edge of the primitive.
If it is determined that the orientations of the first and second primitives are different, then the method proceeds to step S620 at which it is determined that the ray does not intersect the primitive.
The method illustrated in
An example of a primitive that may be culled using the method illustrated in
In an alternative example to the example illustrated in
The pairwise comparisons mentioned herein may be inefficient for higher order polygons. For higher order polygons, it may be more efficient to mark a first instance of an edge orientation as the edges of a primitive are parsed and to cull the primitive as soon as a record of two edges of the primitives having different orientations occurs. This means that each edge is only analysed once, instead of being analysed multiple times as may happen with pairwise comparisons.
In some examples of the method illustrated in
Another example of the steps 416 of
It is worth noting that, whilst steps S902 to S908 in
In the method of
At steps S902 and S904 the method determines whether the sign of a first coordinate, in ray space, is the same for all the vertices in the complete set of ordered vertices that define the primitive. The first coordinate of the vertices may be measured along a first axis of the two non-parallel axes that define the ray-coordinate system, or ray space. The first coordinate of the vertices may be measured along the P axis in ray space. Thus, more specifically, at step S902 the method determines whether all the coordinates p0, p1 p2, which define the position of vertices v0, v1 and v2, respectively, along the P axis in ray space, are less than zero. That is, the method determines whether all the signs of the coordinates p0, p1 p2, in ray space, are negative. The method may determine whether all the signs of coordinates p0, p1 p2, in ray space, are strictly negative. This condition may be written mathematically as follows:
If all the signs of coordinates p0, p1 p2, in ray space, are strictly negative, then the non-intersection condition is fulfilled because the p coordinates for the primitive vertices share the same sign. Thus, the method proceeds to step S912 in which it is determined that the ray does not intersect the primitive.
An example of a primitive that fulfils the test at step S902 in
Thus, if all the vertices of a primitive share the same sign in at least one of their coordinates, this indicates that the primitive is not intersected by the ray. The signs of the primitive can therefore be used straightforwardly to determine definitively that the ray does not intersect the primitive.
If the primitive does not fulfil the test of step S902, then the method proceeds to step S904 in which it is determined whether all the coordinates p0, p1 p2 are greater than zero. That is, the method determines whether all the signs of the coordinates p0, p1 p2, in ray space, are positive. The method may determine whether all the signs of coordinates p0, p1 p2, in ray space, are strictly positive. If all the signs of coordinates p0, p1 p2, in ray space, are strictly positive, then the non-intersection condition is fulfilled because the coordinates share the same sign. This test may be written mathematically as follows:
Thus, the method proceeds to step S912 in which it is determined that the ray does not intersect the primitive. More specifically, if all the signs of coordinates p0, p1 p2, in ray space, are strictly positive, then this indicates that all v0, v1 and v2 are located on the right-hand side of the PQ plane in ray space. As all the vertices in the primitive have a (strictly) positive p coordinate, it can be derived that the primitive does not cross the Q axis. Thus, similarly to as is described above with respect to
The method of
If all the signs of coordinates q0, q1 and q2, in ray space, are strictly negative, then the non-intersection condition is fulfilled because the coordinates share the same sign. Thus, the method proceeds to step S912 in which it is determined that the ray does not intersect the primitive. More specifically, if all the signs of coordinates q0, q1 and q2, in ray space, are strictly negative, then this indicates that all v0, v1 and v2 are located in the lower half of the PQ plane in ray space. As all the vertices in the primitive have a negative q coordinate, it can be derived that the primitive does not cross the P axis. Thus, as with steps S902 and S904, the primitive cannot be intersected by the ray that defines that origin, being the crossing point of the P and Q axis.
If the primitive does not fulfil the test of step S906 (i.e., if the answer to the test is no), then the method proceeds to step S908 in which it is determined whether all the coordinates q0, q1 and q2, are greater than zero. That is, the method determines whether all the signs of the coordinates q0, q1 and q2, in ray space, are positive. The method may determine whether all the signs of coordinates q0, q1 and q2, in ray space, are strictly positive. This test may be written mathematically as follows:
If all the signs of coordinates q0, q1 and q2, in ray space, are strictly positive, then the non-intersection condition is fulfilled because the coordinates share the same sign. Thus, the method proceeds to step S912 in which it is determined that the ray does not intersect the primitive. More specifically, if all the signs of coordinates q0, q1 and q2, in ray space, are strictly positive, then this indicates that all v0, v1 and v2 are located on the right-hand side of the PQ plane in ray space. As all the vertices in the primitive have a positive q coordinate, it can be derived that the primitive does not cross the P axis. Thus, as with steps S902, S904 and S906, the primitive cannot be intersected by the ray that defines that origin, being the crossing point of the P and Q axis.
Although the method illustrated in
An advantage of the method illustrated in
With the methods described above, if the non-intersection condition is fulfilled then it is determined that the ray does not intersect the primitive and no further intersection testing is performed for that primitive. If no further intersection testing is performed for a primitive, then that primitive may be described as having been “culled”. The term “cull” may be defined as the removal of a primitive from the intersection testing pipeline, such that further testing is not performed from that primitive. The primitive may be culled by removing data defining that primitive from the temporary memory that is used to process that primitive. The primitive may alternatively be culled by associating a flag with the primitive to indicate that no further processing is to be performed for that primitive. Alternatively, primitives for whom further intersection testing is required may be marked (e.g., with a data flag), and primitives for whom no further testing is required may not be marked. Thus, the intersection testing module may know to select only the marked primitives for further testing. As described above, culling a primitive when it is determined that the ray does not intersect the primitive is advantageous as it reduces the number of subsequent, processor-intensive, intersection tests that may be performed for all primitives.
In the examples detailed above, the coordinate data for each vertex of the set of two or more vertices, in ray space, comprises (i) a first coordinate of the coordinate data which is measured along a first axis of the two non-parallel axes, and (ii) a second coordinate which is measured along a second axis of the two non-parallel axes. In other words, the vertex coordinates that are analysed in the methods of
The methods described above act to increase the efficiency of intersection testing in a ray tracing system. The methods may use coordinate data that has been determined from vertex projection to perform a series of cheap tests that determine whether a ray does not intersect a primitive. Using the coordinate data that is determined from vertex projection is advantageous as this is data that is determined at the beginning of the intersection testing process, and this data is determined once per vertex only. Thus, efficiencies can be gained in using pre-prepared data to perform the methods described herein.
A second method of processing a primitive as part of intersection testing in a ray tracing system is illustrated in
Steps S1102 and S1104 of
At step S1104 coordinate data for a primitive is received. More specifically, the coordinate data may be received for a set of vertices that define the primitive. In the method of
Once the ray data and the coordinate data have been received by the intersection testing module, then at step S1106 the coordinate data of each vertex is used to determine a distance component of that vertex along the direction/length of the ray. That is, observing the coordinate data of a first vertex of a primitive v0, the distance along the direction/length of the ray at which that vertex is located may be determined. This determination may be performed for each of the vertices v0, v1 . . . vn that define the primitive. The ‘ray length’ may be given by the magnitude of the direction vector, D, of the ray. The ray direction/length extends from the origin of the ray (which may or may not be the origin of the scene) to positive infinity (with respect to its parameter space), whereas the ray, as a line segment, may extend out towards positive and/or negative infinity (based on the values of tmin and tmax). The determination of the distance component along the direction/length of the ray at which a vertex is located is explained in further detail below.
At step S1108, the determined distance component of each of the vertices is compared to at least one of a minimum and a maximum valid distance value for the ray. That is, the determined distance component of each vertex that defines the primitive, along the direction/length of the ray, is compared to at least one of a minimum and maximum valid distance value for the ray. The minimum and maximum valid distance values for the ray may otherwise be referred to as the minimum and maximum culling distances, or culling distances, or collectively as a distance culling interval, for the ray (tmin and tmax). The minimum and maximum culling distances define a range of distance values, along the length of a ray, within which the ray is valid such that an intersection between the ray and a primitive may occur. The initial values of tmin and tmax are typically predetermined prior to intersection testing, but their values may be dynamically varied from these initial values during intersection testing. For example, during intersection testing, tmax and/or tmin may be updated to a value that is equal to the distance between the ray origin and a determined intersection, e.g., an opaque intersection for tmax and/or a transparent/translucent intersection for tmin. This is usually done such that tmax is only ever decreased and tmin is only ever increased, such that the culling interval only ever reduces in size (culling more geometry) over time, as more information about the scene is garnered during traversal. During intersection testing of a ray against a node or against a primitive, if there is an intersection at a point on the ray with a t value of tint, the minimum culling distance tmin is used so that the intersection is not accepted if tint<tmin (or if tint≤tmin in alternative examples), and the maximum culling distance tmax is used so that the intersection is not accepted if tint>tmax (or if tint≥tmax in alternative examples). So, by comparing the distance components of the primitive vertices along the direction/length of the ray to tmin and tmax, a determination can be made as to whether the ray does not intersect the primitive.
The method of
Similarly to step S1110, at step S1112 it is determined whether the determined distance components for all the vertices of the set of vertices that define the primitive are greater than (or alternatively greater than or equal to) tmax. In other words, for the condition in step S1112 to be true, all the vertices in the set of vertices must have a distance value, along the direction/length of the ray, that is greater than tmax. That is, it is determined whether all the determined distance components for the vertices are greater than the maximum valid distance for the ray. If all the vertices have a distance value that is greater than tmax, then this implies that the ray does not intersect the primitive, as the primitive Is not within the range of distance values within which the ray is valid. The reasoning for this is analogous to the minimum case.
The method of
If the answer to step S1110 is yes (i.e., all the determined distance components for the vertices are less than the minimum valid distance for the ray), the method proceeds to step S1114 at which it is determined that the ray does not intersect the primitive. Similarly, if the answer to step S1112 is yes (i.e., all the determined distance components for the vertices are greater than the maximum valid distance for the ray) then the method proceeds to step S1112. That is, the distance values for the primitive are all less than tmin, or are all greater than tmax, then this implies that there is a “miss” between the ray and the primitive. Alternatively, if the answer to the test both of steps S1110 and S1112 is no (i.e., the non-intersection condition is not fulfilled) the method proceeds to step S1116 at which the primitive is submitted for further intersection testing. That is, it is determined at S1116 that the intersection testing module has insufficient information to determine whether there is not an intersection between the ray and the primitive. In other words, the intersection testing module is configured to perform further intersection testing of the ray on the primitive in response to determining that: (i) it is not the case that the determined distance components for all the vertices of the primitive are less than the minimum valid distance, and (ii) it is not the case that the determined distance components for all the vertices of the primitive are greater than the maximum valid distance. So, subsequent intersection testing (e.g., floating-point calculations) must be performed to reach this determination.
The distance component of each vertex along the direction/length of the ray is determined by observing a first coordinate of each of the vertices. That is, the distance component of each vertex along the direction/length of the ray may be determined by observing a single set of coordinates that are measured along a single axis of a coordinate system. The coordinate system along which the distance of each vertex along the direction/length of the ray is determined may be the space-coordinate system, or alternatively it may be the ray-coordinate system. Note that the first coordinate that is referenced with respect to
As has been described above, each vertex that defines a primitive has a set of coordinate values in the space-coordinate system, where each coordinate value is a measurement of the vertex along a corresponding axis of the space-coordinate system. For example, a first primitive vertex v0 may have a set of coordinates (x0, y0, z0). As is illustrated in
The comparison of determined distance components of each of the vertices to at least one of a minimum and a maximum valid distance value for the ray may comprise observing the coordinate data for the vertices in a space-coordinate system in which the primitive is defined. As mentioned above, the space-coordinate system may be a world-space coordinate system or an instance-space coordinate system. The first coordinate that is observed to determine the distance of each vertex along the direction/length of the ray may be measured along the major axis of the ray (denoted its ray-major coordinate). That is, the first vertex coordinates may be along an axis that corresponds to the component of the ray direction vector that has the largest magnitude. An advantage of observing the distance in this way is that the coordinates of primitive vertices along this axis are most aligned with the coordinates of the ray direction/length, and so the correct results can be obtained when coordinate values are measured along this axis. By comparison, observing distances along a minor axis for the ray where the ray direction has a zero component along this minor axis may result in erroneous distance measurements (due to division/multiplication by zero, see below for more detail).
The method of
Once the coordinate data for the set of three or more vertices has been projected into ray space (which may be performed as a step of intersection testing), then the comparison of the determined distances of each of the vertices to at least one of a pair of minimum and maximum distance values for the ray may be performed using the projected coordinate data. That is, the method of
Further to
The calculation of the component of the first vertex coordinate that is projected onto the major axis may more specifically be performed such that:
In the above equation, ri is the coordinate of an ith vertex vi in ray space and 0≤i<n, Dmaj is the major component of the ray direction and ri′ is the rescaled vertex coordinate of the ith vertex. These rescaled ray-major coordinates of the vertices are then compared to the tmin and tmax values as outlined above. The culling bounds are given in terms of multiples of ray lengths, for example, a tmin value of 1.0 indicates that the valid segment of the ray begins after a single ray direction/length has been travelled from the ray origin.
Rather than rescaling each ray-major coordinate of every vertex for every ray versus primitive test, and as the rescaled values may have no use other than for this early primitive culling (e.g., they are not output as intersection attributes), it may be more cost effective to rescale the tmin and tmax values instead. This provides cost savings, as these two values are usually per-ray attributes (i.e., stored as part of the ray data) and therefore the arithmetic may be performed upfront and once per ray only. In other words, the method of
The calculation of the component of tmin that is projected onto the major axis may more specifically be performed such that:
t
min
′=D
maj
t
min
In the above equation, tmin is the minimum valid distance value for the ray, Dmaj is the major component of the ray direction (in the space-coordinate system) and tmin′ is the rescaled minimum valid distance value for the ray. The above calculation may comprise rescaling tmin. That is, the above calculation may rescale tmin by a factor of Dmaj.
Similarly, the calculation of the component of tmax that is projected onto the major axis may more specifically be performed such that:
t
max
′=D
maj
t
max
In the above equation tmax is the maximum valid distance value for the ray, Dmaj is the major component of the ray direction (in the space-coordinate system) and tmin′ is the rescaled maximum valid distance value for the ray. That is, the above calculation may rescale tmax by a factor of Dmaj. The ray-major coordinates of the vertices are then compared to these rescaled tmin and tmax values as outlined above. Rescaling the culling bounds by the inverse scale factor to the one used in rescaling the vertex coordinates results in the same logical comparison. These modified culling bounds are now not given in terms of multiples of ray lengths, but instead given as absolute distances along the ray major axis. For example, a tmin′ value of 1.0 indicates that the valid segment of the ray begins after a unit distance has been travelled along the ray major axis from the ray origin.
As with the method of
In contrast, if it is determined that the non-intersection condition is not fulfilled, then it cannot be determined that the ray does not intersect the primitive. Note that this does not imply that the ray has intersected the primitive. Rather, if the non-intersection condition is not fulfilled then it can be determined that there is not enough data, at the present step in the processing pipeline, to determine whether there is not an intersection between the ray and the primitive. Thus, further intersection testing must be performed for the primitive to definitively determine whether there is an intersection. Thus, in response to determining that the non-intersection condition is not fulfilled, the methods described above may further comprise performing further intersection testing on the primitive. The further intersection testing may comprise floating-point operations (e.g., edge testing by the calculation of 2D cross product values).
An example of a primitive 1202 that may be culled using the method illustrated in
An advantage of the methods described herein may be gained if one or more edges are shared by a plurality of primitives. In these examples, the analysis of coordinates of vertices that define primitive edges may be used to cull all the primitives that share those edges. For example, for the method in
The modules of
The intersection testing module described herein may be embodied in hardware on an integrated circuit. The intersection testing module described herein may be configured to perform any of the methods described herein. Generally, any of the functions, methods, techniques or components described above can be implemented in software, firmware, hardware (e.g., fixed logic circuitry), or any combination thereof. The terms “module,” “functionality,” “component”, “element”, “unit”, “block” and “logic” may be used herein to generally represent software, firmware, hardware, or any combination thereof. In the case of a software implementation, the module, functionality, component, element, unit, block or logic represents program code that performs the specified tasks when executed on a processor. The algorithms and methods described herein could be performed by one or more processors executing code that causes the processor(s) to perform the algorithms/methods. Examples of a computer-readable storage medium include a random-access memory (RAM), read-only memory (ROM), an optical disc, flash memory, hard disk memory, and other memory devices that may use magnetic, optical, and other techniques to store instructions or other data and that can be accessed by a machine.
The terms computer program code and computer readable instructions as used herein refer to any kind of executable code for processors, including code expressed in a machine language, an interpreted language or a scripting language. Executable code includes binary code, machine code, bytecode, code defining an integrated circuit (such as a hardware description language or netlist), and code expressed in a programming language code such as C, Java or OpenCL. Executable code may be, for example, any kind of software, firmware, script, module or library which, when suitably executed, processed, interpreted, compiled, executed at a virtual machine or other software environment, cause a processor of the computer system at which the executable code is supported to perform the tasks specified by the code.
A processor, computer, or computer system may be any kind of device, machine or dedicated circuit, or collection or portion thereof, with processing capability such that it can execute instructions. A processor may be or comprise any kind of general purpose or dedicated processor, such as a CPU, GPU, NNA, System-on-chip, state machine, media processor, an application-specific integrated circuit (ASIC), a programmable logic array, a field-programmable gate array (FPGA), or the like. A computer or computer system may comprise one or more processors.
It is also intended to encompass software which defines a configuration of hardware as described herein, such as HDL (hardware description language) software, as is used for designing integrated circuits, or for configuring programmable chips, to carry out desired functions. That is, there may be provided a computer readable storage medium having encoded thereon computer readable program code in the form of an integrated circuit definition dataset that when processed (i.e. run) in an integrated circuit manufacturing system configures the system to manufacture an intersection testing module configured to perform any of the methods described herein, or to manufacture an intersection testing module comprising any apparatus described herein. An integrated circuit definition dataset may be, for example, an integrated circuit description.
Therefore, there may be provided a method of manufacturing, at an integrated circuit manufacturing system, an intersection testing module as described herein. Furthermore, there may be provided an integrated circuit definition dataset that, when processed in an integrated circuit manufacturing system, causes the method of manufacturing an intersection testing module to be performed.
An integrated circuit definition dataset may be in the form of computer code, for example as a netlist, code for configuring a programmable chip, as a hardware description language defining hardware suitable for manufacture in an integrated circuit at any level, including as register transfer level (RTL) code, as high-level circuit representations such as Verilog or VHDL, and as low-level circuit representations such as OASIS® and GDSII. Higher level representations which logically define hardware suitable for manufacture in an integrated circuit (such as RTL) may be processed at a computer system configured for generating a manufacturing definition of an integrated circuit in the context of a software environment comprising definitions of circuit elements and rules for combining those elements in order to generate the manufacturing definition of an integrated circuit so defined by the representation. As is typically the case with software executing at a computer system so as to define a machine, one or more intermediate user steps (e.g. providing commands, variables etc.) may be required in order for a computer system configured for generating a manufacturing definition of an integrated circuit to execute code defining an integrated circuit so as to generate the manufacturing definition of that integrated circuit.
An example of processing an integrated circuit definition dataset at an integrated circuit manufacturing system so as to configure the system to manufacture an intersection testing module will now be described with respect to
The layout processing system 1404 is configured to receive and process the IC definition dataset to determine a circuit layout. Methods of determining a circuit layout from an IC definition dataset are known in the art, and for example may involve synthesising RTL code to determine a gate level representation of a circuit to be generated, e.g. in terms of logical components (e.g. NAND, NOR, AND, OR, MUX and FLIP-FLOP components). A circuit layout can be determined from the gate level representation of the circuit by determining positional information for the logical components. This may be done automatically or with user involvement in order to optimise the circuit layout. When the layout processing system 1404 has determined the circuit layout it may output a circuit layout definition to the IC generation system 1406. A circuit layout definition may be, for example, a circuit layout description.
The IC generation system 1406 generates an IC according to the circuit layout definition, as is known in the art. For example, the IC generation system 1406 may implement a semiconductor device fabrication process to generate the IC, which may involve a multiple-step sequence of photo lithographic and chemical processing steps during which electronic circuits are gradually created on a wafer made of semiconducting material. The circuit layout definition may be in the form of a mask which can be used in a lithographic process for generating an IC according to the circuit definition. Alternatively, the circuit layout definition provided to the IC generation system 1406 may be in the form of computer-readable code which the IC generation system 1406 can use to form a suitable mask for use in generating an IC.
The different processes performed by the IC manufacturing system 1402 may be implemented all in one location, e.g. by one party. Alternatively, the IC manufacturing system 1402 may be a distributed system such that some of the processes may be performed at different locations, and may be performed by different parties. For example, some of the stages of: (i) synthesising RTL code representing the IC definition dataset to form a gate level representation of a circuit to be generated, (ii) generating a circuit layout based on the gate level representation, (iii) forming a mask in accordance with the circuit layout, and (iv) fabricating an integrated circuit using the mask, may be performed in different locations and/or by different parties.
In other examples, processing of the integrated circuit definition dataset at an integrated circuit manufacturing system may configure the system to manufacture an intersection testing module without the IC definition dataset being processed so as to determine a circuit layout. For instance, an integrated circuit definition dataset may define the configuration of a reconfigurable processor, such as an FPGA, and the processing of that dataset may configure an IC manufacturing system to generate a reconfigurable processor having that defined configuration (e.g. by loading configuration data to the FPGA).
In some embodiments, an integrated circuit manufacturing definition dataset, when processed in an integrated circuit manufacturing system, may cause an integrated circuit manufacturing system to generate a device as described herein. For example, the configuration of an integrated circuit manufacturing system in the manner described above with respect to
In some examples, an integrated circuit definition dataset could include software which runs on hardware defined at the dataset or in combination with hardware defined at the dataset. In the example shown in
The implementation of concepts set forth in this application in devices, apparatus, modules, and/or systems (as well as in methods implemented herein) may give rise to performance improvements when compared with known implementations. The performance improvements may include one or more of increased computational performance, reduced latency, increased throughput, and/or reduced power consumption. During manufacture of such devices, apparatus, modules, and systems (e.g. in integrated circuits) performance improvements can be traded-off against the physical implementation, thereby improving the method of manufacture. For example, a performance improvement may be traded against layout area, thereby matching the performance of a known implementation but using less silicon. This may be done, for example, by reusing functional blocks in a serialised fashion or sharing functional blocks between elements of the devices, apparatus, modules and/or systems. Conversely, concepts set forth in this application that give rise to improvements in the physical implementation of the devices, apparatus, modules, and systems (such as reduced silicon area) may be traded for improved performance. This may be done, for example, by manufacturing multiple instances of a module within a predefined area budget.
The applicant hereby discloses in isolation each individual feature described herein and any combination of two or more such features, to the extent that such features or combinations are capable of being carried out based on the present specification as a whole in the light of the common general knowledge of a person skilled in the art, irrespective of whether such features or combinations of features solve any problems disclosed herein. In view of the foregoing description it will be evident to a person skilled in the art that various modifications may be made within the scope of the invention.
Number | Date | Country | Kind |
---|---|---|---|
2315023.8 | Sep 2023 | GB | national |