Ray Tracer in Python (Part 3) - Show Notes of "3D Balls in 2D Space"

You are reading a post from a multi-part tutorial series

Graphics is what made Mathematics enjoyable for me. I first heard of trigonometric functions like sine and cosine when I read GW-BASIC manual. Geometry was easy to visualize with the rudimentary graphics of LINE and CIRCLE statements. While I could see many struggle with Mathematics, I always found it interesting.

So my challenge was to make this math-heavy episode interesting so that you see how I see it. I needed to give personalities to Ray and Sphere before I could show their intersection formula. This needed a lot of illustration and animation work. But I believe the end result was worth it.

This time there is a lot of furious typing and less talking because of the number of lines entered in this part. I did not want to fast forward code writing segments because it doesn’t help the learners. In any case, YouTube can speed up videos if you choose to.

These are the topics we will cover in this episode:

  • Introduction
    • Why meshes in movies and spheres in raytracers
    • Simplified ray-tracing
    • Ray-sphere intersection
    • Aspect Ratio Corrections
  • First sub-problem: 3D Balls in 2D Space
  • Coding the solution
    • Hex colors
    • Classes for Engine, Ray, Sphere, etc.
    • Rendering Algorithm

Here is the video:

Code for part three is tagged on the Puray Github project

Bonus (Traffic Lights) Code is available for download.

Show Notes

Books and articles that can help understand this part:

Note: References may contain affiliate links

Share on: Twitter, Hacker News, Reddit, Facebook, Google+

Posted on: Wed, Dec 4, 2019

Prev: ◀  Ray Tracer in Python (Part 2) - Show Notes of "Revealing the True Colors"

Up: ▲  Blog

Hi! Welcome to ArunRocks, an odd collection of writeups on programming, travel, gadgets and practically anything under the sun. This state of affairs could be blamed on the ecelectic interests of your host, Arun Ravindran. He loves programming in several languages especially Python.

Frequent Tags

python (36) django (18) movies (11) productivity (11) tutorial (10) gaming (8) humour (8) creativity (7) featured (7) screencast (7) python3 (6) review (6) programming (5) wordpress (5)

Don't miss any future posts!

Comments

comments powered by Disqus