| ▲ | thechao 3 hours ago | |||||||||||||
You only need to clip triangles is you're worried about attribute interpolation for very large triangles. There's two ways to handle this: (1) discard (fast but not a great user experience); or, (2) primitive synthesis. Just frustum clipping is enabled by point picking in the local tile. Primitive synthesis requires some FP kung fu; but, is easiest done in barycentric space against a reverse transformed clipping rectangle. This lets you carefully control clip rounding error using either doubles or (better) fixed point. Abrash likes to use integer fixed point, but that is historical — modern fixed point can be handled with careful control of the fp unit in the mantissa. The major issue is regenerating the Z and the 1/Z values for the new vertices of the synthesized primitives. Everything else should flow down the pipe naturally, assuming a deferred attribute synthesis rasterizer. There are examples in the open source version of my rasterizer: OpenSWR.org. | ||||||||||||||
| ▲ | delta_p_delta_x 3 hours ago | parent [-] | |||||||||||||
I'm clearly super old-school when it comes to rasterisation, and a lot of this has flown above my head. I have a ton of questions; I hope you can answer them. > (1) discard (fast but not a great user experience) What are we discarding here, and why is it fast but not a great user experience? > (2) primitive synthesis I assume this is retriangulating clipped triangles that are now no longer triangles? > reverse transformed clipping rectangle Which spaces does this reverse transformation map from and to? I assume the clipping rectangle here is the triangle's AABB in raster space (or as you say, barycentric space). > integer fixed point, but that is historical — modern fixed point can be handled with careful control of the fp unit in the mantissa So we are no longer doing 16.16 fixed point, but tweaking the FP representation itself? > The major issue is regenerating the Z and the 1/Z values for the new vertices Why is this a major issue? > deferred attribute synthesis rasterizer I assume this means attributes are perspective-correct interpolated in raster space. | ||||||||||||||
| ||||||||||||||