This post explores a little-known feature of alpha blending in Metal: dual-source blending. We’ll start with a quick overview of blending, then look at why dual-source blending exists and how it works. We’ll use it to make an sRGB-agnostic GUI system compatible with sRGB render targets, then refine the approach with programmable blending. The Alpha […]
Category: Intermediate
Slug
I expected to have to wait 12 more years to write this post. Back in 2017, Eric Lengyel published the landmark paper, “GPU-Centered Font Rendering Directly from Glyph Outlines” in the Journal of Computer Graphics Techniques. This paper introduced the Slug algorithm, a way of efficiently rasterizing text on the GPU without first rasterizing to […]
Getting Started with Metal 4
Another WWDC is in the books, and with it came a major update to many platform technologies, including Metal. Metal graduated to version number 4, and in this article, we’ll explore the core features of Metal 4 as they pertain to rendering. It’s important to state up-front that this article will not cover Metal 4 […]
Introduction to Tessellation in Metal
In this article we will take a look at how to do tessellation on the GPU with Metal. Tessellation is a powerful technique for generating geometry dynamically with many use cases from CAD/CAM to game development and beyond. This article discusses the fundamentals of tessellation and how to do it in Metal; future articles will […]
WebGPU for Metal Developers, Part Two
In the previous article we took a first look at WebGPU and got familiar with the essential pieces of the API, the command submission model, and drawing in 2D from a static buffer. In this article, we’ll look much deeper into WebGPU. Some of our topics include: texture creation and sampling displacement mapping in WGSL […]
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 […]
Picking and Hit-Testing in Metal
In this article, we’ll see how to interact with our 3D scenes using a technique called picking. Picking helps us answer the question “What did the user just tap on?” More precisely, picking is the process of determining which object or objects in our scene are being indicated by an interaction like a mouse click […]
Rendering 3D Text with Core Text and libtess2
In this article, we’ll discuss how to create and render 3D text with Metal. Most applications need to render text, and there are many techniques for drawing 2D text with graphics APIs, from pre-rasterized font atlases, to signed-distance field methods like Chris Green’s seminal work at Valve or GLyphy, to cutting-edge vector-based solutions like Slug. […]
Writing a Modern Metal App from Scratch: Part 2
In the previous article, we wrote enough Metal code to get the spinning silhouette of a teapot on the screen, but that still leaves a lot to be desired as far as a “modern” app is concerned. In this article, we’ll further flesh out the app and introduce lighting, materials, texturing, and managing multiple objects […]
Compressed Texture Formats in Metal
In this article, we will consider several GPU-friendly compressed texture formats. These formats allow us to trade some image quality for substantial improvements in disk usage and performance. In particular, we will look at the ETC2, PVRTC, and ASTC formats.