Giter Site home page Giter Site logo

Comments (4)

acs avatar acs commented on July 22, 2024

Ok, let's describe how the ray trace works. The ray tracer renderer has:

  • A 3D Scene is defined with 4 elements: 3 spheres and a plane.
  • The Scene has also lights (ambient and diffuse) and a camera pointing to the center of the Scene
  • A 2D image where the 3D scene is rendered using ray tracing

The logic is:

  • For each pixel in the 2D image fill the color based on ray tracing.
  • Cast a ray with origin (O) the camera that goes through each pixel (this defines the direction)
  • Find if the ray hits any object in the Scene.
    • If no hits, drop the ray (no effects in the pixel color)
    • If the ray hits an object, find the hit point (M)
      • If the hit point is shadowed drop the ray (no effects in the pixel color)
      • Find the hit point color contribution to the pixel based on:
        • Ambient light
        • Diffuse light using Lambert shading
        • Specular light using Blinn-Phong shading
    • Create max_depth reflection rays and repeat the above process

from mcthings.

acs avatar acs commented on July 22, 2024

One of the hardest problems with ray tracing is the intersection point and howto find the direction of the ray from the light to the hit point. In this simple case, we have a plane and a sphere. In these cases, it is pretty simple.

https://www.scratchapixel.com/lessons/3d-basic-rendering/minimal-ray-tracer-rendering-simple-shapes/ray-sphere-intersection

from mcthings.

acs avatar acs commented on July 22, 2024

All done for this first iteration.

from mcthings.

acs avatar acs commented on July 22, 2024

To continue in the future:

https://twitter.com/cyrillerossant/status/1290319169171398662
https://ipython-books.github.io/56-optimizing-cython-code-by-writing-less-python-and-more-c/
http://vispy.org/

from mcthings.

Related Issues (20)

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.