Writing this down for my own sake
-
Writing this down for my own sake
The edge function E=(y1-y0)(x-x0) - (x1-x0)(y-y0) for a fixed point position with N fraction bits can be represented exactly using N*2 fraction bits
Also, to represent weights anywhere in a triangle's bounding box, the weights not normalized by the triangle's area approaches pow2(max(bboxW, bboxH))
So the maximum side of a triangle in a weight stepping rasterizer can be derived from those two pieces of information
-
Writing this down for my own sake
The edge function E=(y1-y0)(x-x0) - (x1-x0)(y-y0) for a fixed point position with N fraction bits can be represented exactly using N*2 fraction bits
Also, to represent weights anywhere in a triangle's bounding box, the weights not normalized by the triangle's area approaches pow2(max(bboxW, bboxH))
So the maximum side of a triangle in a weight stepping rasterizer can be derived from those two pieces of information
For a position with fraction bits N in a 32 bit integer, the integer bits will be 32 minus N*2 for the fraction minus 1 for the sign bits
So the maximum side of a triangle's bounding box for position with N bits fraction is sqrt(2^(32-N*2-1)-1)
So that gives you the weight stepping fixed point format, and the maximum triangle bounding box side, and the weights can be calculated and stepped exactly without any loss of precision or error
-
For a position with fraction bits N in a 32 bit integer, the integer bits will be 32 minus N*2 for the fraction minus 1 for the sign bits
So the maximum side of a triangle's bounding box for position with N bits fraction is sqrt(2^(32-N*2-1)-1)
So that gives you the weight stepping fixed point format, and the maximum triangle bounding box side, and the weights can be calculated and stepped exactly without any loss of precision or error
@eniko Correct. And this is one reason that graphics APIs *require* snapping to a subpixel grid before rasterisation (typically 8 or 12 bits). Because then the entire rasteriser can be in integers, and exact, so adjacent triangles don't miss any pixels or hit any twice.
-
undefined oblomov@sociale.network shared this topic