|
This tutorial is part of a
series.
There are three critical things you need to be aware of when using the Curve editor. They are:
Input Much of the time, the data going into the curve comes from the output of a fractal node. The output of a fractal node will depend on a lot of things, but the primary indicator is the fractal's Result Scale parameter. A relatively safe assumption is that the output of a fractal node will range between plus and minus its Result Scale. So, for a fractal node with a Result Scale of 1, the output will probably be in the range of -1 to 1. For a fractal node with a Result Scale of 2000, the output will probably be in the range of -2000 to 2000. Note that's a very generalized rule - the actual output will depend a lot on what Basis Function the fractal node uses. The other parameters of a fractal node can also have a significant effect on the node's output. But for the purposes of setting up a suitable Curve, having just a general idea of what the output may be is enough to get started. Sometimes the data going into the Curve doesn't pass through a fractal node at all, but instead is the raw Altitude or Slope of the terrain. If it's the Slope, you can be certain that the input will always be no less than 0 and no more than 1 just by the definition of what Slope is. If it's the Altitude, you can get some idea of what the range of values is by looking in the terrain texture editor. Below the preview swatches in the terrain texture editor are local Min and Max values for the terrain texture, in meters.
Output After you have an idea of what's going into the curve, you have to know what you're doing with the data when it leaves the curve. There are many circumstances when the default 0 to 1 range is exactly what is needed. Those include (but probably aren't limited to) when the next step for the data is a color gradient, or determines a blend, or is the density of a cloud layer and/or probably several other cases. Not all outputs will be suited to a 0 to 1 range, however. If the output is going to create mountains, it should be a much larger range of values. Conversely, if the output is going to drive the Offset parameter of a fractal in the terrain texture, you'll probably want to make sure the values are smaller than 1. Again, the bottom line is that the output coming out of the Curve editor may be used for just about anything, so it's important to have a rough idea of where that output is going. Beyond(s) There are two cryptic DDLBs in the Curve editor's control stack - Beyond Input and Beyond Output. They've got equally cryptic options on their menus, which, when you look at them, seem like they're almost the same (just what is the difference between 'Mirror' and 'Reflect', anyway!). These options specify in part what happens when the data is outside of the range specified by the Min/Max parameters. The other part involved in specifying what happens when the data is outside those ranges is the angle of the control handles on the two end points of the curve. The end points of the curve are permanently attached to either vertical side of the square curve area. They can be slid up and down along those edges and their control handles can be moved through a variety of angles, but those two points always correspond to the Min Input and Max Input. Within the area of the curve editor, some very elaborate curves can be drawn. A variety of surprising and useful things can happen outside of the curve area depending on the settings of these two DDLBs. Before I get into a lot of hand-waving about that, let's take a break and look at some pictures. But what does it all mean? The curve editor works just like graph paper. The Min Input and Max Input specify the left and right hand boundaries and the Min Output and Max Output specify the top and bottom boundaries. Here's a diagram that may help:
Note that in this picture, the area described by the curve editor
is not square - but the curve editor itself will always be square.
For example, if the Min Input and Max Input are 0 and 1, but the
Min Output and Max Output are This next diagram represents the default curve. The small grey square in the middle is the actual curve editor area. The green swath down the center represents all possible inputs that are in between the Min Input and Max Input parameters. If you've played with the curve editor much, you'll probably have noticed that it won't 'fold over' on itself. Every unique input value must map to one and only one output value. The blue horizontal swath represents all possible outputs that are between the Min Output and Max Output parameters. The red diagonal line is the default curve and it extends outside of the curve editing area to infinity and beyond - because both of the Beyond DDLBs are set to their default values of Continue and No Change.
The Default Curve With Default Beyonds With the default curve shape of the diagonal line, similar diagrams showing what happens to the curve for the various settings of the Beyond Input and Beyond Output DDLBs end up looking (and acting) exactly the same. As for just about everything in MojoWorld, there's more than one way to get the same results. For this first set of diagrams, the Beyond Output DDLB is set to No Change. Things don't really get interesting with the Beyond Output DDLB until you start changing the shape of the curve significantly. With the Beyond Input DDLB set to Continue, values outside the range specified by the Min Input and Max Input parameters are extrapolated. When it gets an input that is outside that range, it extends the curve along a straight line at the angle of that end's control handle and re-maps the data accordingly. We'll revisit this concept again when we get to the Beyond Output DDLB. THE BUG - There's a bug in the curve editor and it's a nasty one, but because it took so long for how this thing works to sink in, it took a long time to recognize The Bug. The Bug is this -- when the Beyond Input DDLB is set to 'Continue' then it doesn't matter what the Beyond Output DDLB is set to when it comes to evalutating data that falls outside of the Min/Max Input range. It gets treated as if the Beyond Output is set to 'No Change' no matter what! The consequences of this bug will be repeated in red preceeding the two diagrams affected by The Bug. Two other notes in red about The Bug are present. The first note will be a 'heads up' to notice the portion of the non-affected diagram which accurately shows what the data does below Min Input and above Max Input instead of what's shown as the 'correct' (non-buggy) behavior, and the second note is a 'heads up' to point out that the final diagram is not affected by The Bug because its 'Beyond Input' DDLB is not set to 'Continue'. Clamp - when the Beyond Input DDLB is set to Clamp, that means values outside of the range specified by the Min Input and Max Input are considered to be equal to the Min or Max. For example, if the Min and Max are 0 and 1, then any values sent in that are less than 0 are assumed to be 0 and any values that are greater than 1 are assumed to be 1. There's no extrapolation along the curve - it essentially stops at the boundaries specified by the Min and Max Inputs.
Beyond Input set to Clamp Mirror - when the Beyond Input DDLB is set to Mirror, it's as if mirror images of the curve editor area are placed on either side of the curve, and in fact, copies of those mirror images extend the curve off to cover an infinite range of inputs.
Beyond Input set to Mirror Repeat - when the Beyond Input DDLB is set to Repeat, exact copies of the curve editor area are tiled along to cover an infinite range of inputs. This diagram shows the default curve shape repeating, which results in sharp discontinuities, but if the curve within the editor area is set up right, a repeating curve may be smooth.
Beyond Input set to Repeat For this next set of diagrams, we'll be talking about the Beyond Output DDLB. The Beyond Input DDLB will be set to its default of Continue. As I mentioned above, the Beyond Output DDLB is much more interesting and obvious when the curve is something other than the default diagonal line. Some things I want to point out about this sample curve which aren't readily apparent from the diagram is that the control handle on the Min Input point slopes up very gently. More obvious in the diagram is that the control handle for the Min Output point slopes very steeply down. Also note that the curve pokes out of the curve editor area - it goes beyond the output. No Change - when the Beyond Output DDLB is set to No Change, the straight lines of the two end points' control handles extend off to infinity in both directions. How fast they get there depends on how steep they are. In this example, the line extending beyond the Min Input slopes gently, so values below the Min Input will be remapped to subtly larger values. The line extending beyond the Max Input slopes very steeply downwards, so values above the Max Input will be remapped to dramatically smaller values. The little bit of curve that is within the range specified by the Min/Max inputs that pokes out of the editor area is considered to be 'really there'. Remember what this diagram looks like for the values below the Min Input and the values above the Max Input -- because any time the 'Beyond Input' DDLB is set to 'Continue', then the 'Beyond Output' DDLB only affects data within the input range, and the rest of the curve will look exactly like it does on either side of the central square in this diagram!
Beyond Output set to No Change Clamp - when the Beyond Output DDLB is set to Clamp, values coming out of the Curve will be restricted to values between the Min/Max output parameters. But as is shown with the line extending beyond the Min Input, it may take a while before that clamping takes place. Also note that little bit that in the previous diagram poked out of the top of the curve editing area. With the output clamped, that little bit is flattened off at the top. With The Bug, the red line does not get clamped when it goes outside of the central grey box to the left or to the right! Imagine this diagram as looking exactly the same as the previous diagram, except for the part within the central grey square with a flattened top, as it is shown in this diagram.
Beyond Output set to Clamp -- SUBJECT TO THE BUG Reflect - when the Beyond Output DDLB is set to Reflect, values coming out of the Curve are restricted to values between the Min/Max output parameters, but instead of reaching those limits and sticking there, the lines which continue beyond the input end up bouncing back and forth between the Min/Max output values. Again, note what happens to that little bit that two diagrams ago was poking out of the top. In this one, that part of the curve is reflected back down into the curve editing area. Again, The Bug means that the red line of the curve never bounces off of the Min and Max Output values when it is less than the Min Input or greater than the Max Input. Imagine this diagram as looking exactly the same as the one two diagrams ago, except for the part within the central grey square with the reflected dip, as it is shown in this diagram.
Beyond Output set to Reflect -- SUBJECT TO THE BUG One last diagram in this format here shows what happens when you've got the Beyond Input set to Mirror and the Beyond Output set to Reflect. The Beyond Ouput in this case only affects the curve between the Min and Max Inputs, because the data that is outside of that range is handled by the setting of the Beyond Input DDLB. Because the Beyond Input DDLB is not set to 'Continue', The Bug does not happen and the curve does behave as shown!
Beyond Input set to Mirror, Beyond Output set to Reflect So, back to that parenthetical question from earlier, on just what is the difference between Mirror and Reflect... Mirror causes the entire curve editor area shape to be reversed and repeated over and over again for the infinite range of input values. Reflect causes the curve to bounce off the boundaries of the Min and Max Outputs.
|