A collection of dumps, scripts, and markdown files for research into lighting, shading, rendering, and materials for Smash Ultimate. The markdown files contain information on researched values for materials and can be viewed directly in the browser. Please submit an issue or pull request for any incorrect or missing information. Ask questions or discuss in game rendering using discussions.
The repository has a website for tutorials and real time demos. If any pages don't load properly or one of the demos is messed up, report the bug in issues.
Most of the dumps are generated using the smush_materials
Rust project. The Rust toolchain can be installed from https://www.rust-lang.org/tools/install. Build the project with cargo build --release
. For commandline usage, run cargo run --release -- --help
.
Most of the data is stored in an SQLite database generated by the program in the Smush-Material-DB repo. The repo contains instructions for how to build and run the tool. The database can be used with the provided python scripts for data visualization even without any SQL knowledge.
cargo run --release -- xmb <ARC root folder> <export folder>
cargo run --release -- stage-lighting <ARC root folder> <export folder>
Generates the shader info JSON with rendering related information used by ssbh_wgpu. This includes the required material parameters and vertex attributes from the nufxlb as well as data mined from the decompiled source code like alpha testing and accessed color channels for parameters and attributes.
cargo run --release -- shader-info <nuc2effectlibrary.nufxlb> <shader binary folder> <decompiled source folder> <output JSON>
The JSON dump of the Nufx file can be converted to an SQLite database for more efficient querying.
python create_shader_db.py nuc2effectlibrary.json nufx.db
The file contains duplicate entries for each render pass (_opaque, _sort, etc). These entries can be removed by adding the --remove_duplicates
flag.
python create_shader_db.py nuc2effectlibrary.json nufx.db --remove_duplicates
Generates a separate JSON metadata file for each of the shaders in the nushdb files. This metadata describes how material inputs are mapped to the shader code.
cargo run --release -- nushdb-metadata </render/shader/bin folder> <export folder>
Extracts the shader binaries from the .nushdb files since each file contains multiple shaders.
cargo run --release -- shader-binaries </render/shader/bin folder> <binary export folder>
The shaders can be decompiled using Ryujinx's ShaderTools.
cargo run --release -- shader-binaries <binary export folder> <export folder> <ShaderTools.exe>
Replaces input and output attributes, textures, and uniforms in the decompiled shaders using variable names from the nushdb metadata. See shaders for details. The start of the main function contains declarations for uniform parameters. Not all parameters are used in the actual code.
cargo run --release -- annotate-decompiled-shaders <decompiled shaders> </render/shader/bin folder> <export folder>
Finds all the lines of a decompiled GLSL shader that contribute to the final assignment of the given variable. This is helpful when trying to analyze the source code related to a particular variable since only the relevant lines are added to the output file. This command works with any decompiled GLSL shader, but the annotated source files will be easier to interpret.
cargo run --release -- glsl_dependencies <GLSL input file> <GLSL output file> <var>
cargo run --release -- glsl_dependencies "SunShaft1PS.glsl" "out.glsl" OUT_color.x
ssbh_lib - Contains the ssbh_lib_json
and ssbh_data_json
executables for editing various rendering related file types as JSON
xmb_lib - Contains the xmb
executable that can be used to convert XMB files to and from XML
Ryujinx - Nintendo Switch emulator used for the research and documentation of in game rendering.
Yuzu - Nintendo Switch emulator used for early research. Not recommended for research due to its decompiled shaders and rendering commands being structured differently than Ryujinx.
RenderDoc - a powerful GPU debugging program that can be used with Ryujinx or Yuzu to analyze in game rendering.