Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit8d45df8664

README.md

countMap

The decode a counting camera view reads its result through: it recovers a per-pixel count from the fraction a counting geometry pass accumulated, and calls the view's own reading of that count.

A counting view blends 1 / levels additively for every fragment that satisfies its depth predicate, so its target holds count / levels. This body reads that fraction back out of the scene colour, multiplies by the levels the pass used — carried in engine.params.x — and rounds to the whole count.

Using it

The including shader declares the view's reading of a count and includes this body:

// @domain: post-process

fn zero_count_color(n: i32) -> vec3<f32> {
    if (n <= 0) { return vec3<f32>(0.0, 0.0, 0.0); }
    return vec3<f32>(1.0, 1.0, 1.0);
}

#include "~.shaders.countMap"

n is 0 where nothing was counted, and saturates at levels — so a view's open-ended "this many or more" band belongs at or below that number. Flat, nameable bands read better from a still than a continuous ramp: the question is which band a region falls in, not how bright it is.