Sample Worlds Torn Apart - The 1.1 Default World - Ocean

The ocean is a very interesting place in the default MojoWorld. We have blue water, waves and surf! An anonymous source informed me that some of this was obtained by extensive trial and error, but the result is great. I admit that I can tear it apart, but I'm not sure I could have come up with it to begin with.

The ocean is composed of two materials, the water and breaking waves, combined using a function graph. We'll be looking into the Pro UI when we start looking at the blend, although not too intensively.

 

 
 

Water is fairly normal, but has an interesting displacement texture.

 

 
 

This contains two parts, a Wave Leaf and a Wave Height, blended with a multiply.

 

 
 

The Waves are a normal fractal, maximum feature set to 100 meters, scale (or default wave height) set to 7 meters. The Wave Height fractal is a scaling factor, producing some areas of larger waves, some of smaller. The output control for this texture is interesting, though:

The range of input values goes from -.3 to .7, clamped. Output, however, is 0 to 1 - always positive. This is a somewhat skewed "absolute value" function. Negative input values become positive. This makes some sense: if the scaling factor for wave height was negative, you would end up with indented waves. Not particularly realistic.

The breaking waves material is just a plain color. This gives the "froth" on the top. The magic is in the blend.

For those just "getting their feet wet" in the Pro UI (sorry, couldn't resist) it may be helpful to start out with a filled-in kickstand built in the regular Generator interface. Any texture leaf has a menu (DDLB) associated with it that allows you to select existing leaf types or convert the current one to a function (the very last item in the DDLB). Blends can be converted to a "blend" type, which allows construction of a texture leaf for a blend. This too can be turned into a function. If you elect to convert, you will find a pre-built graph in the Pro UI that contains all the elements of your texture with the values you had set up. This way you can at least match up the graphical picture with a known starting point.

For the breaking waves blend, it's unfortunately not simple and clean. There are parts that I'm still working on, but I think I understand the basics. So - here goes...

The initial picture displayed when you click the "f" for the function blend is a bit distorted. You may notice that some of the connecting lines go across boxes, and not everything is visible in the window. You can pan around by holding down the space bar and dragging in the graph area, or better yet, drag the individual elements around and rearrange them until they're in more reasonable places.

Note - You can also use the period and comma keys to shrink and magnify the graph. Once the graph is shrunk to a certain point, however, the text labels will disappear. Another way to handle really complicated graphs is to click on the 'swoopy f' on any parameter - that will spawn a whole new graph window showing only that 'branch' of the graph.

 

 
 

Here I've selected the Monofractal (now red), and the parameters for this show up in the control stack on the right. One thing to note here: there are 11 rows on the control stack with circles on the vertical line that correspond to parameters you can set. (Well, there are 12, actually, but the first one is just the name). If you examine the red Monofractal box carefully, you can count 11 little triangles on the top of it. This correspond to the parameter values. You can either set one of these values with a constant in the control stack or, in some cases, "feed" one of them from another element of the graph. The parameters that will take inputs from outside are shown in the stack by the half-circles attached to the left of the line, and on the graph by hollow trianges. (These are not easy to see, especially when the node in the graph is selected and turns red; use the stack to identify them). Here you can see that the first parameter, Position, has "f" to the right. If you look over at the graph, the first triangle is connected to another functional element.

Now, what is the picture doing? The basic flow seems to be:

  • Position feeds everything.
  • Find the depth at that position.
  • On the left, use a modified depth (through a curve editor) to feed a sine function. This will produce a peak on the sine curve at certain depths, which essentially produces "rings" around the shore like a topographical map shows.
  • On the right, the depth and a fractal are blended together, to provide some variation (you don't want fixed rings of surf around everything).
  • These two are added together to generate a final blend value, which determines how much of the final result is plain water, and how much is "surf".
Note - a blend value should be in the 0 to 1 range, where 0 is 'use the first leaf' and 1 is 'use the second leaf' and any value in between is 'use a proportional blend of the leaves.'

It's interesting to play with some of the parameters to these various boxes, and see what changes are produced in the final image. I have made some (apparently) large modifications and gotten very small changes out; the final result is arrived at by a bit of trial and error, changing things to see what works. Try some parameter, curve, and range modifications and see what you get.

Part One sections:

Part Two sections:

Back to Generator Tutorials

Home