7 releases (4 breaking)
| 0.9.0 | Feb 18, 2026 |
|---|---|
| 0.8.0 | Nov 18, 2025 |
| 0.7.0 | Aug 5, 2025 |
| 0.6.0 | Apr 30, 2025 |
| 0.5.3 | Mar 17, 2025 |
#107 in Graphics APIs
1.5MB
25K
SLoC
✨ Gloss
A light-weight Physically-based Renderer, made with Rust and wgpu
Gloss is a light-weight Physically-based Renderer written in Rust and wgpu. The main functionality includes loading meshes with high-resolution textures, rendering them with advanced graphics features, and allowing a general framework to explore new rendering techniques. Gloss also compiles for Python and Web, allowing for rendering in multiple different environments.
Documentation
- Gloss Rust API Documentation: Automatically generated docs for Gloss's Rust API
- Gloss Rust Examples: Gloss's runnable examples in Rust, covering basic usage.
- Gloss Python Examples: Gloss's runnable examples for the Python bindings. Covers a wide range of features of the Python bindings.
Getting Started
The easiest way to get started with gloss is to install the Python bindings.
$ pip install gloss-rs
Below is a basic example of a python script which shows a single mesh using the default viewing parameters. More examples for the python bindings can be found in the bindings/gloss_py/examples folder.
import gloss
viewer = gloss.Viewer()
mesh = viewer.get_or_create_entity("mesh")
mesh.insert_builder(gloss.geom.build_from_file("my/mesh.obj"))
viewer.run()
Installation and Dependencies
The main dependency is installing Rust, as the rest of dependencies are handled by cargo. To install Rust, simply run the following in your terminal:
$ curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh
Some additional dependencies for Linux:
$ sudo apt-get install libvulkan-dev vulkan-tools xorg-dev libxkbcommon-x11-dev
For MacOs, it should run out of the box.
For running the Rust examples
$ cd gloss
$ cargo run --bin gloss_view_mesh

For running the Python examples
$ cd gloss/bindings/gloss_py
$ pip install gloss-rs
$ ./examples/empty.py
Build and run the Web Example
For Web, we use wasm-pack:
$ curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
To build the web example, run:
$ cd gloss/examples/web
$ wasm-pack build --target web
To run the web example, we can create a dummy web server by opening another terminal and running:
$ cd gloss/examples/web
$ python -m http.server
Finally, navigate to http://localhost:8000/gloss_webpage/ in your browser of choice.
Planned features
PyTorchintegration- Differentiable rendering
- Area lights
- Subsurface scattering
- Order-independent transparency
- Support for Gaussian Splatting
Troubleshoot
If you have a laptop with both Intel graphics and NVIDIA, go to nvidia-settings and set the GPU to performance mode. Letting it run "on-demand" can cause issues with an external monitor: <https://askubuntu.com/a/1447935>
If there are any exceptions that mention "Maybe there's a driver issue on your machine?", please check that you have GPU vulkan drivers installed (libvulkan-dev vulkan-tools) and running vulkaninfo | grep GPU shows a real GPU and not a software solution like llvmpipe.
If there are still issues with "Maybe there's a driver issue on your machine", you can switch to GL backend with:
$ sudo apt-get install mesa-utils libegl-dev
$ sudo usermod -a -G render $USER
$ sudo usermod -a -G video $USER
RELOG
$ LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libstdc++.so.6 WGPU_BACKEND=gl MY_SCRIPT
Partially, this solution comes from "Solution 1" from <https://stackoverflow.com/a/72427700>, where it seems that conda can cause issues.
Another solution might be: conda install -c conda-forge libstdcxx-ng
WSL2 GPU Rendering using Vulkan on NVIDIA GPUs
WSL2 does not expose native Vulkan drivers for NVIDIA GPUs. Mesa's "Dozen" driver bridges this by translating Vulkan API calls into D3D12. To install Dozen on WSL2 you can do
sudo add-apt-repository ppa:kisak/kisak-mesa
sudo apt update
sudo apt upgrade
More info on the above can be found here - https://github.com/microsoft/WSL/issues/7790
Since Dozen does Vulkan -> D3D12 -> NVIDIA GPU, there is additional overhead so performance is not as good as it would be on native Ubuntu using native Vulkan drivers and also it is not a conformant Vulkan implementation. Since its not a conformant implementation, wgpu hides it by default, falling back to llvmpipe (CPU software rendering).
To enable GPU rendering in WSL2, run with:
$ WGPU_ALLOW_UNDERLYING_NONCOMPLIANT_ADAPTER=1 cargo run --bin gloss_view_mesh
Or add it to your .bashrc or .zshrc to make it permanent:
export WGPU_ALLOW_UNDERLYING_NONCOMPLIANT_ADAPTER=1
Acknowledgements and Credits
Dependencies
~76–120MB
~2M SLoC