Seeing screenshots of 3d[-ish] games here and there, a question arises - how does one draw filled triangles, and does so efficiently? I have tried porting one-before-last-step algorithm from here:
which resulted in this little monstrous function:
but, alas, the math is just too much - it can barely draw half of screen worth of triangles before CPU use reaches 1.0. And that's before there's even any game!
I'd appreciate some pointers towards algorithms more suitable for pico-8. Or any help, really.
I wonder if a simple scanline filler might run a bit better: http://www-users.mat.uni.torun.pl/~wrona/3d_tutor/tri_fillers.html
You are still going to run into issues with depth sorting or whatever, but that should run a bit faster?
here is a test rendering 50 tris at 70% cpu (which, tbf, probably isn't much to ram the rest of the game + zsorting into)
Thanks for sharing your code.
@YellowAfterlife I using your trifill code to make Windy and
I'm interested in increasing the performance and reducing seam bugs. I'm actually drawing 4 tris per quad and there are still corner seams appearing!
I'll try to optimize your code and benchmark the progress.
[Please log in to post a comment]