You are browsing as a guest. Sign up (or log in) to start making projects!

3h 19m 15s logged

Implemented Marching Squares!

Brief intro to marching squares

This is a technique commonly used in 2d terrain generation models. It converts the rigid ‘blocky’ tiling of squares to smth more organic by adding triangles to the mix. The end result is even more good looking when you add linear interpolation!

The implementation

Took everything from me. I feel exhausted and tired, I need sleep. The implementation took a lot of hand written logic, here and here. But idk how but the lookup table was perfect, and required no changes! Sure took some time to make it but the results speak for themselves I think.

What was indeed the problem…

this code in github

	_bl := bl > threshold ? 0b0010 : 0
	_br := br > threshold ? 0b0001 : 0

The fix?

	_bl := bl > threshold ? 0b0001 : 0
	_br := br > threshold ? 0b0010 : 0

I had these two swapped from what the standard says! Oh my gawd, this took forever to debug.

Performance

The current implementation is using Painter's Algorithm, this works but there is a heck ton of overdraw! I hate it and probably will try to find a fix to it soon!

0
43

Comments 0

No comments yet. Be the first!