👻 Helper Pixels: The Hidden Cost of ddx and ddy
The rules for using ddx and ddy safely, and helper pixels: the extra, invisible fragment shader runs that 2×2 groups need. See them on your own GPU.
The rules for using ddx and ddy safely, and helper pixels: the extra, invisible fragment shader runs that 2×2 groups need. See them on your own GPU.
What ddx and ddy (dFdx and dFdy in GLSL) tell a shader, and how the graphics card works them out by comparing neighbouring pixels in 2×2 groups, with interactive WebGL demos.
In a busy scene, many pixels get shaded several times before the final colour wins. See a heat map of how often each pixel’s shader runs, and how draw order and a depth pre-pass cut the waste.
Why edges look like staircases, and the three classic fixes: draw more pixels (SSAA), test more points but shade once (MSAA), or blur the edges afterwards (FXAA). Compare them on your own GPU.
A graphics card runs shaders in groups of 32 or 64 that all execute the same instruction at once. See what that means for if statements, and how GPUs hide slow memory by juggling groups.
Trilinear filtering turns floors and roads seen at a low angle into blur. Anisotropic filtering fixes it by sampling along the pixel’s stretched footprint. Compare them side by side.
A pixel’s UV almost never lands exactly on a texel. Nearest filtering picks one; bilinear blends four. Zoom into a tiny texture and see exactly which texels are mixed, and by how much.
When two surfaces cover the same pixel, the depth buffer decides which one you see. Watch it work, look inside it, and find out why distant surfaces flicker through each other.
How the graphics card decides which pixels a triangle covers, using three simple edge tests per pixel, and how it makes sure triangles that share an edge never overlap or leave gaps.
The six steps every graphics card follows to turn a list of triangles into a finished image. Step through each one, then count how often each shader really runs.