Giter VIP home page Giter VIP logo

rust-raytracer's Introduction

rust-raytracer

Build Status

ScreenShot

A raytracer in Rust. Compiles on Rust stable > 1.5.

Gallery
Gallery repository
Assets repository

Usage

  1. Clone the project. --recursive clones most sample models and textures into the project directory as well.

     git clone --recursive https://github.com/gyng/rust-raytracer.git
    
  2. Compile

     cargo build --release
    
  3. Edit sample-config.json if you wish to render a scene besides the default, or if you wish to tweak the renderer parameters

  4. Run the compiled program, passing the render configuration as an argument. If rendering a provided scene, run the binary in the project root so it can find the models and textures.

     ./main sample-config.json
    

or alternatively to compile and run in one single command

    cargo run --release sample-config.json

Useful commands

  • To update (assets) submodules only: git submodule foreach git pull
  • To convert frames into a video ffmpeg -i test%06d.ppm -b 2000k out.webm
  • Scenes are created in ./myscene/. To hook up a scene, add it to ./myscene/mod.rs and get_camera_and_scene(&SceneConfig) in main.rs.

Available Scenes

These should use 30deg fov for squares and 45deg fov for 16:9.

  • box
  • bunny
  • cow
  • easing (0s-10s animation)
  • fresnel (0s-10s animation)
  • lucy
  • sibenik (0s-7s animation)
  • sphere (0s-10s animation)
  • sponza (45deg fov for a square; 67.5deg for 16:9)
  • teapot
  • heptoroid-white
  • heptoroid-shiny
  • heptoroid-refractive
  • tachikoma

Features

  • Reflections
  • Refractions
  • Multi-threading
  • Soft shadows
  • Supersampling
  • Cook-Torrance, Phong materials
  • Sphere, plane, triangle primitives
  • Point, sphere lights
  • Unoptimised glossy reflections
  • Limited OBJ model and mesh support
  • Mesh transformations (4x4 matrices)
  • Basic spatial partitioning (octree)
  • Basic textures (checker, uv, image)
  • Skybox (cubemap)
  • Camera animation with Bézier easing

Missing/potential features

  • Scene description
  • Caustics/global illumination (progress stalled on photon-trace branch)

rust-raytracer's People

Contributors

gyng avatar infinityb 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

Watchers

 avatar  avatar  avatar  avatar  avatar

rust-raytracer's Issues

Cannot compile the project

Hi,

I have just cloned the project, went inside and ran the command from README:

cargo build --release

I get this:

error[E0642]: patterns aren't allowed in methods without bodies
   --> /home/radu/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-serialize-0.3.16/src/serialize.rs:145:45
    |
145 |                                             &f_name: &str,
    |                                             ^^^^^^^

My rust version:
rustc 1.27.1 (5f2b325f6 2018-07-07)

unknown scene: 'box'

Running a fresh, recursive checkout yields this error for me:

lunch-box. cargo run --release sample-config.json
     Running `target/release/rust-raytracer sample-config.json`
Job started at 1465205449...
Loading scene...
unknown scene ``box''
error: Process didn't exit successfully: `target/release/rust-raytracer sample-config.json` (exit code: 1)

:(

compile / build error

I'm building on Ubuntu 14.04. When running cargo build --release, I get these errors

Updating registry https://github.com/rust-lang/crates.io-index
 Downloading rustc-serialize v0.3.14
 Downloading num_cpus v0.2.5
 Downloading gcc v0.3.5
 Downloading time v0.1.25
 Downloading threadpool v0.1.4
 Downloading rand v0.3.8
 Downloading num v0.1.24
 Downloading libc v0.1.7
   Compiling threadpool v0.1.4
   Compiling libc v0.1.7
   Compiling rustc-serialize v0.3.14
   Compiling gcc v0.3.5
   Compiling num_cpus v0.2.5
   Compiling rand v0.3.8
   Compiling time v0.1.25
   Compiling num v0.1.24
   Compiling rust-raytracer v0.1.0 (file:///home/usr/extra/rust-raytracer)
src/util/import.rs:33:42: 33:60 error: type `str` does not implement any method in scope named `split_whitespace`
src/util/import.rs:33         let tokens: Vec<&str> = line[..].split_whitespace().collect();
                                                               ^~~~~~~~~~~~~~~~~~
src/util/import.rs:122:41: 122:59 error: type `str` does not implement any method in scope named `split_whitespace`
src/util/import.rs:122     let mut tokens: Vec<&str> = tex[..].split_whitespace().collect();
                                                               ^~~~~~~~~~~~~~~~~~
error: aborting due to 2 previous errors
Could not compile `rust-raytracer`.

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.