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

2 min read · Posted on: Nov 17, 2019 · Print this page

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


Arun Ravindran profile pic

Arun Ravindran

Arun is the author of "Django Design Patterns and Best Practices". Works as a Product Manager at Google. Avid open source enthusiast. Keen on Python. Loves to help people learn technology. Find out more about Arun on the about page.

Don't miss any future posts!

Comments →

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

Featured Posts

Frequent Tags

banner ad for Django book

Comments

powered by Disqus