Code Monkey home page Code Monkey logo

rustracer's Introduction

Rustracer

Lines of code GitHub repo size dependency status GitHub

A PBR glTF 2.0 renderer based on Vulkan ray-tracing, written in Rust.

Naming

This project and I are not affiliated with the Rust Foundation. I name it rus-tracer only because I love Rust and ray tracing.

Credits

This project is based on Adrien Ben's vulkan-examples-rs.

Sample accumulation implementation, heatmap and Lucy obj model are from project Ray Tracing In Vulkan.

I stole the PBR shaders from the referencePT project and made some changes.

Demos

rustracer-0.2.0-Demo videos.

rustracer-0.1.0-Demo videos.

Lucy in Cornell

Features

  • Loading arbitrary glTF 2.0 models

    • Full node hierarchy
      • Mesh
        • Geometry normal generation
        • Two sets of texture coords
        • Mikktspace tangent generation
        • Normal mapping
      • Camera
    • Alpha blending and testing
    • Full PBR material support
      • Metallic-Roughness workflow
      • Specular-Glossiness workflow
    • Animations
      • Articulated (translate, rotate, scale)
      • Skinning(using compute shader)
      • Morph targets
    • Extensions
      • "KHR_materials_ior",
      • "KHR_materials_pbrSpecularGlossiness",
      • "KHR_materials_transmission",
        • importance sampling and BTDF
      • "KHR_materials_variants",
        • GUI support
      • "KHR_materials_volume",
      • "KHR_materials_specular",
      • "KHR_texture_transform",
      • "KHR_materials_unlit",
      • "KHR_lights_punctual",
  • Optimizations

    • Rayon-accelerated texture loading
    • Async model loading
    • Async acceleration structure building
  • Realtime ray tracing

    • Rasterization mode
    • G-buffer
    • Hybrid mode
    • SVGF denoiser
    • Path regularization
    • Better multi-light sampling like ReSTIR
    • Blue noise and Halton sequence
  • Extras

    • Open file by drag-and-drop
    • Skybox
    • Skydome(hdr)
    • Loading multiple glTF scene dynamically
    • Rigid-body simulation

Building

Prerequisites

  • Linux and a graphics card that supports KHR ray tracing
    • Currently, I hard-coded all test model paths in an enum(in gui_state.rs) and load models in the search paths(see resource manager).
    • You can open arbitrary glTF file by cargo run -- -f <filename> or drag-and-drop
  • Windows not supported. Need some minor cfg tweaks to work on Windows. Open to pull requests.

Build command

Thanks to the superior Rust package manager Cargo, building and running can be as brainless as a one-liner: cargo run.

However, some external C libraries like Vulkan SDK may be missing on your system(those libraries are necessary for basically any Vulkan or non-trivial graphics programming project, regardless of whatever programming language used).

  • To install those libraries automatically,
    • Install Nix package manager(Linux only) and direnv.
    • cd into the project directory and direnv allow.
  • To install external libraries manually
    • cargo run to find out what is missing and install it
    • Look into the list in flake.nix.

Assets

Pointers to glTF models:

References

rustracer's People

Contributors

kaminarios avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

qw-ctf disini

rustracer's Issues

Strange skinning bug:

  • If BrainStem is not loaded as the first scene, switching to it and enabling the skeletal animation causes "lost logical device"
  • Switching from a scene with skinning to a large scene like BistroExt causes "lost logical device"
  • Some models(for example, the Zombie) lose part of the mesh after enabling skeletal animation.

Light bleed between surfaces etc

I've adapted your renderer to render Quake 1 BSP maps to preview what light settings look like during mapping compared to waiting for minutes for the lightmap generator to run (software raytracing via embree). Still a work in progress, I know this is a small one man show, but I have some naive questions.

  1. I'm drawing faces from the geometry found in the BSP map and with sunlight enabled I get light bleed at the edges between all surfaces where the other side is "the outside".

  2. I'm having problem positioning point lights, they all seem to end up at the same position. My shader-fu is kind of weak so I haven't found the reason for this. Either I'm not positioning the nodes correctly, or some link between light and node is not setup correctly, or positioning of point lights is not implemented? So just a sanity-check question if positioning of multiple point lights is supposed to work.

  3. Would be very nice if GLTF could be more separated from the geobuilder and related types, and all relevant fields be made public. Currently you pass in the gltf document to the asset_loader module. Think it would be nice if you split asset_loader into asset_loader_gltf or so, to be more generic. Hope to clean up my repo to show what changes I had to do to adapt this to Q1 BSP.

  4. Don't suppose you've experimented with adding OptiX or any other GPU based denoiser?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.