Spent way too much time sitting down last night. With a second coffee, I ended up sitting still for 6 hours, and I got nearly nothing done in that time.
I took the script I had written to smooth the +1 hills, and converted it to a rounding script for +2 hills. That worked fine. Then I took that script and tried to make a random contouring script for +3 and +4 hills. Here's what it does:
- Selects faces with angle of ascent > 45 (code I wrote a few years ago called selectSteepFaces with threshold variable)
- Tessellates the selected faces, increasing the polycount of only that region, without moving the edge verts off a plane (to keep adjacent tiles lining up)
- Selects a random 3/4 of the faces previously tessellated
- Extrude those faces locally 1m
- Switch to selection of verts
- Deselect all verts on outermost edges
- Add some noise
- Push out the faces a bit to make the noise more prominent
- Tessellate those faces a bit more, taking off the edge
- Switch back to the main mesh body
- Relax the entirety quite a bit to soften the blocks, keeping the outermost edges fixed
- Optimize heavily to reduce poly count
- Smooth to a low face angle
- Texture map
This works well if the randomly selected faces are adjacent without selecting only 2 which share a vertex. Otherwise, when any vertex is shared by only two selected faces, a mathematical mistake happens in the GMAX process between extrusion and the next tessellation, which separates that twice selected vertex into two. It seems to happen when noise is applied, but there is no evidence to support that, because when the verts are selected and counted in that region, they show the exact quantity of verts you see, not +1. Once the noise-tessellation combo are placed in the modifier stack, the twinning separates randomly, creating a fissure in the mesh surface. The later relaxing only widens the hole, tearing the mesh to pieces.
When I did the previous tiles by hand, I specifically chose clumps of adjacent faces, and without even knowing, had prevented this issue. If I go back into the modifier stack and fill in the missing faces on the randomly selected face mod, it corrects the problem 100%. So that means, what I need to do is create a script that, instead of picking randomly, picks adjacent faces to make sure any given vert is shared by at least two adjacent edges, meaning it gets only two or more faces which are adjacent at that vertex. I'll also have to check to make sure any vert with more than 8 shared faces does not have faces selected in two opposite quadrants from that center vert. That is going to be a whole page of math, I fear.
An alternative I dreamt last night was to select ALL faces used by a single vert. But even in that scenario, I still have to error check that any other vert elsewhere does not share a face with that selected poly region. Less math, but still pain.
While I was getting my coffee this morning, I thought up an idea to select individual groups, rather than a random X groups, and apply the other modifiers to each group separately. If I do that, I can loop it, without further math requirements.
I hope it works. If so, this tileset is basically done, minus tweaking the placeables PWK data. I still cannot get ALL placeables to function properly ALL the time. If I modify the PWK plane to rest 1m above the ground, more of them work, but also some that worked previously no longer work. I cannot find a happy medium. Another issue is that some of the placeables are so large (full tile-width) that they cross a tile edge. This is no big deal if they cross an edge where both sides are same-height. But if they cross a height offset boundary, the engine can no longer see any PWK data in that adjacent tile.
Basically I need some help, and ideas for the PWK stuff.
Another idea I was having was to make bubbly PWK data. I don't know how exactly that affects the tile WOK data, but I am willing to try. Given the z-placement of any placeable with PWK, does it change the area which cannot be traversed? Is only the above-ground region flagged non-walk? I must find out.