Greedy Meshing is a concept meant to adapt voxels, which are hard to compute, into large quads, making them easier and in many cases possible at all.
Note: This example uses iteration per block for the column comparisons necessary for 2nd dimension (in this case x axis) expansion which is NOT the optimal method in terms of performance. In the future, if asked I might create an example of efficiently doing it via bitwise operators, but to be very honest there are much better languages (e.g. C/C++, Rust, etc.) for demonstrating that and countless examples in them too.
This demo generates an image out of noise and then greedily meshes it into rectangles.
If you'd like to see how expanding down one dimension (in this demo the y
) before expanding that down the other dimension (in this demo the x
) works just enable the DEBUG_VISUALS
to see