T.TAO
Back to Blog
Graphics Engine/22 parts

Metal

Building a renderer on Apple's Metal API, one stage at a time: from the first MTKView to deferred shading, tessellation and hardware ray tracing.

  1. 01Metal #0 Swift ReviewThe Swift you need before the first triangle: declarations, optionals, closures, protocols and the value/reference split.2024-04-29 · 3 min read
  2. 02Metal #1 InitializationThe smallest complete Metal application: MTKView, device, command queue, and the four steps every Metal frame goes through.2024-04-30 · 6 min read
  3. 03Metal #2 Rendering PipelinePipeline state, vertex descriptors and the render command encoder — how geometry actually reaches the screen in Metal.2024-05-11 · 10 min read
  4. 04Metal #3 Vertex FunctionThe vertex function: vertex descriptors, attribute binding, the three ways to pass uniforms, and why the MVP transform belongs here.2024-05-18 · 5 min read
  5. 05Metal #4 Fragment FunctionThe fragment function: interpolation qualifiers, depth and blending, multiple render targets, and why the quad is the GPU's real unit of work.2024-05-25 · 5 min read
  6. 06Metal #5 TextureTextures: loading and pixel formats, samplers and address modes, mipmaps and anisotropy, and why sRGB has to be left to the hardware.2024-06-01 · 5 min read
  7. 07Metal #6 NavigationCameras and interaction: what the view matrix really is, perspective versus orthographic, Metal's [0,1] depth convention, and a usable orbit camera.2024-06-15 · 6 min read
  8. 08Metal #7 LightingLighting: Phong and Blinn-Phong, the three light types, attenuation models, and where the multi-light loop should live.2024-06-29 · 5 min read
  9. 09Metal #8 MaterialsMaterials: from Phong parameters to the metallic-roughness PBR workflow, normal maps and TBN, and what each Cook-Torrance term computes.2024-07-13 · 6 min read
  10. 10Metal #9 Render PassesRender passes: why load and store actions are the most important switches on a TBDR GPU, offscreen targets, MTLHeap, and how a frame is organized.2024-07-27 · 6 min read
  11. 11Metal #10 ShadowShadow mapping: the depth pass, the shadow matrix, where acne and Peter Panning come from and how to fix them, PCF and cascades.2024-08-10 · 6 min read
  12. 12Metal #11 Deferred RenderingDeferred rendering: laying out and compressing the G-Buffer, the lighting pass, and single-pass deferred using tile memory on Apple Silicon.2024-08-24 · 6 min read
  13. 13Metal #12 Particle SystemParticle systems: simulating in a compute shader, emission and recycling on the GPU, instanced rendering, and the sorting problem.2024-09-07 · 6 min read
  14. 14Metal #13 TessellationTessellation: Metal's unusual compute-driven factor stage, displacement mapping and terrain LOD, and where cracks come from.2024-09-21 · 5 min read
  15. 15Metal #14 Post-processingPost-processing: HDR and tone mapping, bloom, SSAO sampling strategy, and why the post chain should be compute rather than fullscreen triangles.2024-10-12 · 6 min read
  16. 16Metal #15 Reflection and RefractionReflection and refraction: cube maps and IBL, planar reflections, how screen-space reflection works and how it necessarily fails, refraction and dispersion.2024-10-26 · 6 min read
  17. 17Metal #16 AnimationAnimation: interpolating transforms with quaternions, the skinning matrix palette, two ways to skin on the GPU, and when keyframes belong in compute.2024-11-09 · 6 min read
  18. 18Metal #17 Ray Tracing (I) Rendering AlgorithmRay tracing part one: the rendering equation, Monte Carlo estimation and importance sampling, plus Metal's acceleration structures and intersector API.2024-11-23 · 5 min read
  19. 19Metal #18 Ray Tracing (II) Shadows and LightingRay tracing part two: shadow rays and soft shadows, next event estimation, the path tracing loop and Russian roulette, and hybrid pipelines.2024-12-07 · 6 min read
  20. 20Metal #19 Ray Tracing (III) Performance OptimizationRay tracing part three: ray divergence and wavefront reordering, acceleration structure build strategy, sampling sequences, and finding the bottleneck with a GPU capture.2024-12-21 · 6 min read
  21. 21Metal #21 [Appendix] Compute ShadersUsing the GPU for work that is not drawing: kernel functions, threadgroups, and how to size a dispatch correctly.2024-09-14 · 4 min read
  22. 22Metal #22 [Appendix] Metal in SwiftUISwiftUI's shader modifiers let Metal Shading Language reach ordinary views. How the bridge works, and where it stops.2024-09-30 · 9 min read