MicroVerse is my world maker of choice. It lets me experiment, without worrying I’ll lose existing work.
Buuuut…. sometimes I have trouble getting things the way I want. This post explores something that seems simple, but I had trouble with.
Let’s check out a sample scene. Here’s the hierarchy:
There’s a terrain. On that, there are three height stamps. Meadow covers the entire terrain. Hill makes, er, a hill. It covers part of the terrain. Pit makes a depression in one part of the terrain.
Making a pit is tricky, for me, anyway. AFAIK, terrains can’t have negative height anywhere on their surfaces. To make a pit, you need to move the terrain up. This terrain is at 500 meters (on its transform’s Y position). So, a point at 300m will be 200m below the surface.
The terrain is 1k by 1k, as you can see.
The Meadow stamp covers the entire surface.
It’s positioned in the center of the terrain, at a height of 800m. Its height is 30m, so it’s more rolling rather than steep hills.
The hill uses the Rugged Rocks 02 height map that comes with MicroVerse.
It covers part of the terrain, rather than the whole thing. The base is large (300m by 300m) with a moderate height (50m), so the hill is spread out.
The pit uses the same height map file as the hill, but it’s inverted, and uses Min mode.
The pit therefore digs into the meadow, rather than rising above it.
A sad cube
You can see a gray cube in the scene.
It’s partway up the hill. So, the terrain is at 500m, and Meadow is at 800m. Should the cube’s transform be around 1,300m (terrain and meadow height are added), or about 800m (the meadow’s height alone)? Hmm.
Here’s it is:
It’s around 800m. Since the Meadow’s vertical position (Y axis) is 800…
… we can tell that the Meadow height stamp’s Y position is relative to the world, not relative to the terrain.
Let's have some grass
There are two texture maps, one for dirt, and one for grass. The dirt one covers everything, and has no filters. The grass is more interesting. We want it to start partway up the hill.
You do that with filters, in this case, a height filter. You tell MicroVerse the height at which the texture starts and ends.
Here are the relevant parts of the grass stamp, with some values blurred out for now.
At the bottom, the range fields tell you where the grass starts and ends on the vertical axis. The labels aren’t great. X isn’t about the X axis. It’s a start value on Y. The fields would be better labeled Y Start and Y End.
The sad cube’s Y is 825, and it hits the bottom of the grass area:
You might expect the bottom of the grass’s range would be 825 as well. But…
Ack! The filter starts showing the grass at 325m! Remember, the cube’s transform says 825m, and the cube and the bottom of the grass area are at the same place in the scene.
325 is not an absolute world value. It’s relative to the terrain. The terrain starts at 500, so setting the start of the grass range at 325 means it starts at 825 in world units. If you want to put a GameObject at the place where the grass range starts, you can’t use the grass range’s value. You need to allow for the terrain height.
(In case you’ve forgotten, we can’t set the terrain’s Y to zero because we want to dig pits, and their Y’s can’t be negative.)
Note: you adjust for the terrain’s height, not a height stamp’s height. This makes sense, since the final height at a point can depend on several height maps.
BTW, AFAIK, the texture stamp’s transform’s values don’t matter for a global texture stamp, which the grass stamp is. Also makes sense.
You might ask yourself, “Self, if the range start is relative to the terrain, the range end would be relative to it as well, right?” Yes, your self is correct. Let’s change the end value from 1,000 to 326, and zoom in:
As expected, a short band of green. Hmm, that could be an Irish kid’s band: Short Band of Green.
Does this make sense?
Should MicroVerse use relative values for the start and end of height filter ranges? Beats me. I found it confusing, but there could be good reasons for it. It’s not a big deal to adjust for it if you know what MV does.
It’s not an issue for terrains starting at zero, either. I’m guessing most do.
Overall, I loves me some tasty MicroVerse. Num num num! I don’t have the roads package yet, but if it’s as good as the rest, I’ll be a MicroVerse roady, too.