This week I’ve been playing with the idea of a declarative API for scene graph construction in Swift. Kinda like RealityKit if it looked a little bit more like SwiftUI. I was spurred to try this by Christian Tietze’s call for submissions to Swift Blog Carnival. The theme this month is Tiny Languages, and it […]
Category: Basics
A Decade of Metal: The Early Years (2014–2019)
Introduction In 2014, when Apple introduced the Metal graphics API, the landscape of computer graphics APIs was dominated by long-established standards like OpenGL. Seismic shifts were afoot, however, with the announcement of DirectX 12 a few months prior and the initiative that would produce Vulkan starting to take shape. These parallel efforts signaled a significant […]
WebGPU for Metal Developers, Part One
Doing high-performance 3D rendering on the Web has always been a tricky proposition. WebGL, in its quest for programmer familiarity and cross-platform ubiquity, adopted the API of OpenGL ES. As such it has never been capable of exploiting the full power of the underlying GPU, even as desktop APIs like DirectX 12, Metal, and Vulkan […]
What’s New in Metal (2019)
With WWDC 2019 over, it’s a good time to reflect on everything that was announced and start seeing how we can put it into practice. The purpose of this article is to round up the changes to the Metal framework and tools and provide pointers to where you can learn more. This was a banner […]
Vertex Data and Vertex Descriptors
The purpose of this article is to describe and explore a foundational concept in Metal: vertex descriptors. Vertex descriptors are the glue between your application code (written in Objective-C or Swift) and your shader functions (written in the Metal Shading Language). They describe the shape of data consumed by your shaders. When I was writing […]
Writing a Modern Metal App from Scratch: Part 1
Getting Started This article is a quick introduction to how to use the Metal, MetalKit, and Model I/O frameworks in Swift. If you know your way around UIKit or Cocoa development, you should be able to follow along for the most part. Some things like shaders and matrices will be foreign to you, but you […]
First Look at MetalKit
MetalKit is a forthcoming framework on iOS 9 and OS X El Capitan that greatly eases certain tasks such as presenting Metal content in a UIView or NSView, texture loading, and working with model data. This post is an overview of the features offered by MetalKit. Many of our articles so far have focused on […]
Video: An Introduction to 3D Graphics with Metal in Swift
In November 2014, I was privileged to deliver a talk to San Francisco’s Swift Language User Group, hosted by Realm. They’ve now uploaded the video, with subtitles and synchronized slide deck to their site. You can view the video here.
Mipmapping and the Blit Command Encoder
In this article we will learn about mipmapping, an important technique for rendering textured objects at a distance. We will find out why mipmapping is important, how it complements regular texture filtering, and how to use the blit command encoder to generate mipmaps efficiently on the GPU.
Textures and Samplers in Metal
Textures are a central topic in rendering. Although they have many uses, one of their primary purposes is to provide a greater level of detail to surfaces than can be achieved with vertex colors alone. In this post, we’ll talk about texture mapping, which helps us bring virtual characters to life. We’ll also introduce samplers, […]