Happy Monday – it’s another iOS 12 Launch Party book release!
Today, we’re excited to announce that Metal by Tutorials is now out in full release and available today! This book teaches you how to build your own game engine in Metal, Apple’s GPU programming framework in the trusted “tutorials” style you’ve come to love.
Read on to see what’s inside Metal by Tutorials, and how to take advantage of the launch and bundle discounts this season!
About Metal by Tutorials
Metal is a unified application programming interface (API) for the graphics processing unit, or GPU. It’s unified because it applies to both 3D graphics and data-parallel computation paradigms. Metal is a low-level API because it provides programmers near-direct access to the GPU. Finally, Metal is a low-overhead API because it reduces the central processing unit (CPU) cost by multithreading and pre-compiling of resources.
But beyond the technical definition, Metal is the most appropriate way to use the GPU’s parallel processing power to visualize data or solve numerical challenges. It’s also tailored to be used for machine learning, image/video processing or, as this book describes, graphics rendering.
This book will introduce you to low-level graphics programming in Metal — Apple’s framework for programming on the graphics processing unit (GPU). As you progress through this book, you’ll learn many of the fundamentals that go into making a game engine and gradually put together your own engine. Once your game engine is complete, you’ll be able to put together 3D scenes and program your own simple 3D games. Because you’ll have built your 3D game engine from scratch, you’ll be able to customize every aspect of what you see on your screen.
This book is for intermediate Swift developers interested in learning 3D graphics or gaining a deeper understanding of how game engines work.
About Metal 2
We’re tremendously excited about the new features in Metal 2, and, of course, we have covered all of the best features of Metal 2:
- Ray tracing using Metal Performance Shaders: Ray tracing is far more accurate than rasterization, and real-time ray tracing is the ultimate goal of rendering. Ray tracing is traditionally performed on the CPU, but using Metal Performance Shaders, you’ll be able parallelize it on the GPU. If you have multiple external GPUs, you’ll be able to achieve phenomenal performance.
- GPU-Driven Command Encoding: You can now encode your commands on the GPU rather than the CPU, using a compute shader.
New GPU Debugging Tools: These look simply magnificent! The dependency viewer visualizes all your render passes and combines them into a beautifully rendered flowchart. The interactive shader debugger lets you examine your pixels as you step through your shader functions and change your shader output on the fly.
Vertices haven’t been forgotten — you can inspect them with the new geometry viewer. This has a free-fly camera so that you can investigate issues outside your camera frame. If you have an iPhone X or newer, you’ll be able to use the A11 shader profiler to see how long each statement in your shaders takes to execute. Apple have really worked hard on these and other GPU profiling tools!
What’s Inside Metal by Tutorials?
Here’s the complete view of what’s contained in this book:
- Introduction to Metal: Learn about Metal, why you would use it over other graphics frameworks, and get a quick start by rendering your first primitive object!
- 3D Models: Go into depth with 3D models, render them on the screen, and learn how to work with models in Blender.
- The Rendering Pipeline: To this point, you’ve been working in playgrounds. You’ll go further with Metal by creating a macOS app from scratch, wherein you’ll learn how the rendering pipeline works to create the graphics on screen.
- Coordinate Spaces: We’d all love to be math geniuses, but some of us lost the opportunity early in life. Fortunately, to use math, you don’t always have to know exactly what’s under the hood. In this chapter, you’re going to become a matrix master and you will learn what matrices can do for you and how to manipulate them painlessly.
- Lighting Fundamentals: Lighting and beyond! In this chapter, you’ll learn basic lighting; more importantly, you’ll learn how to craft data in shaders, and be on the path to mastering shader artistry. Lighting, shadows, non-photorealistic rendering — these are all techniques that start with the methods that you’ll learn in this chapter.
- Textures & Samplers: Now that you have light in your scene, the next step is to add color to it. In this chapter you’ll learn about UV coordinates, texturing a model, samplers, mipmaps, and the asset catalog.
- Maps & Materials: This is the final chapter on how to render still models. In the previous chapter, you rendered a simple house with a single color texture imported using Model I/O. In this chapter you’ll find out how to use material groups to describe a surface, and how to design textures for micro detail.
- Character Animation: Rendering still models is a great achievement, but rendering models that move is even more fun. So far your models have been simple inanimate props. You’ll now render characters with body movement and give them personality. In this chapter, you’ll start off by bouncing a ball, and then move on to rendering a friendly skeleton.
- Scene Graph: In this chapter you’ll take your rendering engine and put together a simple game engine by abstracting the rendering code away from scene management. This takes you to the next level where you can start creating your own games.
- Fragment Post-Processing: Before embarking on huge features such as tessellation and instancing, you’ll learn some simple techniques to improve your render quality. A series of operations run on the GPU after the fragments have been processed in the pipeline, including alpha testing, depth testing, stencil testing, scissor testing, blending, and anti-aliasing. You’ll touch on most of these operations in this chapter.
- Tessellation & Terrains: So far, you’ve used normal map trickery in the fragment function to show the fine details of your low poly models. To achieve a similar level of detail without using normal maps requires a change of model geometry by adding more vertices, which can problematically choke up the pipeline. In this chapter, you’re going to create a detailed terrain using a small number of points. You’ll send a flat ground plane with a grayscale texture describing the height, and the tessellator will create as many vertices as needed.
- Environment: Learn about skyboxes, cube maps, image-based lighting and more as you add some surrounding features to your virtual environment.
- Instancing & Procedural Generation: Many of the best features in games aren’t coded manually; they’re procedurally generated instead. Learn how to generate vertices for grass, how constant and argument buffers work, how to use L-system trees, and then add the grass and random trees to your scene.
- Multipass & Deferred Rendering: Up to this point, you have been running projects and playgrounds that only had one pass. In other words, you used just one render command encoder to submit all your draw calls to the GPU. In more complex apps, you would often need the result of one pass used in a following pass before presenting the texture to the screen. Sometimes you need to render content off-screen and use it in subsequent stages of your app. When you finish this chapter, you will be able to render a scene with shadows and multiple lights.
- Performance Optimization: To finish off this section, you’ll learn about triple buffering, how to manage resource contention, CPU-GPU synchronization, how to achieve multithreaded encoding, and how to use the GPU profiler.
- Particle Systems: Learn about generators, emitters, particle life, the compute kernel, and more.
- Particle Behavior: You’ve learned how to create particles, now see how to control their behavior with forces, swarming and flocking behavior, predator-prey behavior, and crowd behavior.
- Rendering with Rays: This chapter covers all you’ll need to know on how to do detailed ray tracing, ray casting, path tracing and ray marching.
- Advanced Shadows: Learn about hard and soft shadows, ambient occlusion, screen space rendering and more.
- Advanced Lighting: Get incredibly detailed with the lighting effects in your scene. Learn about the rendering equation, reflection and refraction, the Fresnel effect, lens flare, subsurface scattering and more lighting details!
- Metal Performance Shaders: MPS consists of low-level, fine-tuned, high-performance kernels that run off the shelf with minimal configuration. The MPS kernels make use of data-parallel primitives that are written in such a way that they can take advantage of each GPU family’s characteristics. In this chapter, you’ll dive a bit deeper into the world of MPS.
- Integrating with SpriteKit & SceneKit: Bring all you’ve learned together and learn how to integrate your game engine with SceneKit and SpriteKit. You’ll learn how to import Metal shaders, perform toon rendering, and more.
By the end of this book, you’ll have created your own high-performance game engine in Metal that you can use in your own projects!
About the Authors
Caroline Begbie is an indie iOS developer. When she’s not developing, she’s playing around with 2D and 3D animation software, or learning Arduino and electronics. She has previously taught the elderly how to use their computers, done marionette shows for pre-schools, and created accounting and stock control systems for mining companies.
Marius Horga is an iOS developer and Metal API blogger. He is also a computer scientist. He has more than a decade of experience with systems, support, integration and development. You can often see him on Twitter talking about Metal, GPGPU, games and 3D graphics. When he’s away from computers, he enjoys music, biking or stargazing.
Also Available: the iOS 12 Launch Bundle
So many of you have asked for a book bundle to go with the iOS 12 update season, and we’re happy to announce the release of the iOS 12 Launch Party Bundle!
This three-book bundle contains our newest iOS 12 books:
This bundle is on sale for only $99.99 — that’s a savings of 33%! But don’t wait, since this bundle won’t be available forever.
Enter the iOS 12 Launch Party Giveaway
Speaking of sweet deals, be sure to check out the great prizes we’re giving away this year with the iOS 12 Launch Party, including over $9,000 in giveaways!
To be eligible for for this epic iOS 12 giveaway, all you have to do is leave a comment on the original launch post, letting us know which book or course is your favorite on this list — or which upcoming book or course you’re most excited about!
Where to Go From Here?
Metal by Tutorials is available today, in full release.
- If you’ve already bought Metal by Tutorials digital edition, you can log in to the store and download the updated version here.
- If you haven’t already bought this must-have addition to your development library, head over to our store page to grab your copy today for our special launch discount of just $44.99!
We hope you enjoy this newest book, on one of our most popular tutorial topics. Stay tuned for more upcoming book lauches this iOS 12 season!