Pandromeda Login
Tutorials
Crater Node Tutorial

by Calyxa Omphalos

Introduction

This tutorial discusses the Crater Node, a MojoGraph function node. The Crater node has been a part of MojoWorld since the pre-alpha of version 1.0-no kidding!-but it has lived in relative obscurity, buried in the Utilities category in the Create Node dialog in the MojoGraph interface (formerly known as the Pro UI). While it is possible to approximate some of the results of this tutorial using the Response Curve on a Parameter Bomb, using a Crater Node allows for far more flexibility.

Unlike the render above, most of the sample renders in this tutorial show the Crater Node used on an empty flat grey planet. This is so that the details do not get lost in the noise of an interesting planet, as well as simplifying the crater creation for the purposes of the tutorial. Later in the tutorial, integrating a crater into an already-developed planet will be covered.

A First Look

The first parameter of the Crater Node is the 'Crater position' parameter. This determines where the crater is located on the planet, as well as a base reference for the crater's size. It requires a PBomb Position node as its input.

Normally when shaping the terrain inside of a Parameter Bomb, a land texture editor specific to that PBomb is opened via the Land Texture hot button displayed when the PBomb is selected. When using the Crater Node, it can be easier to integrate the node directly into the Mountain Height function graph. This is because of the PBomb Response Curve. The default Response Curve on a PBomb causes the crater shape to be obscured by the blending. This effect will will be revisited later in this tutorial.

Getting Started

For now, start with File->New and then create a circle parameter bomb. While the Crater node will create a circular crater even when used with a square PBomb, using a circle PBomb works better for visualization and for material blending. Make a note of the radius of the PBomb and then click on the planet to de-select the parameter bomb and activate the global parameters hot buttons.

Open the Land Editor (the Mountain icon, not the circle-T Land Texture Editor) and change the Mountain Height parameter to a Function.

The graph editor will contain a single brown node labeled 'Mountain Height'. Build a graph as follows:

The graph should now look like this:

In order to see the results in the RTR, two more things must be done. First, in the PBomb Position node (labeled 'Helper Po...' in the screenshot above), select the parameter bomb in the drop-down list box. Then, edit the Max Output in the Curve node. A good value to start with for the Max Output is about 1/4 of the diameter of the parameter bomb. Here, the parameter bomb has a diameter of 1359.01 meters and the Max Output value on the Curve is set to 300 meters:

Note that the 'fence' of the parameter bomb protrudes from the top of the crater's rim. This will be important to consider if the crater is built inside of the parameter bomb's land texture editor instead of as the tutorial shows so far, as part of the planet's Mountain Height function.

Gettin' Jiggy With It

So far, the crater looks very smooth and uninteresting. One way to make the crater more interesting is to add some domain distortion. The PBomb Position node at the top of the current graph has an input parameter but as of yet has nothing attached to it. When this node has no function node as input, it defaults to the World Position, regardless of any constant value that may be specified. To add domain distortion, create three more nodes as follows:

The top of the graph will now look like this:

Before the domain distortion will be effective, there are a few more parameters to modify in the fractal node. First is the Largest Feature size. A good starting value is about the same value used for the Max Output on the curve, around 1/4 of the PBomb's diameter. When editing the Largest Feature in the function graph editor, the value has more than one field, in fact, there's a field for each dimension of the fractal. For now, set all three fields to the same value, but later on, try tweaking them with different values. Next is the Result Scale. A good starting value is around half of the value used for the Largest Feature size. Lastly is the Basis Function. When fractal nodes are created in MojoGraph, they are created with the Basis Function set to 'None'. Any Basis Function other than 'None' will do. This next render uses a Largest Feature size of 300, a Result Scale of 150 and the Gradient Perlin Basis Function:

This type of distortion affects the whole crater. A different way to distort the crater is to drive the other parameters of the Crater Node with functions.

Driving Crater Parameters with Functions

Reconfigure the graph by disconnecting the domain distortion at the output of the Add node, create a Curve node, and run the output of the fractal through the curve and into one of the other Crater parameters, in this case, the Crater Radius. Things are a bit out of control right now, so there are a few more parameters to tweak.

First is that the Result Scale on the fractal node was set to 150, but the Crater Radius parameter expects values close to 1, so set the Result Scale back to 1. The Crater is still not recognizable at this point, because while the Radius parameter is expecting a value close to 1, it's being fed values ranging between -1 and 1. Open the Curve Editor on the Curve node and set the Min Input to -1, leave the Max Input set at 1, and then set the Min Output to 0.8 and the Max Output to 1.2. This will feed values roughly between 0.8 and 1.2 into the Crater Radius parameter, resulting in a crater that looks something like this:

In many ways, this is very similar to the domain distorted crater, but only the radius has been affected. Note how the bump in the center of the Crater is still very smooth. Unlike with the domain distortion technique, the center bump can now be shaped with an entirely different function.

Create another fractal node and another Curve node. Connect the World Position node to the fractal node's Position parameter, then connect the output of the fractal node to the input of the Curve. Then attach the output of the Curve to the Crater Centre Height parameter.

The default value for the Crater Centre Height parameter is 0.08, so in the Curve Editor, the Min Output and Max Output should be set up to create a range similar to this value. As with most fractal nodes, the Input range will be from -1 to 1, so set the Min Input to -1 and leave the Max Input at 1. Also remember to set the Basis Function in the fractal to something other than 'None' and lastly, set the Largest Feature parameter of the fractal.

In this next render, the fractal used is a simple Noise, the Basis Function is Voronoi (1st and 2nd closest neighbor mode), and the Largest Feature is set to 23. The Min Output and Max Output in the Curve node are set to 0.1 and 0.2, respectively. This creates a higher center than the default constant of 0.08 as well as giving it a texture.

The graph for this Crater now looks like this:

Experiment by driving the other Crater Node parameters with functions. The procedure of using a Curve node to limit the output of various fractal nodes to a range close to the default value of the parameter being driven applies to all the parameters of the Crater node.

A brief note about the Crater Depth parameter - while this parameter is a positive value, it represents the amount below 0 that the bottom of the crater is depressed.

The Parameter Bomb Parameters

Open the Object List and click on the Circle Helper object ('Helper' is another name for PBomb) to select it. The Hot Buttons area now refer to the area inside of the PBomb. Click the circle-M associated with the Land Material. The material editor which opens will be completely empty. Use the menu to create a new material. Then, for the purposes of visualization only, set the diffuse color of the plain material to something like a bright pink. The result is something like this:

What's most important about this example is that only the very center of the PBomb is the fully saturated pink from the material assigned to the PBomb. This is because of the PBomb Response Curve, found in the Parameter Bomb Editor. Click the hot button at the top of the stack which has the same icon as the circle Parameter Bomb object to open the Parameter Bomb editor and access the Response Curve:

Change the Beyond Output DDLB to 'Clamp'. Click the upper-right point and set its control handle horizontal. Click the lower-left control point and angle its handle upwards. This is where the Beyond Output 'Clamp' comes into play - as the lower-left handle is moved upwards, the curve flattens out against the top of the curve editing area.

Using the Parameter Bomb Land Texture Editor

Even with this curve, defining the crater inside of the parameter bomb's land texture editor has a very different effect than defining the crater as part of the Mountain Height function directly. For this next image, the Mountain Height function has had the bottom-most curve node disconnected from the Add1 parameter of the Add node attached to the Mountain Height parameter node. This removes the crater from the Mountain Height function. Rename that Curve node to a name that can be easily found in the main node list. In the Land Texture editor associated with the parameter bomb, create a new texture. Enable the first texture leaf and then convert it to a function. In the function graph editor, disconnect the Texture Color Control node from the brown Main Value parameter node. Use the 'Import from other Graph' menu item to import the Curve node from the original Mountain Height graph, and connect it to the Main Value parameter node. Now the crater shape is defined within the parameter bomb and the resulting shape looks like this:

Not only is it a very different look to the Crater, setting up the Crater node function graph inside of the Parameter Bomb's Land Texture Editor has another pitfall. With the Add node structure integrated into the main Mountain Height function, the crater will conform to the rest of the planet's terrain. When created separately inside of the Parameter Bomb's Land Texture Editor, the resulting crater may end up many meters or even kilometers above or below the surrounding terrain, since the output of the Crater node function is in absolute elevation values, rather than relative ones. This can be adjusted by adding a constant to offset the crater down or up to the level of the surrounding terrain.

There are two more changes that can be made in the Parameter Bomb editor to allow the crater shape to be defined within the PBomb and not be as truncated by the PBomb Response curve. First is the 'Keep in Circle' checkbox. This will need to be unchecked. The other change to make to allow the crater to extend beyond the PBomb's fence is to set the Min Input of the Response Curve to a negative value. When set to -1, the PBomb Response Curve begins its effect one PBomb radius outside of the PBomb's fence.

Integrating a Crater in an Established World

In general, a crater will look more natural on a relatively flat area. After locating where to put the crater and creating the Circle Parameter Bomb, use the Land Editor to change the existing Mountain Height to a function, if it is not already a function.

Once the entire Mountain Height texture has been changed to a function, open the function graph editor. Depending on whether the terrain was previously defined only as a Generator texture, or if it had function graph components, the graph may need to be re-laid out using the Auto-layout menu item. Once the graph is organized, create an Add node and connect it directly to the brown Mountain Height parameter node. Then connect the bottom-most node on the original terrain function graph to the Add2 parameter of the Add node. Click on the collapse icon on that node to make room in the graph editor, if needed.

Other than the detail of changing the entire Mountain Height to a function graph, all of the information about creating and using a crater has been covered above, with the exception of a minor bug with textures converted to function graphs....

A Known Bug With Functions

The following examples are taken from the planet file Southern Parfait, which can be found in the Planets folder in the Libraries shipped with MojoWorld 3. This first screenshot is the Land Texture editor for the Mountain Height texture before it has been converted to a function graph:

The point to notice is that the Offset parameter has a texture attached. Now here is a screenshot of this same Mountain Height, converted to a function graph:

The point to notice here is that there is still a circle-T icon attached to the Offset parameter of the Monofractal node. This is a Bad Thing™ because it's possible to edit the function graph above the node labeled 'Valley Distort...' to a configuration that does not fit into a Generator texture editor, but the Generator texture editor can still be invoked by clicking on this circle-T, causing a crash.

Whenever converting a Generator texture into a function, never click on a circle-T icon when it is displayed in the parameter list, but rather, disconnect the node above, delete that node, and then connect the output of the remaining node back to the parameter in question. For example, in the graph above, the 'Valley Distor...' node would be deleted and the 'Texture Color ...' node above would then be connected to the Offset parameter of the Monofractal, thus removing the circle-T and replacing it with a circle-F. The extraneous node will have the same name as the texture's name, in this case, 'Valley Distor...' or in the case of a texture with a default name, 'Main Texture ...'

Also note that clicking the semi-circle next to any parameter brings up the choices of Texture and Function. Choosing Texture for this will lead into the same trap, so it's recommended that when working in a function graph editor, always create nodes using the Create Node menu item and never use the semi-circle menu on any parameters.

Lastly, here's a render of the crater created on Southern Parfait: