Terraforming Making precise to-scale models of any area with WorldEdit

Iwan

Lean forward and grab!
Admin
-1. Introduction
Working with miniatures or models of a build has a great deal of advantages. It's an easy way to communicate your ideas of an area to others (incredibly useful when applying for a project or working on a co-op!), it lets you try out things and make quick and easy changes, and it's inclusive, meaning that you can work on it with others. Last but not least, it forces you to focus on layout and composition, which is crucial in early planning stages, because it avoids you getting caught up in details that don't yet matter at such an early stage. However, if you ever tried to make a model for a build you're met with a certain challenge up front: Getting the existing terrain right.

Luckily, there is a quick and easy way to create miniature representations of any area thanks to WorldEdit. I advise absolute caution with what you're about to learn. WorldEdit is incredibly powerful, start small and work your way up, work with copies in the beginning, and always double check your selections and the commands you're running.

The WE command this process utilizes is the //deform command. This guide is separated into 2 parts, first we are going to take a little excursion to look at the //deform command, and the WorldEdit Expression Syntax in general, in some more detail, and then we will head on the server and use it to create a miniature representation of someplace nice.

0. Excursion: //deform, //generate and the WorldEdit Expression Syntax
Both commands allow for the manipulation of an area by mathematical expressions. The names are pretty self-explaining:
//generate (or //g) takes an expression and generates an area according to it
DescriptionGenerates a shape according to a formula.
See also https://tinyurl.com/weexpr.
Usage//generate [-chor] <pattern> <expression...>
  <pattern>The pattern of blocks to set
  <expression...>Expression to test block placement locations and set block type
  [-h]Generate a hollow shape
  [-r]Use the game’s coordinate origin
  [-o]Use the placement’s coordinate origin
  [-c]Use the selection’s center as origin
//deform deforms an existing area according to an expression.
DescriptionDeforms a selected region with an expression
The expression is executed for each block and is expected to modify the variables x, y and z to point to a new block to fetch. See also https://tinyurl.com/weexpr
Usage//deform [-or] <expression...>
  <expression...>The expression to use
  [-r]Use the game’s coordinate origin
  [-o]Use the selection’s center as origin
-
A common use case for //deform is the //deform rotate command which allows for non-orthogonal rotations (now obsolete since the regular clipboard rotation command //rotate takes arbitrary values, too.)

WorldEdit's Expression Syntax makes WorldEdit so much more than a mere tool to push around some blocks. In order to achieve our goal (that is: to make a miniature of any given area), we need but a small fraction of its powers. However, read up on how to use the Expression Syntax and come up with some nifty //generate or //deform tricks if you like!

1. Making a model
If we are given a certain area that we would like a miniature representation of (for instance, to make a model for a town or castle project) we are confronted with two necessities we need to meet for the model to be of any actual use:
  • Everything in the model needs to be to scale
  • The terrain we base our model on needs to be represented correctly.
Meeting the first requirement means being aware of the scale your model represents reality at, and sticking to it. Good scales to work with are 1:3 or 1:4, which means that one block on the model represents 3, respectively 4, cubic blocks on site.

1.1 Selecting the Area
Your model needs to show the relevant parts of what you have in mind. If you make on to apply for a project, it's not necessary to make a model of the entire area, but make one of the castle or the town or village. Think about what things may best be shown with a map, and which things you would rather show using a model.

Once you've decided on an area (for instance for a town) you want to represent in your model, make a selection that includes the entirety of the area.

1.2 Calculate the lengths of the edges
When selecting a cuboid selection WorldEdit logs the selected positions to your chat:
(FAWE) pos1 set to (<X_1>, <Y_1>, <Z_1>)().
(FAWE) pos2 set to (<X_2>, <Y_2>, <Z_2>)().

X indicates the left-to-right axis (so when you move from west to east on our map), while Z indicates forwards and back movement (north to south on our map). Y is the up- and down vector.

We get the length of the X and Z axis by
L(X) = abs(X_1 - X_2) and L(Z) = abs(Z_1 - Z_2)
You can use the /math command to calculate that inside minecraft, which allows you to simply retype the X- and Z-values WE logged previously. Simply run
/math abs(<X_1> - <X_2>) and
/math abs(<Z_1> - <Z_2>) as commands.

The returned numbers are the absolute lengths of our X- and Z-axis. We are going to need these in a moment.

1.3 Find the center of the selection
Next we need to find the relative center of our selection. Simply run the //center command, pass a block of your choosing as the parameter.
//center 103 will create some nice melon blocks in the center of our selection. Now it's just a matter of finding them. Once we find it, we change both our selection points to it. If there is more than one block we can pick any.

1.4 Calculate the size of the model
Now we need to know the dimensions of our model, which leads us back to the scales we talked about in 1. Remember, picking a 1:3 scale means representing each 3x3x3 blocks by one block on a model. That means that we divide each of the 3 axis by 3. A scale of 1:4 would naturally mean a division of each of the axis by 4.

To get the size of our model we now simply have to divide the lengths of the X- and Z- axis we previously calculated by the factor we chose. We're going to go with a 1:3 representation in this example, so L(X)' = round(L(X)/3) and L(Z)' = round(L(Z)/3)

/math round(<L(X)>/3) and
/math round(<L(Z)>/3) return the respective values and rounds to the next integer.
The two resulting values will be the X- and Z- dimensions of our model.


[1/2]​
 

Iwan

Lean forward and grab!
Admin
1.5 Expand the selection
So, from the center of our area we now want to expand in all 4 directions to create a selection of roughly the same dimensions that we just calculated. The command //expand <val> <dir> does the trick. It's important to keep in mind that we need to expand by half the total lengths of the respective axis, so first we need to calculate val_x = L(X)'/2 and val_z = L(Z)'/2. Simply enter
/math L(X)'/2 and
/math L(Z)'/2 respectively.

The commands we issue to expand our selection in the N-S and E-W directions are
//expand val_x e
//expand val_x w
//expand val_z n
//expand val_z s.

Thus far we should be working on a single layer of blocks, so lastly we need to expand vertically, too. The maximum height required of our selection will be the maximum height divided by our factor, so L(Y)' = round(256/3) = 85 in this example.

However, the height we actually need to represent is determined by the landscape we want to depict. A flatter area will be fine by representing half or even a third of the total height, and an //expand 40 u should certainly do the trick in those cases. If however your terrain is very volatile and covers a large range of the Y- axis, you will need to expand beyond that. In that case the following step will be increasingly difficult and you will likely have to make a copy of the terrain beforehand.

It is advisable to limit the range of the Y- axis to something smaller than L(Y)', simply because there is usually a lot of empty space above a certain point. We can certainly represent the entire height however, simply use L(Y)' as the expansion value (use //shift to move your selection to 256/2 and expand by L(Y)'/2 in both directions!) This just makes it much more likely that now our selection cuts through some of the terrain, especially if there is a certain volatily in the terrain, so you will most likely have to work with copies of the area.

1.6 Position the selection
If we limit us to a fraction of the max height, we now need to position our selection to as low an Y- value as possible without cutting anything in the area. Use the selection indicator/CUI to assert that there is nothing inside the selection. This will not always be possible, in which case you either need to ask a friend to make a copy of whatever is being cut off, and be ready to paste it back in later, or you need to make a copy yourself and start the process from scratch. It is absolutely crucial to not cut through anything on the map; everything inside our current selection will be affected by the command we are about to use.

1.7 Running //deform
The final step requires us to run the actual //deform command. The syntax we use looks like this:
//deform x/=1/F;y/=1/F;z/=1/F with F = 3 in our example.

Let the command run. It may take a couple of minutes even on smaller areas. Once it's done, assert that it includes the area you wanted, especially the Y- values, and //undo and shift down if necessary. Assert that nothing was cut off.

1.8 Clean-Up
Finally, all that is left to do is to clean up. The algorithm is likely to produce a number of artefacts, especially around the center of our selection, where it attempts to go above and beyond and produce an even smaller model, the silly thing. Simply clean up everything you don't need.

Now, copy the model to your test plot and go wild.

2. Conclusion
This is an incredibly easy way to make to-scale, precise representations of any given area, ideal to create a base for a model. This method can be used by any mod or editor with access to WorldEdit. It works best with untouched terrain, structures like trees or houses may require manual fixes.

For an example of this at work, visit /warp MiniOT.

Please always double check your selections and commands! WorldEdit has the ability to fuck us up for real. You are responsible to clean up after yourself!

[2/2]​
 
Last edited:

Iwan

Lean forward and grab!
Admin
It's just important to keep in mind that the larger that factor, the lower the model's resolution. A 1:6 or 1:8 model has its merits if you want to show a large area, but will inevitably lack in detail. Still, a very commonly used ratio.
 
Top