Skip to content

Fe0437/MetalTutorials

Repository files navigation

🤟 MetalTutorials 🎸

Welcome to MetalTutorials, a step-by-step guide designed to assist you in creating your own Metal Renderer. The main objectives of these tutorials are:

  • minimal code
  • minimal additions in each tutorial

This approach helps the reader understand the changes as we progress in building the engine.

External Links 🌎

Metal : https://developer.apple.com/metal/

Getting Started 🏁

Clone this repository and open the project in Xcode. Each tutorial is structured to build upon the last, starting with the fundamentals and gradually introducing more sophisticated rendering techniques.

Open the file MTMetalTuorialsApp.swift you will find :

@main
struct MetalTutorialsApp: App {
    var body: some Scene {
        WindowGroup {
            // substitute here to choose the tutorial
            MT1ContentView()
        }
    }
}

Each tutorial has its own ContentView, named MT[tutorial-number]ContentView. To test a specific tutorial, simply replace the number (e.g., MT1ContentView -> MT2ContentView).

Every tutorial is self-contained, allowing you to make modifications without affecting other tutorials.

Tutorials Overview 👈

  • Tutorial 1 - Hello

Begin your Metal journey by rendering a simple triangle. This tutorial lays the foundation, introducing the basic setup required to render your first Metal frame.

image
  • Tutorial 2 - Sample Object

Advance to loading and rendering a 3D object (.obj) with a basic point light, building upon the skills acquired in Tutorial 1.

Bunny Obj Sample

  • Tutorial 3 - Deferred Rendering

Learn about deferred rendering techniques. Introduced also camera movement with SwiftUI.

Bunny Deferred image

  • Tutorial 4 - Shadow Mapping

Explore shadow rendering using shadow maps.

Screen Recording 2024-03-26 at 08 50 16

  • Tutorial 5 - Tiled Rendering

Metal Tiled Rendering. Avoid to store GBuffer textures.

image
  • Tutorial 6 - GPU Rendering

GPU based rendering pipeline. Indirect Command buffers, Argument Buffers, GPU Heap for textures and USDZ loading.

Screen Recording 2024-03-26 at 08 56 59 image

Contributing 🖋️

Contributions to MetalTutorials are welcome! Whether it's submitting bug reports, feature requests, or code contributions, your input is valuable.

Commit messages follow the gitmoji convention.

Contact 📞

For any questions or feedback regarding MetalTutorials, feel free to open an issue in this repository or contact me directly.

I'm always open to networking opportunities and collaborations. Feel free to reach out to me! 🍻

About

Metal Tutorials, learn to create a SwiftUI modern photorealistic renderer

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published