   Calculating coverage for software rasterization
  I'm trying to find implementation details on how to calculate pixel coverage (the area of the pixel covered by the triangle) when rasterizing triangles in software.  I did some googling but wasn't able to find anything helpful.  Does anyone know of any resources on this topic?   
  Assuming you have an already transformed and projected triangle (aka 2D)I believe that this is correct...TriangleArea = 0.5f * ((x1 - x2) * (y3 - y1) - (y1 - y2) * (x3 - x1));Edit:This site should be able to explain it:http://softsurfer.com/Archive/algorithm_0101/algorithm_0101.htm   ;Quote:Original post by meisawesomeAssuming you have an already transformed and projected triangle (aka 2D)I believe that this is correct...TriangleArea = 0.5f * ((x1 - x2) * (y3 - y1) - (y1 - y2) * (x3 - x1));Edit:This site should be able to explain it:http://softsurfer.com/Archive/algorithm_0101/algorithm_0101.htmThis isn't remotely related to what the OP's question was!He didn't want to know the area of a triangle!?Back on track:I guess there might be some performance tricks, but the naive way of doing it is to clip the triangle against the four pixel borders, then calculate the area of the resulting polygon.I assume you use this for some sort of AA?If you accept some quality loss you might get away by subdividing the pixel (2x2, 4x4 etc) and then calculate how many of the sub pixels centers are within the triangle.;  >I assume you use this for some sort of AA?It's for a lightmapper, when using low resolution lightmaps I end up with multiple triangles per texel.  I want to know how to weight each triangle's attributes toward the final result for that texel.  I'm currently doing what you said with sub pixel centers, but even with a large number of samples (16) small texels on UV seams won't get any triangles rasterized to them, so I was looking for an analytical approach.  I'll try clipping the triangle. Thanks!   