GithubHelp home page GithubHelp logo

zraytrace's Introduction

zraytrace

Ray tracing implemented in Zig.

Inspiration

Code follows mostly Ray Tracing in One Weekend and Physically Based Rendering.

Features

Single threaded, uses only on CPU.

Materials:

  • diffuse (matte)
  • metal (fully reflective)
  • dielectric (glass like objects)

Shapes

  • sphere
  • triangle

Textures:

  • constant color
  • image textures

Algorithms

  • Bounded volume hierarchy

File formats:

  • PNG images, read and write
  • OBJ 3d models, read

Examples

Spheres

This doesn't use bounded volume hierarchy because its overhead is too big for scene with 7 spheres.

7 spheres with various materials and textures

From the left:

  • reflective texture mapped sphere (earth)
  • hollow dielectric sphere (glass)
  • diffuse texture mapped sphere (Nitor logo)
  • filled dielectric sphere (glass)
  • reflective sphere with silver color (mirror ball)
  • diffuse green sphere (ground level)

Some statistics

  • Surfaces: 7
  • Pixels: 1000x1000
  • Samples per pixel: 1000
  • Max recursion depth: 30
  • Total reflections: 1144753226
  • Total background hits: 999892115
  • Total pixels: 1000000
  • Total samples: 1000000000
  • Total rays: 2144645362
  • Total reflections: 1144753226
  • Pixels per second: 1619.68 pixels/s
  • Total runtime: 617.41 seconds

zraytrace's People

Contributors

jsyrjala avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

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.