Git Product home page Git Product logo

methanepowered / methanekit Goto Github PK

View Code? Open in Web Editor NEW
761.0 16.0 44.0 53.48 MB

๐ŸŽฒ Modern 3D graphics made simple with C++17 cross-platform framework and rendering abstraction API on top of DirectX 12, Metal & Vulkan

License: Apache License 2.0

CMake 4.27% C++ 85.10% HLSL 0.67% Shell 0.56% Batchfile 0.27% C 0.50% Objective-C++ 8.57% PowerShell 0.04% Dockerfile 0.02%
graphics d3d12 metal cross-platform gamedev vulkan hlsl graphics-engine graphics-programming graphics-library

methanekit's Introduction

Methane Kit

CI Build CI CodeQL Scan CI Sonar Scan Quality Gate Status CodeCov Test Space Metric Gitpod Ready-to-Code

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.

Open in Gitpod

Platform Graphics API Master Build Develop Build
Windows x64 DirectX 12 Windows x64 Master Build Windows x64 Develop Build
Windows x86 DirectX 12 Windows x86 Master Build Windows x86 Develop Build
Windows x64 Vulkan Windows x64 Master Build Windows x64 Develop Build
Windows x86 Vulkan Windows x86 Master Build Windows x86 Develop Build
Linux Vulkan Ubuntu Master Build Ubuntu Develop Build
MacOS Vulkan MacOS Master Build MacOS Develop Build
MacOS Metal MacOS Master Build MacOS Develop Build
iOS (Sim) Metal iOS Master Build iOS Develop Build
tvOS (Sim) Metal tvOS Master Build tvOS Develop Build

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.

Platform Sonar Quality Gate Master Scan Status Develop Scan Status
Windows DirectX Windows Quality Gate Status Windows Master Scan Status Windows Develop Scan Status
Linux Vulkan Linux Quality Gate Status Linux Master Scan Status Linux Develop Scan Status
MacOS Metal MacOS Quality Gate Status MacOS Master Scan Status MacOS Develop Scan Status

Windows Maintainability Rating Windows Reliability Rating Windows Security Rating Windows Code Smells Windows Duplicated Lines (%) Windows Coverage Windows Lines of Code

Asteroids Sample on Windows

Asteroids sample demonstrating multi-threaded rendering with Methane Kit

Getting Started

High-Level Architecture

Methane Kit architecture is clearly distributing library modules between 5 layers from low to high level of abstraction. High Level Architecture

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. Graphics RHI

Tutorials

Start learning Methane Graphics API with Hello Triangle tutorial documentation and continue with others.

Name / Link
Screenshot
Description                                         
1. Hello Triangle Hello Triangle on Windows Colored triangle rendering in 100 lines of code.
2. Hello Cube Hello Cube on Windows Colored cube rendering in 200 lines of code with vertex and index buffers.
3. Textured Cube Textured Cube on Windows Textured cube introduces buffers, textures and samplers usage with Phong shading.
4. Shadow Cube Shadow Cube on Windows Shadow cube introduces multi-pass rendering with render passes.
5. Typography Typography on Windows Typography demonstrates animated text rendering with dynamic font atlas updates using Methane UI.
6. Cube-Map Array Cube-Map Array on Windows Cube-map array texturing along with sky-box rendering.
7. Parallel Rendering Parallel Rendering on Windows Parallel rendering of the textured cube instances to the single render pass.
8. Console Compute Console Compute on Windows 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.

Name / Link
Screenshot
Description                                         
Asteroids Asteroids on Windows 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:
  • 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

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 Windows Master Scan Status MacOS Master Scan Status Linux Master Scan Status
Quality Gate Windows Quality Gate Status MacOS Quality Gate Status Linux Quality Gate Status
Maintainability Windows Maintainability Rating MacOS Maintainability Rating Linux Maintainability Rating
Reliability Windows Reliability Rating MacOS Reliability Rating Linux Reliability Rating
Security Windows Security Rating MacOS Security Rating Linux Security Rating
Technical Debt Windows Technical Debt MacOS Technical Debt Linux Technical Debt
Bugs Windows Bugs MacOS Bugs Linux Bugs
Vulnerabilities Windows Vulnerabilities MacOS Vulnerabilities Linux Vulnerabilities
Code Smells Windows Code Smells MacOS Code Smells Linux Code Smells
Duplicated Lines Windows Duplicated Lines (%) MacOS Duplicated Lines (%) Linux Duplicated Lines (%)
Tests Coverage Windows Coverage MacOS Coverage Linux Coverage
Lines of Code Windows Lines of Code MacOS Lines of Code Linux 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
Asteroids Trace in Tracy Asteroids Trace in GPA Trace Analyzer

Frame Profiling and Debugging Tools

License

Methane Kit is distributed under Apache 2.0 License: it is free to use and open for contributions!

Copyright 2019-2022 ยฉ Evgeny Gorodetskiy Follow

methanekit's People

Contributors

egorodet avatar gukazma avatar mpaladin avatar sisakat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

methanekit's Issues

Sky-box rendering primitive

Add Sky-Box rendering primitive to the Extensions module, which should use its private shaders for rendering (from Extensions library resources) and support setting custom cube-texture images from user code.

User interface library

Design and implement basic user interface library based on Graphics/Core module. UI library should include most common controls: Panel, Button, Label, etc.

Render Context Heads Up Display (HUD)

Implement HeadsUpDisplay user interface component for rendering text on screen with common rendering statistics and information of RenderContext.

Tutorials do not start on MacOS because of command line parsing error

When macOS bundled application is launched from Finder, MacOS assigns it a unique process serial number (PSN) and passes it to application as a command line argument, for example "-psn_0_8423432" (see description on stack overflow). When cxxopts tries to parse command line with psn argument it throws OptionException "Argument โ€˜-psn_0_8423432โ€™ starts with a - but has incorrect syntax". When application is started from Terminal by full path to executable inside bundle it works normally because there is no psn argument in command line options.

Related issue created on cxxopts project: jarro2783/cxxopts#171

[DX12] Triple buffering does not work as expected

Triple buffering should enable submitting up to 3 frames for rendering to GPU without stalls at present, but currently each frame is rendered strictly after previous frame was presented, which seems to be incorrect.

Cross-platform text rendering

Implement cross-platform approach to building font atlas and using it for cross-platform text rendering. Font atlas generation could use Freetype library. Text renderer should be a part of module Graphics/Extensions.

[VS Build] Install target is broken

Attempt to run any CMake install target leads to the error described below:

CMake Error at Externals/Nowide/cmake_install.cmake:51 (file):
    file INSTALL cannot find
    "C:/Users/sys_avctests/Documents/MethaneKit/Build/Output/VisualStudio/x64-Release/Build/Externals/Nowide/RelWithDebInfo/nowide0.pdb".
  Call Stack (most recent call first):
    Externals/cmake_install.cmake:41 (include)
    cmake_install.cmake:37 (include)

Mesh models loader

Choose 3rd-party mesh models loader and implement loading in a tutorial.

Compute pipeline support

Support execution of compute shaders with Methane Kit. Add compute pipeline interfaces to Graphics Core module along with DX12 and Metal implementations:

  • ComputeCommandList
  • ComputeState
  • Shader::Type::Compute

Improved shader converter

Try to replace glslangValidator to DirectXCompiler built for MacOS for compiling HLSL to SPIRV, required for further translation to Metal shader code with SPIRV-Cross.

Graphics context controller

Create controller to change graphics context parameters in runtime:

  1. Swich device between available system devices
  2. Switch VSync ON/OFF
  3. Switch to full screen and back
  4. Add/Remove frame buffers in swap-chain

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.