A collection of various experiments with Metal on Apple platforms. Inspired by sample-metal.
Available projects:
- Install mise package manager.
curl https://mise.run | sh
- Edit
mise.tomlconfiguration to run local development on device.
[env]
TUIST_DEVELOPMENT_TEAM = '<development team id>'
TUIST_BUNDLE_ID_PREFIX = '<project prefix>'
[tools]
tuist = "latest"
- Install tuist build tool.
mise install tuist
- Install project dependencies.
mise exec -- tuist install
- Generate workspace.
mise exec -- tuist generate
If need to edit the workspace configuration
mise exec -- tuist edit
A series of 2D/3D experiments in Metal, where I gradually explore various aspects of graphics programming. Listed from basics to beyond (in progress).
Experiment: Basic Triangle Rendering
Description: Render a single colored triangle, introduce the Metal render pipeline, vertex buffers, and per-vertex color interpolation.
Experiment: Animated Gradient Quad
Description: Render a rectangle with a gradient computed from UV coordinates, and animate its color over time using uniforms.
Experiment: Wireframe Rendering
Description: Render mesh wireframes without geometry shaders, using barycentric coordinates to highlight triangle edges and visualize mesh topology.
Experiment: Procedural Checkerboard
Description: Generate and render a checkerboard pattern procedurally in the fragment shader, reinforcing mathematical texture coordinate manipulation.
Experiment: Flip Book Animation
Description: Render animated sequences using flipbook-style texture atlases, showcasing sprite animation techniques in Metal.
Experiment: Model-View-Projection (MVP) Matrices
Description: Demonstrate how MVP matrices transform vertices from model space to screen space, visualizing the 3D transformation pipeline.
Experiment: Basic 3D Rendering
Description: Render a colored 3D cube, animate its rotation, and introduce perspective projection and camera setup.
Experiment: UV Mapping
Description: Illustrate how 2D texture coordinates map to 3D geometry, including texture wrapping, tiling, and basic procedural textures.
Experiment: 3D Model Loading
Description: Load and display external 3D models (e.g., OBJ files), demonstrating parsing, GPU uploads, and real-time rendering in Metal.
Experiment: Camera Manipulation
Description: Control and visualize camera orientation using yaw, pitch, and roll parameters, and observe their effects on 3D scene navigation.
Experiment: Quaternion vs. Euler Rotations
Description: Compare and animate between quaternion-based and Euler angle-based rotations, showing their behavior and differences in 3D transformations.
Experiment: Instanced Rotations
Description: Display multiple objects with independent rotations, utilizing instancing and quaternion math to efficiently render and animate many objects in a scene.
Experiment: Physically-Based Shading
Description: Explore different shading models and light interactions, supporting dynamic lighting and material properties using Metal shading language.