Code Monkey home page Code Monkey logo

rustracer's Introduction

Rustracer

Rustracer is a toy raytracer written in Rust.

Rust dependency status

Update (27/05/2020): This project is not really developped anymore as I ran out of steam and spare time. I'm doing a little bit of maintainance occasionally, such as updating dependencies, to keep it from bitrotting but I suggest you look at rs_pbrt for a more full-featured port of pbrt.

History

It started as a little playground to play with raytracing concepts that I found on Scratchapixel. I then found out about tray_rust and began refactoring my code to follow its design, but then eventually bought a copy of Physically-Based Ray Tracing and decided to follow the C++ implementation as closely as possible to make it easier to follow along with the book. Consider this a port of PBRTv3 to Rust.

Note: I am very much a beginner in Rust as well as in raytracing and this project is a way for me to learn about both. If the code is ugly or broken, it is very much my fault :) This is not helped by the fact that the C++ implementation is very object-oriented, and doesn't always translate cleanly or idiomatically to Rust... I haven't really paid attention to performance yet, or number of allocations, so both are probably pretty bad :) That being said, feedback is more than welcome!

Related projects

  • tray_rust: if you want to see a good physically-based raytracer in Rust written by someone who knows what they're talking about, you should check this project instead of mine :) It's got some nice features, like distributed rendering, and the code is beautifully written and documented.

  • rs_pbrt: another port of PBRT to Rust.

Examples

More examples can be found in the renders/ directory.

balls

How to build

To run the CLI, run cargo run --release -p rustracer -- scene_file.pbrt.

Currently supported

  • Integrators:
    • Whitted
    • Direct Lighting (with "all" or "one" sampling strategies)
    • Path Tracing (with "uniform" or "spatial" sampling strategies)
    • Normal (for debuging)
    • Ambient Occlusion
  • Shapes:
    • Basic shapes: disc, sphere, cylinder
    • triangle meshes
  • Perspective camera with thin-lens depth-of-field
  • Lights:
    • Point lights
    • distant lights
    • diffuse area lights
    • infinite area light
  • BxDFs:
    • Lambertian
    • perfect specular reflection / transmission
    • microfacet (Oren-Nayar and Torrance-Sparrow models, Beckmann and Trowbridge-Heitz distributions, Smith masking-shadowing function)
  • Materials:
    • Matte
    • Plastic
    • Metal / RoughMetal
    • Glass / RoughGlass
    • Substrate (thin-coated)
    • Translucent
    • Uber
    • Disney (without SSS)
  • Textures (imagemaps, UV, CheckerBoard)
    • imagemap with mipmapping (with trilinear and EWA filtering)
    • UV
    • CheckerBoard
    • Fbm
  • BVH acceleration structure (MIDDLE and SAH splitting strategy)
  • multi-threaded rendering
  • Support for PBRT scene file format (still incomplete)
  • Read textures in PNG, TGA, PFM, HDR or EXR (thanks to openexr-rs)
  • Write images in PNG or EXR
  • Support for PLY meshes (thanks to ply-rs)
  • Bump mapping
  • Memory arena (thanks to light_arena)

TODO

  • More CLI parameters (e.g. output file name, thread numbers)
  • More camera types (orthographic, realistic, environment)
  • More shapes (cone, paraboloid, hyperboloid, NURBs...)
  • More samplers (Halton, Sobol...)
  • More BxDFs and materials
  • Implement subsurface scattering
  • Volumetric rendering
  • More integrators: bidirectional path tracing, MTL, SPPM
  • Animations
  • more light types
  • k-d trees?
  • Spectral rendering?
  • some SIMD optimisation?
  • ...

License

Licensed under either of

at your option.

rustracer's People

Contributors

abusch 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

akav baajur jonas231

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.