got a scaling window going, yay
-
debug rendering tiles that are skipped because they're known to be blank
@eniko amogus
-
this is what the implementation for a vertex format looks like
InitGrads converts from the data to float (it's already float here),
GetPixel is the fragment shader
the TRI_STEP_COLOR_GRADS functions are there so i can use a compile time constant for the gradient loops so they get unrolled
and the rest is just injecting the triFill routine (if necessary) and creating a wrapper that calls it or the generic triFill with function pointers
not the prettiest but its C so it could be a lot worse
tfw the nested 8 count loops unroll perfectly 😌
-
tfw the nested 8 count loops unroll perfectly 😌
@eniko I can see the clean code take on this now. ZOMG, that should be a function call!
-
tfw the nested 8 count loops unroll perfectly 😌
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
-
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
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
-
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 every time I start a game project (and never finish) I think about: what if it was software rasterized?
software rasterization just has something to it.
-
@bnut the right can be skipped because you know when you've recorded coverage, so once you find a blank tile after you've had any coverage you know there are no more tiles in that row. the only way to do the left would be to iterate backwards and then you'd have the same problem on the right
the other option is to have an edge walking algorithm and that could actually be slower since this just steps through the bounding box in chunks
-
@bnut the right can be skipped because you know when you've recorded coverage, so once you find a blank tile after you've had any coverage you know there are no more tiles in that row. the only way to do the left would be to iterate backwards and then you'd have the same problem on the right
the other option is to have an edge walking algorithm and that could actually be slower since this just steps through the bounding box in chunks
@bnut you could conceivably do the same thing with the bottom edges but you'd have to step vertically in your inner loops which could trash cache locality
-
@eniko every time I start a game project (and never finish) I think about: what if it was software rasterized?
software rasterization just has something to it.
-
-
@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