As promised, here's a script that's a bit more artistic in nature. This script "splatters" instances of the Crater shader across your terrain. Now you can create fields of impact craters with just one click.
Each crater's parameter values are randomly generated and based in between the minimum and maximum values you provide.
The first thing you'll notice is a checkbutton for "
Tooltips". Hovering over the script's parameters will display a tooltip when the checkbutton is checked.
To add Crater shaders to the active Terragen project enter the quantity you want in the "
Number of craters" field. The shaders can be grouped together by checking the "
Group" checkbutton and providing a name.
The "
On mountain or in valley?" parameter will add one Simple Shape Shader beneath all the Crater shaders. The Simple Shape shader will displace the terrain by the amount specified. Positive values will displace upwards creating a mound and negative values will displace downward like a valley or pit. I've found that having a subtle displacement of just a few metres can work wonders when eroding the terrain later on (downstream) in the node network.
Each crater is randomly positioned around the "
Area centre x,y,z" coordinates and within the "
Area volume x,y,z". This is similar to how the Populator v4 shader works in Terragen. You can copy valid x,y,z coordinates from the clipboard to the "Area centre x,y,z" parameter by clicking the "
Clip" button, and reset them back to the origin of the project with the "
Reset" button.
Parameters for each Crater shader are randomly generated between the "
Minimum" and "
Maximum" value for that parameter. Some parameter values can be based on the crater's diameter by checking the "
or % of diameter" checkbutton. Furthermore, those values can be randomized by checking the "
+/- Offset" checkbutton.
The script includes a list of certain types of displacement shaders that can be assigned to the Crater shader's "
Rim shader" parameter. Select a displacement shader from the list and check the checkbutton. One displacement shader will be assigned to all the crater shaders generated when the Apply button is clicked. Most of the displacement shader's parameters are set to their default values, so you'll need to tweak those values based on the size of the craters you're adding to the project. For example, the default value of the Alpine Fractal shader's "Feature scale" is 4000 metres and its "Displacement amplitude" is 2000 metres. This may be extreme if the crater you're adding is only 10 meters across. Perhaps a future version of this script can take this into account and scale certain parameters of the displacement shader assigned to the craters.
If desired, the Crater shaders can be inserted into the node network workflow. The "
Output > Main input" option will attempt to connect the added Crater shaders in between the first Compute terrain node in the project and whatever shader was assigned to its Main input when the Apply button is clicked. The "
Merge shader" option will attempt the same via a Merge shader node. When the "
Don't" option is chosen, no attempt is made to connect the Crater shaders to the existing node network.
When checked, the "
Append fractal warp shader?" checkbutton will add a Fractal Warp shader node after all the Craters. This comes in handy when you want to apply a warp to the shape of the craters you've just added. When your craters have been inserted into the node network via the Merge shader this is a handy way to warp only that grouping of Crater shaders. The Fractal Warp shader's Scale value is set to about twenty-five percent of the crater diameter.
Clicking the "
Apply" button will add the Crater shaders and other supporting nodes to the project.
The menu includes a set of "
Presets". These values are meant for fun and are not necessarily scientifically accurate. I'd love to add more presets to the menu, both artistic and scientific, so if you come up with any good ones please let me know, or try your hand at editing the preset dictionary in the script.
Have you ever noticed that the Crater shader doesn't have handles so that you can move it around in the 3D Preview, even though it has x,y,z coordinates? What if you want to move a crater? This is where the
tg_copy_coords_to_selected.py script comes into play. You can right click in the 3D Preview and select "Copy Coordinates" for the location you want to move the crater to, then run the tg_copy_coords_to_selected.py script. The script will copy the coordinates from the clipboard to any nodes you have selected in the Node Network that accept xyz coordinates. Here's a link to the forum post with more information about that script:
https://planetside.co.uk/forums/index.php/topic,30972.0.htmlThis script can create some interesting terrains to say the least. When applying the techniques described in the Terrain Techniques blog posts such as warping and eroding a basic shape, in this case the Crater shaders, you can come up with unique and exciting terrains.
https://planetside.co.uk/blog/terrain-techniques-simple-shape-shader/https://planetside.co.uk/blog/terrain-techniques-image-map-shader/https://planetside.co.uk/blog/terrain-techniques-detail-warp-erode/Here are some example renders that I've made by just goofing around with the script.
Get your copy of the script right here for free!
https://github.com/RedMawVFX/tg-splatter-craters.git