Giter Site home page Giter Site logo

raytracer-rust's People

Contributors

advaypal avatar kwannoel avatar

Stargazers

 avatar

Watchers

 avatar  avatar

raytracer-rust's Issues

Alternate implementations for handling incident rays

Currently we instantiate a HitRecord struct whenever a ray hits a surface. This is created to store certain values when the event occurs.

Perhaps we can abstract the hitting event away to a method as part of the Hittable trait.

Intuitively hitting a surface should have a function causing a ray to reflect and other effects rather than creating any sort of struct.

Investigate if our image is being printed upside down

Upon executing cargo run > image.ppm,

  1. We trace the ray starting from the lower left corner of our screen.
    We do so from left to right, bottom to top row.
    Suppose the bottom left corner as RGB value of 255 0 0.

  2. Each time we trace, we print to stdout.

  3. The output is piped to image.ppm.

  4. The first RGB value written to image.ppm will be 255 0 0.
    This corresponds to the top left pixel in the image.ppm file.

    ppm specification

    (Pixels are rendered) in order from top to bottom. Each row consists of Width pixels, in order from left to right.

  5. Following this reasoning, it seems our image is printed upside down.

Separating color from vector struct

Currently Color is an enum value of VectorType.

Perhaps we can model these separately since a Color is not a vector.

The book this project follows models it this way as well, maybe there's a good reason which I am unaware of.

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.