pixels

Turn a captured coverage record into the fragment list behind one pixel.

The renderer hands algan.rendering.fragment_capture a chunk’s whole per-pixel record. This module reads one pixel out of it and says, nearest first, what is behind that pixel: how far away each surface is, which mesh and which Mob it belongs to, how much of the pixel it claims, and what colour it is.

On colour, and what the numbers here do and do not mean:

  • A fragment’s albedo is the surface’s own colour at the hit point, before any lighting. It is reproduced here from the same arrays the shading kernel fetches from – per-vertex colours interpolated at the fragment’s barycentrics, or the triangle’s colour map sampled bilinearly – so for those two cases the RGB matches what the kernel fetched, exactly.

  • The opacity shown against a fragment is the owning Mob’s authored opacity at that time, read off the timeline. The fifth lane the colour fetch returns is reported separately as material_alpha: it is faithfully what the kernel reads, but the merge encodes it, so it is not the number a user authored.

  • It is not the shaded result. The renderer keeps no per-fragment shaded colour, and adding one would mean editing a Taichi kernel. So a lit, glossy, refractive or shadowed surface contributes something other than its albedo to the finished pixel, and the two will differ.

  • Colours here are linear-light, the space the renderer works in. The composited pixel a viewer reads off the image is display-referred sRGB. Both are reported, labelled, rather than one being quietly converted into the other.

Where a fragment’s colour cannot be reproduced faithfully – a Bezier circuit, whose colour comes from a per-circuit grid, or a colour map built as interpolated endpoints – the fragment says so rather than reporting a number that looks right and is not.

One gap worth knowing about: only triangles name their Mob. A mob that builds triangles (Cube, Polyhedron, Surface, Model3D) stamps a mesh key on its primitive, and the merge now records those keys, so a triangle fragment resolves back to the Mob that authored it. A Bezier circuit – which is what Square, Circle and Text are made of – carries no such key, so its fragments report their circuit index and no Mob. Closing that gap means stamping keys in the 2-D mob builders as well.

Classes

PixelRecord

One render chunk's coverage, indexed by pixel.

Functions

decode_circuit_ref(ref)[source]

(circuit index, border fraction) from a negative fragment ref.

depth_of_key(key)[source]

The exact hit distance packed into the low 32 bits of a fragment key.

Return type:

float

mob_label(mob)[source]

How a Mob is named in the viewer: its class, its id, its name if set.

Return type:

str