Friday, March 31, 2023
HomeMobile Phones FaktProblem: Bindless ray tracing - Uncover

Problem: Bindless ray tracing – Uncover


Mirror, mirror on the … different mirror. On this problem, we invite you to discover bindless rendering in Steel 3 and replicate rays on mirrored surfaces.

Due to the bindless enhancements in Steel 3, the HybridRendering pattern app seems higher than ever. It makes all scene sources accessible to its shaders utilizing Argument Buffers, then makes use of Steel ray tracing to supply reflections on metallic surfaces — like those under.

However as fantastically because the app has drawn this scene, there’s nonetheless a limitation: It’s unable to point out reflections inside reflections, just like the mirrored ground reflecting the mirrored sphere.

In equity: It’s arduous to point out mirrors reflecting mirrors! Gentle infinitely bounces between the 2 surfaces, making a scenario that may’t be solved computationally. Ray tracing apps work round this challenge by including a restricted variety of mild (or ray) “bounces” within the scene to supply extra realism.

On this problem, we invite you to increase that ray tracing code and enhance your picture’s realism by including one (or extra) additional ray bounces.

Start the problem

Earlier than getting into this corridor of mirrors, we suggest first watching “Go bindless with Steel 3.” After you watch, obtain the “Rendering reflections in actual time utilizing ray tracing” pattern code — we’ll be utilizing it for this problem.

Go bindless with Steel 3

Study how one can unleash highly effective rendering strategies like ray tracing if you go bindless with Steel 3. We’ll present you make your app’s bindless journey a pleasure by simplifying argument buffers, allocating acceleration constructions from heaps, and benefitting from the enhancements to the…

Rendering reflections in actual time utilizing ray tracing

The app has a devoted compute move that calculates reflections from a skinny G-Buffer containing positions and normals for every pixel within the picture.

The ray tracing shader reads this knowledge and makes use of it with the digicam’s view course to calculate the course of the mirrored rays. It then makes use of Steel to hint these rays, discover intersections, and shade reflections.

raytracing::ray r;
r.origin = positions.learn(tid).xyz;
r.course = normalize(instructions.learn(tid).xyz);
r.min_distance = 0.1;
r.max_distance = FLT_MAX;

raytracing::intersector<raytracing::instancing, raytracing::triangle_data> inter;
inter.assume_geometry_type( raytracing::geometry_type::triangle );
auto intersection = inter.intersect( r, accelerationStructure, 0xFF );
if ( intersection.kind == raytracing::intersection_type::triangle )

This produces the next picture:

However there’s an issue! The hearth vans are lacking from the sphere’s reflection on the ground. We problem you to disclose the lacking vans by modifying the ray tracing shader, rtReflection, so as to add a further ray hint step.

To finish this problem, you’ll:

  1. Use the mirrored regular and intersection place to calculate the subsequent bounce of rays.
  2. Extract the fabric shading logic right into a helper perform that permits you to shade reflections inside the reflections.
  3. Mix all mirrored colours and write them into the outImage.

While you’re performed, use the screenshot instrument, GPU Debugger, or QuickTime to seize your resolution and present us your work by posting it on Twitter with the hashtag #WWDC22Challenges. And for those who’d like to debate bindless ray tracing and different Graphics & Video games matters, be part of the crew at occasions all through the rest of the week at WWDC22.

Discover #WWDC22Challenges on social media

Learn the WWDC22 Challenges Phrases and Situations




Please enter your comment!
Please enter your name here

Most Popular

Recent Comments