Macro creation - how to parameterize the Range value of the Rescale (clamp) device?

I’m new to World Machine (and game dev in general).

I created a set of nodes for making a coastline, and I’m interested in converting it to a macro, and also making it parameterized.

The general idea for this macro is it should accept some shapes which define the land areas / continents:

And it should output a sort of “continental shelf”, where the land area is raised to a specified amount, with a natural looking transition from land to sea floor bottom:

NOTE: Apparently new users are limited to a single image upload per post, and a maximum of two external links per post. This makes it a bit tricky to explain the problem visually, though I would really like to do so - as a workaround, I’m pasting image IDs below - please prepend https://www.screencast.com/t/ to view the image

Image ID: nZD9enGNNwCY

Other than raising the land, the interior should be unaffected to the extent possible (that’s the goal anyway - still working on achieving that).

Here is the part I’m having trouble with. One of the devices I’m using in this macro is Rescale (clamp). I would like to make the “High” value of this device be a parameter of my macro:

Image ID: pAt3hily10

However, looking at the input ports available on the Rescale device, it appears rather than accepting the “low” and “high” values as individual values, it’s expecting a Range type:

Image ID: KIoAHWsXdp

I was able to find a “Construct Parameter” device, which seemed promising as it can construct a Range. However, I’m having some trouble figuring out how to use it properly. I can’t replicate the same output when using the Construct Parameter device as what I got when I simply plugged the values in directly.

Here is the setup I am trying to replicate when simply using the Rescale device directly, and the corresponding output that I’m getting:

Image ID: ecuW88s8Oc

Here is how I am attempting to use the Construct Range (Construct Parameter) device, and the output that I’m getting:

Image ID: 2g0RXKjV7PcK

The maximum value of 2625 was aimed to mirror the maximum value allowed for the range slider on the Rescale (clamp) device, which is 2.625 km. Likewise, the Second value of 256 was the same value I was using on the Rescale (clamp) device. I was expecting setting these values would result in the same output heightfield, but clearly they are quite different - so I must be misunderstanding something.

I wasn’t able to find any documentation for the Construct Parameter device, and I couldn’t find any examples of being able to parameterize a range in any of the macros available in the default library (unless they’re using a different technique that what I’m trying to do).

Any suggestions?

Hi there!

Welcome.

You should be able to do exactly what you want; the trick is understanding that by default, elevations in World Machine are actually stored as a value between 0…1, representing the minimum and maximum elevation allowed in your world.

So min and max values should be set to 0…1 to get the same thing as what the Clamp device does by default.

But how do you precisely specify the heights for your range?

A macro parameter you create that is set to Elevation will be used correctly. Just plug it into one of the value input ports. For the other end of the range, good question :slight_smile: This is an edge case; there should be a value toggle in the construct range device to let you specify the values as an elevation.

For now, just specify a height value as a fraction. “desired height in meters / project elevation maximum” (set in Project Settings->Project Setup). So if your desired other end was set to 80m, and your world max elevation is 2100m, then set to 80/2100 = 0.038

3 Likes

Awesome, that explanation really helped!

For my use case, the range is always 0 to some specified max value (which is really just the desired sea level). I just created an Elevation parameter representing the sea level, and plugged that into the Second value of Construct Range (leaving the First value as 0, and the Min/Max as 0 to 1), and that got me the equivalent result I was looking for:

Thanks again!

1 Like