Skip to content

Meshcapade/gloss

Repository files navigation

✨ Gloss

A light-weight Physically-based Renderer, made with Rust and wgpu

Crates.io PyPI License: MIT

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.

Gloss Banner

Documentation

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

View Mesh Example

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://0.0.0.0:8000/gloss_webpage/ in your browser of choice.

Planned features

  • PyTorch integration
  • 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

Acknowledgements and Credits

About

A light-weight Physically Based Renderer built in Rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •