A method of processing a ray in a ray tracing system, comprising: performing intersection testing for the ray by performing one or more intersection testing iterations, wherein each intersection testing iteration comprises: traversing an acceleration structure to identify the nearest intersection of the ray with a primitive that has not been identified as the nearest intersection in any previous intersection testing iterations for the ray; and in response to determining, based on a characteristic of the primitive, that a traverse shader is to be executed in respect of the identified intersection: executing the traverse shader in respect of the identified intersection; and in response to the execution of the traverse shader determining that the ray does not intersect the primitive at the identified intersection, causing another intersection testing iteration to be performed; and when the intersection testing for the ray is complete, executing an output shader to process a result of the intersection testing for the ray, wherein a traverse shader is executed in respect of an identified intersection for the ray in at least one of the one or more intersection testing iterations. performing intersection testing for the ray by performing one or more intersection testing iterations, wherein each intersection testing iteration comprises: traversing an acceleration structure to identify the nearest intersection of the ray with a primitive that has not been identified as the nearest intersection in any previous intersection testing iterations for the ray; and in response to determining, based on a characteristic of the primitive, that a traverse shader is to be executed in respect of the identified intersection: executing the traverse shader in respect of the identified intersection; and in response to the execution of the traverse shader determining that the ray does not intersect the primitive at the identified intersection, causing another intersection testing iteration to be performed; and traversing an acceleration structure to identify the nearest intersection of the ray with a primitive that has not been identified as the nearest intersection in any previous intersection testing iterations for the ray; and in response to determining, based on a characteristic of the primitive, that a traverse shader is to be executed in respect of the identified intersection: executing the traverse shader in respect of the identified intersection; and in response to the execution of the traverse shader determining that the ray does not intersect the primitive at the identified intersection, causing another intersection testing iteration to be performed; and executing the traverse shader in respect of the identified intersection; and in response to the execution of the traverse shader determining that the ray does not intersect the primitive at the identified intersection, causing another intersection testing iteration to be performed; and when the intersection testing for the ray is complete, executing an output shader to process a result of the intersection testing for the ray, wherein a traverse shader is executed in respect of an identified intersection for the ray in at least one of the one or more intersection testing iterations.