Your guide to Metal ray tracing

RSS for tag

Discuss the WWDC23 Session Your guide to Metal ray tracing

Posts under wwdc2023-10128 tag

2 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

acceleration structure doesn't render in gpu trace
I've got a scene which renders as I expect: but in the acceleration structure inspector, the kraken primitive doesn't render: In the list on the left, the structure is there. As expected, there is just one bounding-box primitive as a lot happens in the intersection function (doing it this way since I've already built my own octree and it takes too long to rebuild BVHs for dynamic geometry) This is just based on the SimplePathTracer example. The signatures of the sphereIntersectionFunction and octreeIntersectionFunction aren't that different: [[intersection(bounding_box, triangle_data, instancing)]] BoundingBoxIntersection sphereIntersectionFunction(// Ray parameters passed to the ray intersector below float3 origin [[origin]], float3 direction [[direction]], float minDistance [[min_distance]], float maxDistance [[max_distance]], // Information about the primitive. unsigned int primitiveIndex [[primitive_id]], unsigned int geometryIndex [[geometry_intersection_function_table_offset]], // Custom resources bound to the intersection function table. device void *resources [[buffer(0), function_constant(useResourcesBuffer)]] #if SUPPORTS_METAL_3 ,const device Sphere* perPrimitiveData [[primitive_data]] #endif ,ray_data IntersectionPayload& payload [[payload]]) { vs. [[intersection(bounding_box, triangle_data, instancing)]] BoundingBoxIntersection octreeIntersectionFunction(// Ray parameters passed to the ray intersector below float3 origin [[origin]], float3 direction [[direction]], float minDistance [[min_distance]], float maxDistance [[max_distance]], // Information about the primitive. unsigned int primitiveIndex [[primitive_id]], unsigned int geometryIndex [[geometry_intersection_function_table_offset]], // Custom resources bound to the intersection function table. device void *resources [[buffer(0)]], const device BlockInfo* perPrimitiveData [[primitive_data]], ray_data IntersectionPayload& payload [[payload]]) Note: running 15.0 beta 5 (15A5209g) since even the unmodified SimplePathTracer example project will hang the acceleration structure viewer on Xcode 14. Update: Replacing the octreeIntersectionFunction's code with just a hard-coded sphere does render. Perhaps the viewer imposes a time (or instruction count) limit on intersection functions so as to not hang the GPU?
6
0
644
Aug ’23