Log In  

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:
http://forum.devmaster.net/t/advanced-rasterization/6145
which resulted in this little monstrous function:
https://gist.github.com/YellowAfterlife/34de710baa4422b22c3e
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.

P#11928 2015-07-27 18:20 ( Edited 2015-09-20 19:28)

2

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)

Cart #11932 | 2015-07-27 | Code ▽ | Embed ▽ | No License
2

P#11931 2015-07-27 18:58 ( Edited 2015-07-27 23:19)
1

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.

P#14432 2015-09-20 15:28 ( Edited 2015-09-20 19:30)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-04-18 14:39:54 | 0.013s | Q:18