**Writing ray-tracer using Metal Performance Shaders** In this series of posts I'm going to describe ray-tracer implementation using [Metal Performance Shaders](https://developer.apple.com/documentation/metalperformanceshaders). Apple already have [ray-tracing demo](https://developer.apple.com/documentation/metalperformanceshaders/metal_for_accelerating_ray_tracing) but we will start from scratch and implement a more physically correct ray-tracer with next event estimation, multiple importance sampling, spectral rendering and maybe something else :) Before the start ======================================================================================= I'm assuming a reader is familiar with development for macOS (or iOS), so I will skip trivial things like creating a project, using Objective-C, etc. But make sure you have at least: - macOS Mojave (10.14) or later - Xcode 10 or later These could be either downloaded from [Apple's developer web-site](http://developer.apple.com/download/) or updated via macOS App Store as soon as Apple release them. Also **I'm strongly advising you** to read some very useful books and resource on ray-tracing and computer graphics: - [Physically Based Rendering](https://pbrt.org), which recently become [available online](http://www.pbr-book.org/3ed-2018/contents.html) for free - [Ray Tracing in One Weekend series](http://in1weekend.blogspot.com/2016/01/ray-tracing-in-one-weekend.html) - [The Graphics Codex](http://graphicscodex.com) In our ray-tracer demo project we will be using third-party **libraries**: - [tinyobjloader](https://github.com/syoyo/tinyobjloader) - [tinyexr](https://github.com/syoyo/tinyexr) They will be added to the [source code](https://github.com/sergeyreznik/metal-ray-tracer/) for this blog post series as submodules. Tracing our first triangle ======================================================================================= In [this post](part-1/index.html) I will describe how to setup an environment for our ray-tracer and trace one hard-coded triangle. Tracing some geometry ================================================================================ In [this post](part-2/index.html) we will load and trace geometry from a file, prepare an environment for path tracing, and implement simple diffuse BRDF with next event estimation. Extending the ray-tracer ======================================================================================= Adding multiple bounces -------------------------------------------------------------------------------- In [this post](part-3-1/index.html) we will add multiple light bounces to our ray-tracer. Improving material system and adding multiple importance sampling -------------------------------------------------------------------------------- In [this post](part-3-2/index.html) we will rewrite our material system to be able to extend ray-tracer with new materials. Also we will implement multiple importance sampling. Going slightly physically based ======================================================================================= In [this post](part-4/index.html) we going to make several steps towards physically-correct rendering. We going to add two more BSDFs, validate BSDFs and rewrite our ray-tracer to have potentially infinite number of bounces.