Log inGet started
❒
package · drop-in viewer
asset⌬ packagepackageprimary: package.yaml·originates fromworld 07158574-5…

debanding

Removes the contour lines that eight-bit storage leaves in a shallow gradient.

by◐lumi·posted 4mo ago
What it does

debanding

Removes the contour lines that eight-bit storage leaves in a shallow gradient.

A procedural sky, a light falloff or a soft shadow often covers only a dozen code values across hundreds of pixels. Stored in eight bits that ramp becomes a staircase — shelves tens of pixels deep, each separated from the next by a single-code step that runs unbroken across the frame. The eye reads every one of those steps as a line, which is why a smooth sky looks striped.

When to use it

The frame's own quantization needs none of this: the output stage writes the presented surface with a blue-noise dither of one step (renderer.output), so a gradient the scene renders smoothly reaches the screen without shelves. This package is for a picture whose input already holds the staircase: a decoded 8-bit texture, a video frame, a capture played back. It rebuilds the ramp those inputs lost before they were handed to the frame.

What the package contains

AssetRole
Debanding.componentThe settings, on an entity. One per scene is enough.
debanding.moduleThe API — set / enable / disable / get / active.
gradientDeband.renderFeatureThe compute pass.

Where it runs

In the display stage, on the code values the display transform wrote, ahead of the edge antialiasing and the sharpening. A picture of the debanding is read from the presented frame (renderer.presentedFrames, a capture with source = "presented"): the display stage's render-feature passes draw there.

How it works

By the time any pass in the post chain sees the frame, the ramp is already on the eight-bit grid. What the staircase still carries is where the ramp crossed each boundary: inside a shelf every neighbour reads the same code, but within a radius of a boundary some neighbours read the next one up, and the fraction that do is the sub-code position of the true ramp.

So the work is two halves:

  1. Reconstruct. The pass averages rings of taps around each pixel, recovering a value that lies between the two codes, and writes it in float.
  2. Dither. The output stage's triangular-PDF dither of one code decides which side of the boundary each pixel lands on, at a density set by that reconstructed value, when it rounds the frame to the surface.

It needs both, because each fixes a different part of the artifact. The reconstruction makes the boundary land at a different row for each pixel, but on its own leaves the shelf as deep as it was — merely ragged. The dither collapses the shelf, but on its own it has only integer codes to work from and still lays down a measurable line. Together the shelf becomes a gradual change in the mix of two adjacent codes, and what is left of the boundary is no longer than independent noise of the same density would produce by chance.

Real detail is protected by a flatness guard rather than an edge detector: every tap in a ring must sit within threshold codes of the centre, or that ring contributes the centre unchanged. A few codes is the entire range banding lives in, which is why the same guard is both the quality control and the reason the pass cannot soften texture.

Usage

local id = entity.spawn("debanding").id
entity(id).component.add("Debanding", { threshold = 3, radius = 16 })

or directly:

local Deband = require("@builtin::systems.debanding.debanding")
Deband.enable()
Deband.set({ threshold = 3, radius = 16, grain = 2 })

Settings

FieldUnitMeaning
strength0–1How much of the rebuilt gradient to blend in. 0 releases the pass.
thresholdeight-bit codesNeighbourhood spread that still counts as flat.
radiuspixelsOutermost tap distance — the widest shelf this can cross.
ringscountTap rings between the centre and radius.
graineight-bit codesDepth of the noise over the rebuilt ramp: the width of a triangular dither on each side.

threshold and grain are in code values because that is the unit banding is measured in: a shelf is one code deep, so threshold = 2.5 means "treat a neighbourhood spanning up to two codes as flat". grain = 1 is the output stage's one-code dither, the one dither the frame has, which carries a rebuilt value across a boundary. A deeper grain adds the rest as an even film grain, the floor of @builtin::systems.lensFx.filmGrain, registered as the debanding.grain post-process effect: the width of the triangular dither whose noise power, summed with the output stage's, is that of one grain codes wide.

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

This asset doesn't declare a schema or structured payload.

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported on this asset or on the parts this page shows. Parts it leaves out are not counted here.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ quality × 0.35
+ performance × 0.25
± compat factor

Usability ratings

Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.