Giter VIP home page Giter VIP logo

raytracer's Introduction

Ray Tracer

Rust implementation for The Ray Tracer Challenge. Download the CLI from the release page.

There are some extra post processing effects available:

Usage

The Ray Tracer Challenge CLI

Usage: raytracer [OPTIONS] --scene <FILE>

Options:
      --scene <FILE>        A yaml description of the scene to render
      --obj <FILE>          Optional obj models to add to the scene
      --ppm <FILE>          Optional ppm textures to use as material
      --dithering <PARAMS>  Add dithering effect to the final image [possible values: bayer2, bayer4, bayer8, bayer16, bayer-color]
      --out <OUT>           Optional output ppm file, defaults to stdout
  -h, --help                Print help

Examples

See comments in yaml scene files for information about how to get all resources (obj models, ppm textures) used in the examples commands.

Basic scene

The rendered scenes can be piped directly to ImageMagick or outputted to a file.

raytracer --scene samples/scenes/basic_scene.yaml | magick display

basic-scene

Books's cover

raytracer --scene samples/scenes/cover.yaml --out cover.ppm

cover

Spaceship model

raytracer --scene samples/scenes/space_ship.yaml \
          --obj samples/obj/space_ship.obj \
          --out space_ship.ppm

spaceship

Teapot and Spaceship models

Multiple obj models can be added/combined in a scene.

raytracer --scene samples/scenes/space_teapot.yaml \
          --obj samples/obj/space_ship.obj \
          --obj samples/obj/teapot_low.obj \
          --out space_teapot.ppm

space-teapot

Constructive Solid Geometry (CSG)

raytracer --scene samples/scenes/csg.yaml --out csg.ppm

csg

Soft shadows (Area Light)

raytracer --scene samples/scenes/soft_shadows.yaml --out soft_shadows.ppm

soft-shadows

Bounding Boxes - Dragons

Beware that rendering this scene will be quite long (about 45 minutes on my machine with 16 cores).

raytracer --scene samples/scenes/dragons.yaml \
          --obj samples/obj/dragon.obj \
          --out dragons.ppm

dragons

Texture Mapping - Patterns

raytracer --scene samples/scenes/checkered_cube.yaml --out checkered_cube.ppm

checkered-cube

checkered-sphere checkered-plane checkered-cylinder

Texture Mapping - Image

raytracer --scene samples/scenes/earth.yaml \
          --ppm samples/textures/earthmap1k.ppm \
          --out earth.ppm

earth

Texture Mapping - Skybox

raytracer --scene samples/scenes/skybox.yaml \
          --ppm samples/textures/negx.ppm \
          --ppm samples/textures/negy.ppm \
          --ppm samples/textures/negz.ppm \
          --ppm samples/textures/posx.ppm \
          --ppm samples/textures/posy.ppm \
          --ppm samples/textures/posz.ppm \
          --out skybox.ppm

skybox

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.