got a scaling window going, yay
-
@bnut hm, interesting thought!
-
-
@bnut hm, interesting thought!
@bnut i think the calculations for all the weights/attribute values for each edge tile might still be more expensive than just stepping
-
wake up babe hierarchical tiled triangle rasterizer just dropped
each meta tile is 4x4 tiles which are 8x8 pixels. magenta and red tiles are blank meta and normal tiles, white and cyan are fully covered meta and normal tiles
@eniko why stop at 4x4? - or rather, why two fixed levels rather than a full quad-tree structure?
-
@eniko why stop at 4x4? - or rather, why two fixed levels rather than a full quad-tree structure?
@eniko btw, for the corners between tiles, do you test that point 4x per triangle edge (once for each neigboring tile) or can you share the result between tiles?
-
@bnut this isn't lerping anything. it calculates all the stepping increments once up-front and then does addition across the entire bounding box to get the weights and attribute values
i guess maybe you could step them along with the bresenham? 🤔
-
@eniko btw, for the corners between tiles, do you test that point 4x per triangle edge (once for each neigboring tile) or can you share the result between tiles?
@nicklockwood you can share the result but i'm not, since calculating the corners is only 3 additions and most of the work is in checking them all together, and sharing the corners is more bookkeeping and would make fully covered tiled a little less common
-
now i need to convert it from floating point to fixed point and i'll be mostly done with the optimizing stage. then i'll add some different rendering options (it just does flat and gouraud atm) and put it on github
@eniko is the gourard shading just bilinear interpolation of vertex colors supplied by the caller, or do you actually have a lighting model on top?
And if so, what do you do in flat shading mode if a triangle has different vertex colors?
-
@bnut that could work 🤔
i've done a lot of work on this and am ready to stop though so i'm not gonna try it >_>
-
@eniko why stop at 4x4? - or rather, why two fixed levels rather than a full quad-tree structure?
@nicklockwood it's harder to write a generic dynamically sized hierarchical system that's also fully optimized. also, at 32x32 even at 8k resolution that's only 240x135 meta tiles, so i'm not sure it has a ton of advantage
-
@eniko is the gourard shading just bilinear interpolation of vertex colors supplied by the caller, or do you actually have a lighting model on top?
And if so, what do you do in flat shading mode if a triangle has different vertex colors?
@nicklockwood it's just bilinear interpolation. the way it works is that vertices can have any number of interpolated attributes, so in gouraud it has r, g, and b attributes. in flat color mode it doesn't actually step the attributes at all and just pipes the color value straight through
-
@bnut a simpler optimization would be to count left sided vs right sided verts and switch iteration direction based on that
-
now i need to convert it from floating point to fixed point and i'll be mostly done with the optimizing stage. then i'll add some different rendering options (it just does flat and gouraud atm) and put it on github
ok ok one more. i'm checking right sidedness by counting vertices on the right side of the bounding box center, and if it is a right sided triangle i change the horizontal tile iteration from left-to-right to right-to-left
so now the left image's triangle doesn't do a bunch of extra work
-
ok ok one more. i'm checking right sidedness by counting vertices on the right side of the bounding box center, and if it is a right sided triangle i change the horizontal tile iteration from left-to-right to right-to-left
so now the left image's triangle doesn't do a bunch of extra work
@eniko This reminds me so much of a book I still have somewhere with assembly drawing routines from the demo scene of the late 90s.
Pro: taught me how to rasterize a curved line.
Con: I forgot everything.
I also don't remember the target platform.