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

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

It is always a good idea to create a visible output at the start of a long project. If you are making a game, start with showing something moving on the screen. It keeps you motivated and gives you something cool to show your friends as progress. In the second part of our ray tracer tutorial, I will introduce you to PPM a very simple image format that will be used for our renders. You don’t need to install any image libraries and yet PPM files can be read by most image viewers.

The color class is a lot simpler than what I originally designed. Features like gamma correction and linear interpolation seemed like an overkill for a project like this. But I plan to add some convenience constructors later. Hopefully, this will be a good introduction to how colors are manipulated in computer graphics.

These are the topics we will cover in this episode:

  • Introduction
    • Compressed Image are Hard
    • What Images are Made of
    • RGB triplets
  • First sub-problem: Revealing the True Colors
  • Coding the solution
    • Use the shebang line
    • Separate classes in separate files
    • Why fileobj instead of filename?

Here is the video:

Code for part two is tagged on the Puray Github project

Bonus (Gradient) 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: Sun, Nov 17, 2019

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

Prev: ◀  Ray Tracer in Python (Part 1) - Show Notes of "Points in 3D Space"

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 powered by Disqus