Skip to content

metashade/metashade-glTFSample

Repository files navigation

Metashade glTF Demo

This demo uses the third-party pygltflib to parse glTF assets and generate HLSL shaders that can be rendered with a fork of the Cauldron glTFSample. The goal is to demonstrate that Metashade can generate sufficiently complex renderable shaders and that it can be integrated with other Python libraries and content production pipelines.

Getting started

First, clone the repo, recursing into submodules, e.g.

git clone --recurse-submodules https://github.com/metashade/metashade-glTFSample.git

The demo uses the following directory structure:

Building glTFSample

Follow the build instructions in glTFSample/readme.md.

Generating the shaders

The Python implementation of the demo requires pygltflib to be installed:

pip install pygltflib
--gltf-dir  Path to the source glTF assets
--out-dir   Path to the output directory

The script processes all glTF asset files it finds under the directory specified by --gltf-dir and writes the generated shader files to the directory specified by --out-dir.

The Visual Studio Code launch configurations in .vscode/launch.json execute the above script with the command-line arguments set to the appropriate paths in the demo's directory structure.

Rendering with the generated shaders

In order to use the generated shaders with glTFSample, their parent directory needs to be passed to the executable via a command-line argument:

cd glTFSample\bin
GLTFSample_DX12.exe --metashade-out-dir=..\build\DX12\metashade-out

The names of the generated shader files are derived from the names of glTF meshes and primitives. glTFSample uses the same naming convention to find the right shaders at runtime and use them for rendering.

Releases

No releases published

Packages

No packages published

Languages