Theme Catppuccin
Make yourself at homeCatppuccin

A softer light for long learning sessions.

Appearance

Loading your preference…

Dark palette

Choose a dark palette to try it.

Light uses Latte. Your choices stay in this browser.

First light

SKETCHBOOK / 01 The image room · 2-week chapter

Page 1 of 3: Your first renderer needs no window

Start with something you can inspect

Your first renderer needs no window

A renderer turns a description into an image. Begin with a file rather than a window, graphics driver, or engine framework. That lets you concentrate on one idea: choosing a color for each pixel. The native project eventually traces a small scene of spheres and a ground plane on the CPU. This first experiment only writes a gradient.

The P3 form of a PPM image is readable text. Its header says P3, then width and height, then the largest channel value. Each pixel contributes three integers: red, green, and blue. The native renderer later uses P6, which has a text header followed by binary RGB bytes. Both are deliberately simple image formats; this first experiment uses P3 so you can read every value.

Our coordinates begin at the upper left. x increases across a row; y increases down the image. The order in which you emit values is part of the contract. A successful compiler invocation cannot tell you whether you swapped two axes.

TRY IT IN YOUR STUDIO

Run this program locally and inspect both the image and its text. Predict the first and last RGB triples before opening it. The website displays code and models; it does not compile C++ in your browser.

From the page to your own work

Your studio assignment.

Make one tiny image you can explain. Stop after the image and a short note; a window or engine is outside this mission.

A finish line you can see

Your own gradient or color-grid program, its PPM, and a note tracing one pixel from loop index to file values.

  1. Change the reference pattern deliberately rather than submitting it unchanged.
  2. Check the dimensions, first pixel, and last pixel against your prediction.
  3. Keep diagnostics separate from image output and test a failed write.
  4. Save one image and three sentences describing your change.
Keep the evidence in your weekly notebook ↗
Explain it like an engineer

Try answering aloud before opening the review notes. Use your own implementation as evidence.

Why can a successful compilation still produce an invalid image?
  • Separate language validity from image-format and coordinate contracts.
  • Explain loop bounds, pixel/channel counts, and stream failures.
  • Name one independently checkable output value.

These prompts support practice; they are not an automatic assessment of your work.

A small creative variation ↗

Change only the blue channel to make a two-band image. Keep dimensions and output format fixed.

Optional. Save it for later if this chapter already feels full.

Coming back after a break? ↩

Open your last PPM and read its header. Run the unchanged program once, then change one channel expression. No catch-up feature is required.

Books & principles behind this study +

Original Parallax explanations and assignments, with these works for further reading.

YOUR MARGIN NOTES

Leave yourself a good question.

What changed your mind? What would you try next?

Notes are private to this browser and saved as you write.

A CHECKPOINT, NOT A SCORE

Can you explain the idea and try the exercise yourself?

Completion records your own assessment. It does not compile or test your C++.
Companion source 3 files