mh. stairstep effects in in shadow mapping are just a symptom of inaccurate z-buffer rasterization. the z-value chosen per pixel should be the maximum depth of the intersection of frustum pixel and triangle, not the average or center value. then the stairstep effects will vanish. applying a bias instead is a terrible solution.

you can see below how the error is caused by taking the midpoint as depth; if the max depth were taken (red lines) we'd have no issue.

if we had normal information for each pixel in the shadow map, then taking the center depth value would probably be sufficient, as the plane at that point can be reconstructed from the normal, and we can test points against per-pixel planes. then a much smaller bias can be applied.

also, from the same plane, the max depth value can be reconstructed.

@lritter what happens on texels with more than one plane, or where the surface stops?
@breakin nearest z-value wins, so that one defines what the plane is. if you derive the max depth value then even in the case below, the blue part would be shadowed. you still need a value biased in the direction of the high res normal i guess; or have the rasterizer be more conservative somehow. sigh.