A good chunk of this repo has been made following this tutorial: https://sotrh.github.io/learn-wgpu
- The build script needs the
shader-slangtools installed and added to PATH in order to compile the slang shaders in the shaders/ directory.
- If you want to run the scripts to convert textures/materials into ktx2, you will need the
ktx-toolsand the OpenImageIO tools installed and added to your PATH.
Run the following command to build the wasm library:
cd ./crates/renderer
wasm-pack build --target webWhile developing for web, you need to set up two directory symlinks:
- One for your dir containing the built and packaged WASM library.
- One for your dir containing the static files that WASM will fetch at runtime
For example, when serving our project with Svelte, here's how those symlinks should be:
<RUST_PROJECT_ROOT>/crates/renderer/pkg-><SVELTE_PROJECT_ROOT>/src/lib/pkg
For Svelte,
/src/lib/is where libraries directly references in components should go.
<RUST_PROJECT_ROOT>/crates/renderer/res-><SVELTE_PROJECT_ROOT>/static/<PATH_TO_PAGE>/res
For example, if we want to serve our project at
http://localhost/my_page, then we need to use the path/static/my_page/resunder our Svelte project.
Once the symlinks are set up, you can import and init the WASM library:
import init from '$lib/pkg/renderer.js';
onMount(async () => {
init().catch((error) => {
if (!error.message.startsWith("Using exceptions for control flow,")) {
throw error;
}
});
});- Use slangc to compile modules into slang-IR files before compiling entry points to improve compile times.
- Handle case where slangc can't be found in the build script. Should it fail to build, or just continue with a warning?
- Check if output on WebGL is always sRGB, even if screen is Display P3
- Address dots in the pre-filtering by sampling mips during the pre-filtering stage. (This will need to happen in a shader)
- Store SH coefficients as a key/value pair in the .ktx2 file, instead of a separate .bin file.
- Create PR for Python example instead of C example in OCIO docs for shaders
- Use block compression on all ktx2 textures
- impl of AsBindGroup in Material has too many empty functions. Maybe some of those methods in AsBindGroup should be moved to another derived trait that is only for UniformBuffer bindgroups?
- Refactor to have a LightManager and do an instance draw call from there to draw all light debug meshes.