Categories
Uncategorized

Raytracing with Metal

This is going to be a really short post because of two reasons:

  1. This concept is explained by Apple really well in this documentation page. All I did was to port their code from Objective-C to Swift since I have not seen a Swift version to date.
  2. My book, Metal by Tutorials, will have an entire chapter dedicated to the Metal Performance Shaders framework and raytracing.

In a nutshell, the Metal Performance Shaders framework now has a high performance intersector that helps speeding up ray-triangle intersections using an acceleration structure that contains all the vertices in the scene necessary for calculating intersections.

This project is only capable of rendering planes and boxes but in Metal by Tutorials you will be learning about how to render any shape or volume because you will be using a model loader.

If you build and run the project you should be able to see something similar:

alt text

The source code is posted on Github as usual.

Until next time!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s