This is a script in a prim that you can use to generate smooth terrain in your regions.
Instant terrain to order in large or small var regions.
Check out this video for a flyover of an 8x8 var filled with terrain made by this script in less than a minute.
You specify a few control points and smooth terrain is made to connect your dots. Control points in an NC will force hills, plains, lakes and islands. Or the script can generate "random" terrain in adjacent regions that match perfectly at the borders. After the basic shape is determined by control points and randomness, you can specify other parameters to scale the land up by a factor, offset the terrain up or down, rotate or flip it. These parameters can be set by typing them in chat near the prim or adding them to the .params NC in the prim. The terrain is generated by a script, not by reading a RAW file, not by receiving the terrain via email or a server. But the result is real terrain data that can be saved in a RAW file. These RAW files are your creations that you can give away or sell if you wish. Terrain generated this way loads blindingly fast compared to a RAW file, taking seconds to fill a standard 256x256 region, under a minute for an 8x8 var. This is also much more reliable than uploading a RAW file.
Buy it on the Kitely Market here
This scripted object works on OpenSim 0.9 or 0.8, but it REQUIRES Owner permissions, Estate Manager and Threat Level HIGH. How do you know if you can use my terrain tools? Get a copy of the Terrain Test Prim first:
Terrain Test PrimTest for these issues with the Terrain Test Prim which is available free in my Kitely world Fractalis. You can hypergrid there with this address: grid.kitely.com:8002:Fractalis . The full perm script from the test prim is available here. Or you can buy the Test Prim ready to go from the Kitely Market here for a small price.
The Terrain Test script also checks for a common OpenSim bug: On OpenSim regions hosted on Microsoft servers, some innocuous script calls take up to 10,000 times longer to run! The result of this is that it takes hours to generate terrain on a large var on a Microsoft Server, when it takes under a minute on a Linux server. The Test Terrain prim will stay yellow to warn you about this if you are running on a Microsoft Server.
Smooth Terrain Step-By-Step Tutorial:The script that generates terrain has a bewildering array of options that will take you a while to learn. The tutorial below has step-by-step exercizes you can follow along with to learn progressively more complex tricks.
Follow AlongYou can follow along and do all the examples in this tutorial if you have a region where you don't mind changing the terrain. The easiest thing to do is to rez the Smooth Terrain prim in a 256x256 region and click on it (twice if it is still warning you with red floating text). It will fill your region with the default smooth island.
This new terrain will overwrite the previous terrain, so I hope you did this in an empty region or one where you were not fond of the previous lay of the land. You may want to move the Smooth Terrain prim above the ground in case the new terrain rises up around it. Or wear the prim on you hand like a magic wand.
Options for Modifying TerrainThis terrain has a specific shape, but it can be modified to a great extent with several other commands in chat. You can make the terrain steeper by multiplying it by a factor:
factor=2 //make all the terrain twice as tall gen
You can also raise and lower the terrain fromthe bottom without stretching the tops:
factor=1.0 //lets put the factor back to the default offset=20 //push the terrain up 20 meters gen
The terrain can also be flipped north/south with ‘flipy=on’, (flips north/south), ‘flipx=on’ (flips east/west) and ‘rotate=90’ which can rotate the terrain in 90 degree increments.
offset=0 //lets put the offset back to the default rotate=90 //rotates the land 90 degrees clockwise gen
Terrain Cubic Control PointsThe default smooth terrain is an island with water around it, a 60 meter peak in the NW, a 40 meter peak in the SE. These high and low points are there because they are in a table in the default .params NC. You can edit this NC and enter a new table with a different starting shape. Try changing one of the peaks in the NC to a different value, save the NC and type 'gen' to generate new terrain. Let’s look at the default table first and see why it produces the island we have seen so far:
The area highlighted green in the middle of this table are the control points inside your terrain. You can see the 60 meter peak in the NW and the 40 meter peak in the SE. Note these values are all floating point, but I am entering all numbers as two digits to make the NC more readable.
The area highlighted yellow are the control points around the edge of your terrain. The terrain edges end with these values. To force this to be an island in this case, I set all the edge values to zero. The water level is normally at 20 meters, so a value of 0 is 20 meters below water and the peak at 60 is only 40 meters above the water.
The area highlightd in red are control points that determine where the terrain is sloping as it leaves the edge. These could be control points copied from regions next door to make region terrain meet seemlessly. I'll give an example of that next. In this case, the value of -20 makes the terrain slope as if it would continue going deeper if it extended off the edge. Above you have already seen the island that this set of control points produces.
Matching Terrain Across Region BoundariesOne way to make terrain match across region boundaries is to make sure that the edge and slope values match in the control points of both regions. The red slope zone of each side must match the first row of green interior values of the other. Here is a simple case where that has been done, and below that a picture of the terrain produced:
You could make a copy of the table above, turn it upside down, overlap it with the original with the yellow values lined up. You would see that I made it to match up with itself like that. The red area of one of them has identical values with the green and other edge points. You could make a new .params file with the lines swapped around like that, or you could just put this terrain in the region north of the last one and rotate it 180 degrees:
If you look closely at the border between the two regions, the terrain matches perfectly. Even the terrain texture has the same patterns in it, and there is only a shadow where they meet. This shadow is a feature of the viewer, there is nothing I can do about this!
If your terrain is more complex, you may have to create a different .params file for each region. As much work as that may be, it is a LOT easier than making all this terrain by hand! However, the next example will show an even easier way of making seamless terrain:
Random TerrainThe special value 'ran' in the sample point of the NC means the script supplies a random number at that point. You can specify the range of the random numbers with two parameters 'ranmin' and 'ranmax'. Below is a simple .params file that sets all the values to 'ran' and lets the program generate all the terrain for you.
That has too much water for me, so I am going to type two commands in chat to randomize it and try again:
ran //ran is also the chat command to make up a new random seed gen //gen generates all new terrain after you make any changes.
You can just keep doing this, changing the random seed and generating new terrain until you find one that you like!
Random Terrain SeedsThese random terrains are not lost forever when you clobber them with new ones. You can ‘recover’ a lost terrain by remembering the random seed it was generated from. This is displayed in chat whenever you start generating terrain, so if you can scroll back and find this seed number, you can reproduce that terrain again. To exactly reproduce it, you must also return the offset and factor to the previous values.
Matching Random Terrain Across BordersNotice that the terrain in the last picture ends with high values off the edge in several directions. If I bring the Smooth Terrain prim into the next region to the east and type 'gen' with it there, it generates new random terrain that exactly matches the random terrain in the region next door! These are special random numbers that always get the same value in the same place in your grid. Here are pictures looking back at the first region before and after I generated new terrain next to it:
I'll move on to the next region to the north and do that again, looking back at the region to the south before and after putting in new random terrain:
Finally, I'll put in the missing region in the northwest. Even on the corner where 4 regions come together the terrain matches seamlessly!
Finally here is an arial view of what those 4 regions look like from above:
There are a few conditions that have to be met to set this up: The 'hashtype=global' parameter must be set as I did in the sample NC above. You cannot use this trick and the flip or rotate options at the same time. (The matching edges will be rotated or flipped out of alignment). You must have the same offset and multiplicative factor in all the regions. But once you are set up like this you can march through a whole grid wearing the Smooth Terrain prim on your hand like a magic wand, bestowing matching terrain on every region! Note: You must keep the prim in a region until it says it is done. If you leave early it will stop, warn you not to do that again, and leave a mess behind. You can fix the mess by returning to the half finished region, clicking on the prim to start over and waiting for it to finish this time!
If you have a more complex set of control points, it is up to you to make the values at the edges match. To do this, you may have to create a new .params file for every region and carefully edit the edges and slope values in the tables so they match on every region edge.
Identical Terrain in Another RegionIf you set the hashtype to "hashtype=local", adjacent regions will not match up. Instead, the terrain generated will be exactly the same in every region (assuming the sample tables, factor, random seed, etc are identical). The terrain will be identical even if you take the Smooth Terrain Generator to a different grid, but don't forget to save the seed value and bring that with you. To demonstrate this I typed into local chat
hashtype=local gen gen //after moving into the region to the right
Parameters in Chat or Note-cardDid you notice that I have used the 'hashtype' parameter both in a NC and in open chat? All the parameters and commands that the Smooth Terrain understands can be typed in open chat or placed in the .params NC. Even the sample control point rows can be entered in open chat, but a large table is easier to edit in the NC. You can put important values you want to remember, like the seed and hashtype commands, in the NC to remember them and set them automatically. The .params NC is read by the script every time you edit it and save it. (This is a common mistake that I make! Don't forget to save it after you made changes!)
You can over-ride the values in the .params NC by typing new values in local chat. Whatever values were entered last are the ones the script uses. Values you entered in chat will be remembered if you carry the Smooth Terrain across a border. It will even remember those values when saved in inventory and rezzed again later.
Terrain in Part of a RegionIn a large var region, you may only need to generate new terrain in small areas. You can do this by setting the size and offset of the area to terraform.
Type the following commands in chat to try this out, and see the result below:
outxw=128 //half as wide as an old small 256x256 region outyw=128 //and half as tall gen
Thia region started out all water, so we only see the new terrain in the SW quadrant. Next type:
outxo=128 //move over half way outyo=128 //and up half way gen
How I have filled in the NE quadrant. To fill in the SE quadrant I type:
Do you see the magic in the above picture? The new terrain matches the terrain to the west and north! If you keep the seed, offset, and other parameters the same, the terrain will always match up like this inside a single region, no matter what the hashtype is set to. One last set of commands to fill in the missing quadrant:
outxo=0 outyo=128 gen
When you do a small area like this, the control points apply to the area you are terraforming, not the whole region any more. Since I am using the same .params file with the same sample control points from the previous examples, there are now more control points inside this one region. This makes this one region have about the same amount of detail as 4 separate regions did. You can control the amount of detail by making the sample table larger and smaller, or using it on smaller areas like this.
All these examples generated square areas and started with square sample tables. This is not a restriction, you can fill any odd sized and located area inside the region. Although you will find that the terrain looks stretched if the outxw:outyw has a different aspect ratio from the sampx:sampy values. For example:
seed=8641258 hashtype=local outxw=256 //output width is twice as wide outyw=128 //as it is tall sampx=15 //things look best if the aspect ration of sampy=9 //the sample ratio is close to outxw:outyw samp=-20, 00, ran, ran, ran, ran, ran, ran, ran, ran, ran, ran, ran, 00, -20, samp=-20, 00, ran, ran, ran, ran, ran, ran, ran, ran, ran, ran, ran, 00, -20, samp=-20, 00, ran, ran, ran, ran, ran, ran, ran, ran, ran, ran, ran, 00, -20, samp=-20, 00, ran, ran, ran, ran, ran, ran, ran, ran, ran, ran, ran, 00, -20, samp=-20, 00, ran, ran, ran, ran, ran, ran, ran, ran, ran, ran, ran, 00, -20, samp=-20, 00, ran, ran, ran, ran, ran, ran, ran, ran, ran, ran, ran, 00, -20, samp=-20, 00, ran, ran, ran, ran, ran, ran, ran, ran, ran, ran, ran, 00, -20, samp=-20, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, -20, samp=-20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, -20,
It is becoming common to build a var region and plop a few of your old favorite 256x256 OAR files into a few of the "sub regions" in the var. But vars are so big, how are you going to fill in the rest of all that terrain? Simple! Fill in the missing areas with the Smooth Terrain like I just showed you above. Be careful while you do this! It is easy to set one of the offset values wrong and clobber the terrain in an area you wanted to keep! For example, a mistake that I have made is to type outy0=0 (note the two zeros, one of them was supposed to the letter ‘o’). One way to check for this is to watch and make sure the Smooth Terrain always echos back what it is doing. If you miss-spell a parameter name there will be no echo and you will know to try again.
Planning Terrain in Large Var RegionsIf you built a set of control points for an old 1x1 region, then use it in larger and larger vars, the terrain gets stretched out horizontally and the hills don't look as tall (even though they are just as tall as before). I have found that as I design for larger vars I want to have larger sample tables with higher peaks in them. A larger sample table also allows you to design the general outline of an island by setting the surrounding samples below water.
Reference List of Parameters