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.

Triangles on a grid

SKETCHBOOK / 08 The raster workshop · 2-week chapter

Page 1 of 3: Turn the rendering question around

From rays to coverage

Turn the rendering question around

The ray renderer starts at a sample and searches the scene. A triangle rasterizer starts with a primitive and visits samples it might cover. Both ultimately assign values to an image, but they organize the work differently. This lesson begins with coordinates already on the screen so you can isolate coverage from camera mathematics.

The native raster lab uses x to the right and y downward, with samples at pixel centers. A triangle’s bounding box limits the search. Clamp that box to the validated viewport before indexing an image; offscreen geometry must not become a negative or oversized array index.

Run prism-raster to inspect the reference, then make a small triangle arrangement of your own. The existing composition is useful evidence that the reference runs. Your geometric postcard, tests, and explanation are the deliverable.

TRY IT IN YOUR STUDIO

Run ./build/clang-debug/prism-raster triangles.ppm from native after building. Change one vertex or color and predict the changed region before opening your output.

From the page to your own work

Your studio assignment.

Build your own triangle coverage experiment on a small screen-space grid.

A finish line you can see

A changed two-triangle image, coverage tests for your edge convention, and a sketch explaining one sample’s barycentric weights.

  1. Change vertices or colors independently of the reference composition.
  2. Test reversed winding and a degenerate triangle.
  3. Keep traversal inside the validated viewport.
  4. State whether shared edges may be visited twice and what a later exact fill rule would 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.

What do edge functions and barycentric weights each tell you?
  • Signed edge values classify a sample relative to oriented triangle edges.
  • Normalized weights describe the sample relative to the vertices.
  • Coverage, attribute interpolation, and a shared-edge ownership rule are separate policies.

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

A small creative variation ↗

Draw a small geometric postcard with at most six triangles and one intentional negative-space shape.

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

Coming back after a break? ↩

Reduce the image to one triangle. Calculate one edge value at one pixel center, then run that test only.

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 4 files