# Thread: Another Wilbur Question

1. ## Another Wilbur Question

I've been experimenting with the math function, and having a bit of success, which doesn't particularly mean anything at this point. More specifically, I've been looking at the function defined for creating islands and, in turn, trying to figure out if there is a way to create craters along the same line, i.e. with that random shape rather than being perfectly (or near perfectly) round and with an increasing slope steepness towards the rim. I've wracked my brain on this, but, sad to say, I'm not much of the programming type (save for a little html and javascript), so if anyone has a clue how I might go about this, it would be great.

GW

2. Have you tried the crater() function in Wilbur? It generates perfectly round craters, but applying it to an existing random field with a multiply operation will give you something like what you describe (see attachment). If you want the rim distance to wander a bit then I'd have to put back in the fbm function that you could use to modify the crater function argument.

Internally, the crater() function looks like

if (arg <= RimDist)
return pow((sin(1.5*M_PI+arg/RimDist*M_PI)+1)*0.5,BowlSteep)*(RimHeight-BowlBase)+BowlBase;
else
return (1-(arg-RimDist)/(1-RimDist))*RimHeight;

A wilbur function that does the same should look like
if (le(arg,RimDist),pow((sin(1.5*pi+arg/RimDist*pi)+1)*0.5,BowlSteep)*(RimHeight-BowlBase)+BowlBase,(1-(arg-RimDist)/(1-RimDist))*RimHeight)
with appropriate expressions substituted for the named arguments (for example, arg replaced with r/4, RimDist replaced with 0.5, and so on).

3. Much appreciated waldronate (and look, I spelled it right this time!!!). I was going through the documentation last night at work and may have come up with another solution as well, based on a selected area. I'll give both a try and see which one works out the best. The ultimate goal is to create an open cavern of sorts with some roughness in what would be the "bowl" area. If the solution I came up with last night works out well, I'll be sure to forward it to you, or post it here for reference.

GW

P.S. Is there an easy way to clear out unused formulas in the math function area of the Calculate Heightfield dialogue, or am I stuck with a list that keeps growing and growing and growing . . . .

4. The list should stop growing at 16 items.

5. 16 Items, Aye.

As a brief update, the function I came up with last night works almost exactly as I had hoped it would. Unfortunately, it is wholly dependent on a series of selected areas and a progressive series of iterations. I'm just not seeing any way to create it as a generic function, and I'll post it in a bit, if you are interested in playing with it. I just need to define a few variables (in words) such that they make sense.

GW

6. As promised, here's the function I came up with;

if(lt(curval,MDH),if(lt((curval+(sqrt(r/((1/MR)*EA))+1)),MDH),(curval+(sqrt(r/((1/MR)*EA))+1)),MDH)),curval)

where

M(aximum)D(esired)H(eight) is equal to the the user's desire
M(aximum)R(adius) is equal to the pixel distance from dead-center to the furthest possible point
E(levation)A(djustment) is the largest prime factor of MR that halves with each progressive iteration of the function.

* the extra "+1"s are to ensure that the curval is raised by at least 1 unit with each pass of the function

The idea is to create a crater-like effect of which the rim shape can be defined by the user as a selection mask. Unfortunately, to maximize the effect requires that both the selection mask and math function be re-defined by the user with each progressive application. It's not very pretty, it's probably more complicated than it needs to be, but, with the bare minimum experience I have in "programming," I'm fairly pleased with myself for coming up with this solution. Heck, I might even write up a tutorial on it, if you're interested in adding it to the growing number of tutorials on the Wilbur software page.

I've included before and after renders by Terragen as an example of the results. I only went through 6 iterations and applied way too much blur between iterations, so the results aren't particularly easy to see unless you view the images side by side at full size, but it should give you a good idea of where I'm headed with this.

GW

Bah, just ignore the explanation of those variables, I fudged something in trying to convert it to an explainable format. As soon as I straighten things out, I'll edit both the function and the explanation.

7. Okay, let me try this again, and, hopefully, it will make more sense . . . (yeah right :D )

As promised, here's the function I came up with (with the values I am applying);

if(lt(curval,128),if(lt((curval+(sqrt(r/(0.5/1))+1)),128),(curval+(sqrt(r/(0.5/1))+1)),128)),curval)

In more of a variable defined format, it looks something like this;

if(lt(curval,MDH),if(lt((curval+(sqrt(r/(((LPFMR/MR)*SA)/EA))),MDH),(curval+(sqrt(r/(((LPFMR/MR)*SA)/EA))),MDH)),curval)

where;

MDH - Maximum Desired Height (defined by user)

MR - Maximum Radius (from dead center to furthest point, rounded to nearest even value)

LPFMR - Largest Prime Factor of Maximum Radius (optimally should be 1/16th of MR)

SA - Slope Adjustment (used to bring up the result of LPFMR/MR to the nearest value below 1)

EA - Elevation Adjustment (used to create more aggressive elevation additions, increases with each iteration, starts at a value of 1)

Now I'll do my best to explain what I've done.

I've nested one "if" statement in another.

The inner "if" statement compares the intended replacement value to the maximum value as defined by the user. If the replacement value exceeds the maximum desired value, then the point is set at the maximum desired value. Otherwise, it is set at the replacement value.

The outer "if" statement does almost the same thing, but bypasses the inner "if" statement if the current value of the point is already at the maximum desired value.

The replacement value is calculated as a factor of the radius at the given point as compared to the maximum possible radius of the terrain as a whole. With each iteration, the replacement values should get increasingly aggressive to the point that we end up with vertical (or near vertical) slopes. By using selection masks, we can further control where the values are replaced and, in effect, create crater or plateau-like effects of nearly any shape with a little bit of patience. Since Wilbur doesn't have a loop function (that I can tell, anyhow), this function is wholly dependent on using selection masks to control where the replacement values can occur, and seems to work best with series of increasingly larger or smaller selections with each iteration.

There is probably an easier (read that as cleaner, less complicated) way to implement this function, but I'll leave that to your professional consideration, as I am quite the amateur with this whole function/programming thing.

GW

8. Wolfe, that shot on the left looks amazingly like real rock or dirt.!! If you looking for something subterranean, I think you nailed it there. The "walls" even look like sheared stone.

Very well done. Have some rep for:
A - Producing a shot like that
B - producing the code to do it (my HTML and Java is no where near understanding it )

9. What would this look like from an overhead perspective? The side shots look an awful lot like the sort of step that happens by clipping inside or outside a mask. When I tried to use that expression on a surface, I got everything above 128 showing as Not a Number (-1#IND) and everything below 128 as the original value.

I'm still unclear what you're really trying to get here. One way to make a crater with an arbitrary rim is to:

Draw a selection to represent the rim shape. I used a squarish one so that it would look vaguely like the one in Arizona.
Fill that selection with a mound (Filter>>Fill>>Mound) where the Maximum is less than the minimum. I used 10 for minimum and 0 for maximum.
Apply an exponent to make the crater more bowl-shaped. Filter>>Mathematical>>Exponent with the exponent set to 4 will work.
Invert the selection to work on the outside (Select>>Inverse)
Fill with a mound (Filter>>Fill>>Mound) where the Maximum is less than the minimum. The minimum should be the same as the original fill. I used 10 for minimum and 5 for maximum.
A small exponent here might work as well. Filter>>Mathematical>>Exponent with the exponent set to 1.5 is a good starting point.
Deselect (Select>>Deselect).
Apply an overall bit of noise to make things rougher. Filter>>Noise>>Fractal Noise with an amplitude of 3 and Operation of Add.

10. @ Korash - Thanks, the sheared stone look is what I'm going for, just trying to tweak the lower levels of the shear to make it slightly more gradual. As for the code . . . to be honest, I'm not really sure what I'm doing either, but I'm giving it my hack-n-slash best.

@ waldronate - That explanation almost hit the spot. Let me try to better explain what I am trying to achieve.

I've used your island tutorial (for wilbur) to create an island. I now want to turn the land area of the island into the basin/bowl of a crater (could also be thought of as a cavern floor or even the end result of a caldera collapsing) by turning the water results into quickly steepening land that, in some areas, looks sheared as well. I realize, now, that my function was, to be brutally honest with myself, poorly crafted as I included specific numbers based on the terrain I was working with. But I think the way you explained it there, might have me on the right track. I think, though, that I need to start at the second step as I already have the first step done, theoretically. Once I have the bowl shape along the inner edges of the rim, I can use the Filter>>Fill>>Set Value to flatten the area beyond the rim at the height of the rim, and maybe even add a little bit of that sheared look that I'm trying to achieve. I'll give it a shot and let you know how it goes.

Thanks BUNCHES for all the help.

GW

Okay, here's a sample area of what I'm working with. As you can see, there are some areas of rising elevation that butt up against the walls. These areas aren't the real "problem." The "problem" is in those areas where the wall meets the lower floors of the terrain, creating, for the most part, a right angle between floor and wall. These areas, I'd like to give these areas a slight bit of curvature and haven't really had much luck yet. I tried the method you recommended above, but, for some reason, when I apply the Fill>>Mound method, it fills the entire area with a single value. Anyway, I hope this better illustrates what I'm trying to do.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•