"You will never make an engine faster than mine."

1,588
0
Published 2023-08-23
I'm not going to make any claims except for that this project is pretty funny and you should laugh :)

Alternative name: GG Timing Test

The goal of this project was to:
1. Modify Gamma Engine to beat @TheGoodGuy8000's Astral Engine

The conditions for this challenge were(given by TGG8000):
1. To be able to render models with at least the graphical fidelity of Astral Engine(assumed but not explicitly stated)
2. Must have z-clipping
3. Must have real-time lighting

Extra conditions(by me):
1. Must render all scenes with no more artifacts than Gamma Engine "normally" (This, I did not meet because I was too lazy. Most scenes render perfectly though so I didn't worry too much.)
2. May not use a sorting algorithm during runtime(basically must use BSP)

What did you change?
So I thought it would speed up the traversal time if I just terminated the partitions early and stored the nodes as convex sets of polygons. I don't think I even did this correctly, as there are a few issues with some models. It does work most of the time though. The second big optimization was switching worldview vertices with projected vertices before rasterizing. Oh yeah and new trifill and quadfills. Yeeted lots of rendering stuff

Did you succeed?
I honestly do not know but if I didn't I don't really care because I spent hardly any effort optimizing this. So probably not XD

Can this be faster?
I'd say, yeah definitely. There are still bits and pieces that can be optimized(Although, you'd have to yeet most of them... but that is the game of optimization I guess XD)

Did you even compare speeds?
Lol no XD I only compared traversal/sorting, transformation, and rasterization speeds on the cylinder model. Plus, the timing on Astral did not have an averaging system and I was too lazy to average those values. I haven't tested other scenes but specifically built scenes will likely run faster on this engine. We don't talk about Suzanne though...

The cylinder has slight gaps in it?
I don't care.

What does this all mean?
I guess much of it boils down to the rasterizer at this point. And none of the trifill/quadfill code in this project is original. I must also say, this BSP optimization will probably not work well with dynamic objects. This fun little optimization game did help me find a few ways to boost some speed I guess.

Credits:

3D BSP sort adapted from @Chrome_Cat's 2D BSP sort. Compare the code, which can be found here: https://scratch.mit.edu/projects/714869495/

I originally used a triangle filler by @-Rex-(@-Rex-Test-): https://scratch.mit.edu/projects/509029922/

Uses z-clipping algorithm by @Chrome_Cat(@ChromeCat_test): https://scratch.mit.edu/projects/787193208/

The quad filler is from @ggenije(uses modified tri filler below): https://scratch.mit.edu/projects/882039002/

Tri filler is modified from @tsf70 by @KryptoScratcher(@KryptoAlt): https://scratch.mit.edu/projects/885002848/