Git Product home page Git Product logo

ray-tracer's Introduction

Yet Another Simple Ray Tracer

The Current Output

This project is a learning exercise with a few objectives:

  • Learn the math behind rays, and how to use rays to calculate each pixel color in an image.

  • Experiment with the Rust programming language and see how it differs from the C++ approach to programming.

  • Have fun! :D

This project is based on the book 'Ray Tracing in One Weekend' by Peter Shirley. This is my first time reading this book, and it is very helpful and fast. The changes this project make from 'Ray Tracing in One Weekend' can be seen [here](## Project Deviations From Book).

This project uses the Rust programming language. There are two reasons for this. The first is that I learn quicker by re-writing content in my own words. Translating from C++ to Rust is helpful because it has me THINK about what the code I am copying does. The second reason for using Rust is the hype. I have heard a lot of hype around Rust and was curious how great it really was. Spoilers: Rust is awesome.

Project Deviations From Book

The source book 'Ray Tracing in One Weekend' implements a ray-tracer in C++. This project is written in Rust, so there are a number of idiomatic changes made in this project:

  • There is no operator overloading. All vector operations have proper implementations. For example, scalar multiplication can be computed using the implemented Vector3::scalar_mul(self, f32) function. This is optimal over operator overloading, since it is clear if the goal is scalar multiplication, a dot product, or a cross product.
let test_vector: Vector3 = Vector3::new(1.0, 1.0, 1.0);
let scalar: f32 = 5.0;

test_vector.scalar_mul(scalar) // results in (5.0, 5.0, 5.0)

To-Do List

  • Add more to 'Project Deviations From Book' section of README.

ray-tracer's People

Contributors

mjalen avatar

Watchers

 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.