redeclipse / base

Base environment for Red Eclipse and associated source files.
https://redeclipse.net/
431 stars 88 forks source link

Editor: Heightmap editor causes cracks when mixing grid sizes #1442

Open MirceaKitsune opened 11 months ago

MirceaKitsune commented 11 months ago

I believe this is somewhere between a bug and feature, given it's an undesired effect that shouldn't be happening but also a consequence of how the octree heightmap works and maybe difficult to solve.

To produce the issue: Press H to enable the heightmap editor, the selection highlight should turn from white to green. Select a given grid size, eg: 64. Use the mouse wheel to push and pull the ground, so far everything works as intended. Now switch to a smaller grid size even just half of the previous one, eg: 32. Try editing over your existing terrain: Cracks immediately begin to form in various places as sharp shards stick out of the ground.

20230926_165107

As this is a consequence of the limited ability of small octrees to sync up in various ways, the obvious solution would be to detect when such cracks would form and not preform the operation in those places: The heightmap editor would need to check the entirety of the surface(s) it's about to pinch and only do so if the entire affected area is able to bend without some voxels desyncing from others and producing gaps. Additionally the size of the movement could be snapped to the nearest distance at which all affected octrees will agree, even if it means making the hole or bump bigger than on a flat surface.

It would be a lot better to simply have nothing happen when a safe operation is impossible, instead of having stuff break and needing to manually find if and where such cracks occur and manually fix them. This should be an option though in case anyone prefers cracked terrain and could even use this flaw to obtain rocky cliffs.