Chapter 20 Advanced Lighting - ray tracing hair

Hello Marius Horga and Metal team,

On Chapter 20 - Advanced Lighting , I am trying to load hair curves and test how ray tracing would work with hair.

Appreciate any help you guys can give!

Thanks

happy to send a hair model if that would help!

@alelordelo we haven’t tested such an integration but I suggest watching some of the WWDC session from this and last year. you can get a sense of what is currently possible with this API.

thanks @mhorga!

Yep, I did watch all WWDC ray tracing rated videos, but none show how to load your own OBJ and materials.

How can I do that on your example?

The ray tracing sample code in Chapter 21 shows how to load an obj file, and move the data to different custom buffers.

The code loads positions into a position buffer and normals into a normal buffer. It then goes through the submeshes and creates a color buffer from the submesh color.

thanks @Caroline ; I did manage to load an OBJ into the scene! : )

Does it work to attach PBR textures to check how the ray tracing is performing?
I tried to add an albedo for example using the material slots of the OBJ but didn’t work

also, with the ray tracing render code, is it possible to create photorealistic renders (like Blender Cycles for ex), assuming you have physically accurate materials?

This ray tracing code demonstrates only how to get started with Apple’s intersection buffers and acceleration structures. It doesn’t include texture coordinates.

The code will not give you photorealistic renders. For that, you’ll need to study https://pbr-book.org

An interesting technique introduced in WWDC is hybrid rendering. The videos “Explore hybrid rendering with Metal ray tracing” shows how you can combine rasterisation and ray tracing.