Awesome
Methane Kit <img src="https://github.com/MethanePowered/MethaneKit/blob/master/Docs/Images/Logo/MethaneLogoNameSmall.png" width=200 align="right" valign="middle">
Easy to use modern 3D graphics rendering abstraction API and cross-platform application framework:
- Builds on top of modern native 3D graphics APIs: DirectX 12 on Windows, Vulkan on Linux, Metal on MacOS, iOS & tvOS.
- Simplifies modern graphics programming with object-oriented medium-level graphics API inspired by simplicity of Apple Metal. Common shaders code in HLSL 6 is used on all platforms.
- Provides cross-platform application framework with CMake build toolchain, platform-independent application foundation classes and native-GUI layer for Windows, Linux and MacOS.
Download release builds with pre-built samples, tutorials and tests to try them out. Check latest build status, tests, code coverage and analysis results or get build artifacts from GitHub Actions CI and Sonar Cloud. See Build Instructions topic for manual build instructions and start learning Methane Graphics RHI API with Hello Triangle and other tutorials' documentation.
Static code analysis scans are performed as a part of automated CI build process on master and develop branches with up-to-date results published on Sonar Cloud.
Build Instructions
- Prerequisites
- Fetch Sources
- First time initialization
- Update sources to latest revision
- Building from Sources
- CMake Generator
Getting Started
High-Level Architecture
Methane Kit architecture is clearly distributing library modules between 5 layers from low to high level of abstraction.
Rendering Hardware Interface (RHI)
Methane Graphics RHI module implements a set of public object-oriented interfaces,
which make modern graphics programming easy and convenient in a platform and API independent way.
Tutorials
Start learning Methane Graphics API with Hello Triangle tutorial documentation and continue with others.
<pre><b>Name / Link</b></pre> | <pre><b>Screenshot</b></pre> | <pre><b>Description</b> </pre> |
---|---|---|
1. Hello Triangle | ![]() | Colored triangle rendering in 100 lines of code. |
2. Hello Cube | ![]() | Colored cube rendering in 200 lines of code with vertex and index buffers. |
3. Textured Cube | ![]() | Textured cube introduces buffers, textures and samplers usage with Phong shading. |
4. Shadow Cube | ![]() | Shadow cube introduces multi-pass rendering with render passes. |
5. Typography | ![]() | Typography demonstrates animated text rendering with dynamic font atlas updates using Methane UI. |
6. Cube-Map Array | ![]() | Cube-map array texturing along with sky-box rendering. |
7. Parallel Rendering | ![]() | Parallel rendering of the textured cube instances to the single render pass. |
8. Console Compute | ![]() | Conway's Game of Life implemented in Compute Shader and running in pure console application. |
Samples
Methane samples demonstrate advanced techniques and usage scenarios with more complex implementation than tutorials above. Samples are distributes in form of separate repositories.
<pre><b>Name / Link</b></pre> | <pre><b>Screenshot</b></pre> | <pre><b>Description</b> </pre> |
---|---|---|
Asteroids | ![]() | Benchmark demonstrating parallel render commands encoding in a single render pass for the large number of heterogeneous asteroid objects processed in multiple threads. |
Features
- Cross-platform application & input classes: Windows, MacOS and Linux are supported
- CMake modules for convenient application build configuration, adding shaders and embedded resources
- HLSL-6 Shaders serving all graphics APIs converted to native shader language and compiled in build time with SPIRV-Cross & DirectXCompiler
- HLSL++ Math library with HLSL-like syntax in C++ and vector-instruction optimizations for different platforms
- Modern Graphics API abstractions: based on DirectX 12, Vulkan and Metal APIs
- Render state and program configuration with compact initialization syntax
- Program binding objects implement efficient binding of shader arguments to resources
- Automatic resource state tracking used for automatic resource transition barriers setup
- Resources are automatically retained from destroying while in use on GPU with shared pointers in command list state
- Command list execution state tracking with optional GPU timestamps query on completion
- Parallel render command list for multi-threaded render commands encoding in single render pass
- Multiple command queues execution on GPU with synchronization using fences
- Private GPU resources asynchronously updated through the upload command list and shared resource
- Registry of named graphics objects enabling reuse of render states and graphics resources between renderer objects
- Graphics primitives and extensions:
- Graphics application base class with per-frame resource management and frame buffers resizing enable effective triple buffering
- Camera primitive and interactive arc-ball camera
- Procedural mesh generation for quad, box, sphere, icosahedron and uber-mesh
- Screen-quad and sky-box rendering extension classes
- Texture loader (currently implemented with STB, planned for replacement with OpenImageIO)
- User Interface:
- UI application base class with integrated HUD, logo badge and help/parameters text panels
- Typography library for fonts loading, dynamic atlas updating, text rendering & layout
- Widgets library (under development)
- Platform Infrastructure:
- Base application with window management and input handling for Windows, MacOS and Linux
- Events mechanism connecting emitters and receivers via callback interfaces
- Animations subsystem
- Embedded resource providers
- Integrated debugging and profiling capabilities:
- Library instrumentation for performance analysis with trace profiling tools
- Debug names for all GPU objects and debug regions for graphics API calls for use with frame profiling tools
- Continuous integration with automated multi-platform builds, unit-tests and Sonar Cloud static code analysis in GitHub Actions
For detailed features description and development plans please refer to Modules documentation.
Supported Development Tools
Development Environments
<a href="https://www.jetbrains.com/?from=MethaneKit" target="_blank"><img src="https://github.com/MethanePowered/MethaneKit/blob/master/Docs/Partners/JetBrains.png" width=200 align="right" valign="bottom"/></a>
- Microsoft Visual Studio 2019
- Solutions and projects build (generate with Build/Windows/Build.bat)
- CMake native build support (pre-configured with CMakePresets.json)
- Apple XCode
- XCode workspace and projects (generate with Build/Unix/Build.sh)
- Microsoft VS Code and GitPod (pre-configured with CMakePresets.json and .vscode/settings.json)
- Jet Brains CLion (pre-configured with .idea)
- Qt Creator with CMake native support
Methane Kit is being developed with support of Jet Brains development tools. Open source project development license is provided free of charge to all key contributors of Methane Kit project.
Static Code Analysis
Methane Kit comes with continuous C++ static code and code coverage analysis performed as a part of automated CI "Scan" builds with up-to-date results published on Sonar Cloud separately for all supported platforms.
Master Scan Results | Windows | MacOS | Linux |
---|---|---|---|
Scan Build Status | |||
Quality Gate | |||
Maintainability | |||
Reliability | |||
Security | |||
Technical Debt | |||
Bugs | |||
Vulnerabilities | |||
Code Smells | |||
Duplicated Lines | |||
Tests Coverage | |||
Lines of Code |
Trace Profiling Tools
Methane Kit contains integrated instrumentation of all libraries for performance analysis with trace collection using following tools. Please refer to Methane Instrumentation document for more details on trace collection instructions and related build options.
Tracy Frame Profiler | Intel Graphics Trace Analyzer |
---|---|
![]() | ![]() |
Frame Profiling and Debugging Tools
- Intel Graphics Frame Analyzer
- Apple XCode Metal Debugger
- RenderDoc
- Microsoft PIX
- NVidia Nsight Graphics
External Dependencies
License
Methane Kit is distributed under Apache 2.0 License: it is free to use and open for contributions!