wgpu-renderer/README.md

71 lines
2 KiB
Markdown
Raw Normal View History

2023-01-27 22:06:09 +02:00
# wpgu-renderer
A small [wgpu](https://github.com/gfx-rs/wgpu) renderer written in [Rust](https://github.com/rust-lang/rust).
2023-11-05 02:44:17 +02:00
![](demo.gif)
2023-01-28 12:58:38 +02:00
## Try it out
2023-01-28 14:16:39 +02:00
[rasanen.dev/wgpu-renderer](https://rasanen.dev/wgpu-renderer)
2023-11-05 02:27:38 +02:00
Note: the .wasm is about 50 MB because it embeds Sponza.
Note: shadowmaps are not enabled on WebGL.
2023-01-28 12:58:38 +02:00
2023-01-28 13:24:06 +02:00
Controls:
- WASD - Move horizontally
- Ctrl/Space - Move vertically
- Mouse - Look around
- Scrollwheel - Increase/Decrease movement speed
- ESC - Quit (Only on standalone version)
2023-01-27 22:06:09 +02:00
## Features
2023-04-15 19:52:58 +03:00
- PBS
2023-01-27 23:16:33 +02:00
- glTF models
2023-01-28 12:23:43 +02:00
- 1 realtime pointlight
2023-11-05 02:27:38 +02:00
- Shadow mapping*
- Soft shadows*
2023-01-27 22:06:09 +02:00
- Simple wgsl preprocessor for includes
2023-01-28 14:30:29 +02:00
- Runs on WASM and native desktop
2023-01-28 15:46:43 +02:00
- Tested on:
2023-04-15 19:52:58 +03:00
- `Ubuntu 22.04 (Mesa 23.1.0-devel)`
2023-01-28 15:46:43 +02:00
- `Windows 10 Pro 21H2`
- `Firefox 109.0`
- `Chrome 109.0.5414.120`
2023-01-27 22:06:09 +02:00
2023-11-05 02:27:38 +02:00
*Native only
2023-01-28 12:58:38 +02:00
TODO:
2023-04-16 14:57:38 +03:00
- Transparency
2023-01-27 23:16:33 +02:00
- Restructuring
- Simplify/abstract renderpasses; will be nice to have for PP and GI
- `src/core/state.rs` is a mess; separate input handling, pipeline, passes
- SSAO
- Bloom
2023-01-28 12:23:43 +02:00
- AA
- Texture filtering
2023-01-27 23:16:33 +02:00
- Immediate mode UI (dear imgui, egui)
- Some type of GI (DDGI, VXGI)
2023-01-28 13:24:06 +02:00
## Running locally
Standalone:
```sh
cargo run --release
```
2023-04-13 16:56:06 +03:00
WASM requires:
- [wasm-pack](https://github.com/rustwasm/wasm-pack)
- `cargo install wasm-pack`
- [miniserve](https://github.com/svenstaro/miniserve), or some other http server, such as `python3 -m http.server`.
- For miniserve, see: `run-wasm.sh`
2023-01-28 13:24:06 +02:00
2023-01-27 22:06:09 +02:00
## References
2023-01-28 12:23:43 +02:00
- [wgpu examples](https://github.com/gfx-rs/wgpu/blob/master/wgpu/examples)
2023-01-28 12:58:38 +02:00
- [Learn Wgpu](https://sotrh.github.io/learn-wgpu/)
- [Learn OpenGL: PBR](https://learnopengl.com/PBR/Theory)
2023-01-27 23:16:33 +02:00
## Assets
- Sponza
2023-01-28 12:58:38 +02:00
- Obtained from [KhronosGroup glTF-Sample-Models repository](https://github.com/KhronosGroup/glTF-Sample-Models/tree/16e2408d31e06d4b0bcf6123db472e802d71f081/2.0/Sponza), converted to .glb
- Cube
- Obtained from [KhronosGroup glTF-Sample-Models repository](https://github.com/KhronosGroup/glTF-Sample-Models/tree/16e2408d31e06d4b0bcf6123db472e802d71f081/2.0/Cube), converted to .glb