Planetside Software Forums

General => Terragen Discussion => Topic started by: Shigawire on May 18, 2014, 07:14:01 PM

Title: Noob questions about clamping function terrain
Post by: Shigawire on May 18, 2014, 07:14:01 PM
Hi there. I'm a Terragen noob, mostly a background in 3dsmax and Modo. I recently learned a bit of World Machine. I made a desert scene in World Machine, and I now want to be able to procedurally generate the same kind of desert in Terragen 3 - because TG provides "infinite" horizon.

I have learned a little bit from the tutorials about "A Function Only Landscape", as that is the approach that is closest to what I used in World Machine. But I am still stuck with one thing.

The screenshots attached as "Erg_Big_Machine" and "Erg_Big_Daddy" show what kind of Erg / Dune Field I have attempted in World Machine. I have tried to focus my energy on Barchanoid, Transverse, and some Parabolic sand dunes as shown here.

(http://img.sparknotes.com/figures/3/31ebea601a7d05e9ec8d0854cec9b406/earthscience_f16.jpg)

I have attached the TGD as dune_field_01.tgd - which is basically a slightly modified version of the same dune field from the tutorial by David Burnett mentioned earlier.

As you see, everything has the same height, and I am unable to mask-clamp down certain parts of the dunes using a perlin noise map, as I did in World Machine. So instead of having multiple parallell lines continuing into infinity, I want the dunes to come up from the earth, and roll down into the earth again.. and disappear based on a mask perlin noise. I know it's possible because I did it in WM, I just don't know how to do it in TG. I've tried scalar clamp, but it didn't do what I thought it did.

I hope someone can help :)

p.s. the Dune shapes made in that tutorial are perfectly fine for smaller barchanoid sand perturbations such as these:
http://www.physicalgeography.net/fundamentals/images/desertdune.jpg
Title: Re: Noob questions about clamping function terrain
Post by: Dune on May 19, 2014, 03:13:50 AM
Is this what you mean?

EDIT: Or better maybe, this.
Title: Re: Noob questions about clamping function terrain
Post by: Shigawire on May 19, 2014, 05:25:51 AM
Hmm very good. It's much closer to what I had in mind, and I think it will help me tremendously. Thank you.

But there are some rules I try to uphold:

Dunes should avoid intersecting each other, crossing over each other
(these are called "star dunes" and are very rare but have to look just right (http://georgesteinmetz.com/image_collections/empty-quarter/main/STNMTZ_20020201_05.JPG))

New Dunes should stay in the gulleys, away from the slopes of other dunes.

Larger Barchanoid / Parabolic dunes should not continue forwards like a snake, but look like the letter C and disappear into the sand for each new dune.

Dune slope angles are max 15° on the leeway, and max 32° on the avalanche side if barchanoid (or compression side if parabolic)

In any case, what you provided is exactly what I wanted for and I will study this :) Thank you
Title: Re: Noob questions about clamping function terrain
Post by: Dune on May 19, 2014, 06:04:25 AM
If you add a color adjust shader between the fractal mask and the surface that holds the smaller dunes, you can decrease the coverage by sliding black to a higher level. For instance.
Title: Re: Noob questions about clamping function terrain
Post by: Shigawire on May 19, 2014, 06:08:07 AM
Quote from: Dune on May 19, 2014, 06:04:25 AM
If you add a color adjust shader between the fractal mask and the surface that holds the smaller dunes, you can decrease the coverage by sliding black to a higher level. For instance.

Great tip! Thanks
Title: Re: Noob questions about clamping function terrain
Post by: Tangled-Universe on May 19, 2014, 07:01:57 AM
To control coverage you can indeed use a colour adjust, like Dune proposed.

How TG does this with surface layers and such is basically by multiplication.

So you can also multiply (use multiply scalar/colour, should not make much difference in this case) the dunes mask with a constant scalar/colour.
If the constant scalar/colour is set to 0.5 then you will reduce the coverage of the dunes by 50%.
If it's >1 you will increase coverage, logically.

Doing it this way is a bit more predictable, because you know what's happening exactly to the values, compared to clipping the black with a constant shader as that's not necessarily a linear adjustment.

Cheers,
Martin
Title: Re: Noob questions about clamping function terrain
Post by: bobbystahr on May 19, 2014, 07:35:49 AM
Welcome to Terragen in general and this forum in particular  Shigawire, and thanks for a great learning thread. I've already understood something I had no clue about 10 min. ago.
Title: Re: Noob questions about clamping function terrain
Post by: Shigawire on May 19, 2014, 01:09:56 PM
Thank you all for the welcome, and kind help. I will try to look at the suggestions you've provided for me.
Though I don't fully understand the process yet.

Dune, fitting name btw, my nickname is from the Dune sci fi novels :D
This is probably not the first time someone has attempted to make dunes for Terragen, and said that your name is fitting :P

Just out of idle curiosity, is there a way to "mask" the smoothness using only function nodes?
Or is it limited to the powerful surface layer nodes?

This seems like a great community. :)

Though my funds are in the "minus" range at the moment  ::) (Modo 801 just came out, and funded multiple kickstarters),
I will eventually purchase Terragen 3 Professional + Animation :)
Title: Re: Noob questions about clamping function terrain
Post by: Shigawire on May 19, 2014, 03:50:02 PM
Is there a way to tell the dune functions to "skip" every 2nd dune wave? /|___/|  instead of /|/|/|
Title: Re: Noob questions about clamping function terrain
Post by: Dune on May 20, 2014, 03:02:49 AM
This IS a great community.

Skipping every second dune should be possible, but you'd need to set up some sinus function with an amplitude of twice the distance between dunes, and use that as a mask. Such mask can be made with a get position in texture, X(or Z) to scalar, a divide function for the size, and a sinus. Enter that as mask input to a surface shader and hacve the dunes as child. But that would be very straight lines north-south, so you need to warp that sinus, by a warp shader+ vector displacement+power fractal (you need get position in texture as opposed to get position to be able to warp). You may also need to add another power fractal mask to give occurrence of dunes some randomness. 
But why all function nodes? surface shaders are very practical.
Title: Re: Noob questions about clamping function terrain
Post by: Tangled-Universe on May 20, 2014, 04:12:52 AM
I'd say; make a function with half the wave-length of your pattern. Then using a colour adjust or bias scalar node you can alter the sinus shape to sharper spikes. The distance between the spikes should not change.
Now multiply this sinus function with the function you're interested in and you should be able to cut out every 2nd ripple.

It probably means quite a bit of fiddling to get it right.
Be aware of the negative values generated by the sinus function, but I'm pretty sure you are.
Title: Re: Noob questions about clamping function terrain
Post by: Shigawire on May 20, 2014, 08:53:39 AM
Ok, thanks. I might try that later. But the function to skip the dune should be done at the linear level, prior to the perlin noise X-Add function - so before the perturbation.
Title: Re: Noob questions about clamping function terrain
Post by: Shigawire on May 22, 2014, 03:16:53 PM
Ok, I bit the bullet and bought Terragen 3 P+A
Title: Re: Noob questions about clamping function terrain
Post by: Tangled-Universe on May 23, 2014, 11:53:52 AM
Congrats, nice :)
Title: Re: Noob questions about clamping function terrain
Post by: bobbystahr on May 25, 2014, 02:13:11 PM
 
Quote from: Shigawire on May 22, 2014, 03:16:53 PM
Ok, I bit the bullet and bought Terragen 3 P+A

;D
Title: Re: Noob questions about clamping function terrain
Post by: Shigawire on May 27, 2014, 03:38:08 PM
Moore noob questions:

1.How do you "smooth" the sharp edge where the dune touches the bottom terrain?

2.How do you select concavity and convexity and smooth that if you want?
Title: Re: Noob questions about clamping function terrain
Post by: Dune on May 28, 2014, 03:14:15 AM
I can't help you there, as I'm not very good with the blue nodes. You might need a different setup for smooth dunes (like warped ridges).
Title: Re: Noob questions about clamping function terrain
Post by: Shigawire on May 28, 2014, 03:30:59 AM
Quote from: Dune on May 28, 2014, 03:14:15 AM
I can't help you there, as I'm not very good with the blue nodes. You might need a different setup for smooth dunes (like warped ridges).

I am not very good at the blue nodes either, or math for that matter. If anyone has a clue about how I could achieve this, it'd be awesome. In World Machine, it's possible to "Select Convexity" or "Select Concavity", and then apply "Blur" or "Glaciate" on it. This would be a great feature to have in Terragen also.
Title: Re: Noob questions about clamping function terrain
Post by: Dune on May 28, 2014, 03:52:23 AM
In TG, if you use fractals for dunes, but not use the internal displacement, but use the colors to feed a displacement shader, you can use a color adjust to mask the whites or blacks and give the valleys or tops extra displacement with additional displacement shaders. So you can keep smooth what you want.
Title: Re: Noob questions about clamping function terrain
Post by: Shigawire on May 28, 2014, 08:35:44 AM
Quote from: Dune on May 28, 2014, 03:52:23 AM
In TG, if you use fractals for dunes, but not use the internal displacement, but use the colors to feed a displacement shader, you can use a color adjust to mask the whites or blacks and give the valleys or tops extra displacement with additional displacement shaders. So you can keep smooth what you want.

I don't understand what you mean. You mean like using color adjust to increase or decrease levels? I thought that only changed/clamped the output.

If I put up the TGD I have so far, maybe people could have a look at it? :)

First I'll try to make it look a little more presentable though :D
Title: Re: Noob questions about clamping function terrain
Post by: Dune on May 28, 2014, 12:05:15 PM
If you unclamp the white and black you can alter/invert the range... very useful.
Title: Re: Noob questions about clamping function terrain
Post by: Oshyan on May 29, 2014, 11:38:33 PM
Something to be aware of is that while Terragen and World Machine both use Procedural Functions to generate terrains, World Machine always *rasterizes* those functions to a finite resolution, which limits your detail, but has the advantage of being able to perform additional raster-only operations like blur, etc. Terragen keeps things entirely procedural (generated at render time) and thus the functions have near "infinite" detail, but you aren't able to do things like blur operations unless you manually rasterize your procedural function, at which point you lose many of the advantages of purely procedural terrain (but again you gain some capabilities, like ease of export, and being able to run blur, erosion, and other raster functions).

- Oshyan
Title: Re: Noob questions about clamping function terrain
Post by: Shigawire on June 04, 2014, 10:48:55 AM
Quote from: Oshyan on May 29, 2014, 11:38:33 PM
Something to be aware of is that while Terragen and World Machine both use Procedural Functions to generate terrains, World Machine always *rasterizes* those functions to a finite resolution, which limits your detail, but has the advantage of being able to perform additional raster-only operations like blur, etc. Terragen keeps things entirely procedural (generated at render time) and thus the functions have near "infinite" detail, but you aren't able to do things like blur operations unless you manually rasterize your procedural function, at which point you lose many of the advantages of purely procedural terrain (but again you gain some capabilities, like ease of export, and being able to run blur, erosion, and other raster functions).

- Oshyan

Ah, I see what you mean.. that makes sense. So maybe the best way to deal with the unwanted transition is to modify the mathematical function so that it becomes smooth from the beginning? Or perhaps another way is to add some minor fluffy details in the zone / angle that could occlude the angle. I wish there was a way to select convexity or something. I will post more here soon, maybe I can get some help from a math-wiz to refine the function. :)
Title: Re: Noob questions about clamping function terrain
Post by: wiwine on June 05, 2014, 04:43:27 AM
For your work on the dunes, perhaps you should take a look to my tutorial "Dunes & sandwaves"... (in the tutorials section)
It's not finished yet, but you may find some ideas to solve your problems.  ;)
Title: Re: Noob questions about clamping function terrain
Post by: Shigawire on June 05, 2014, 07:12:38 AM
Quote from: wiwine on June 05, 2014, 04:43:27 AM
For your work on the dunes, perhaps you should take a look to my tutorial "Dunes & sandwaves"... (in the tutorials section)
It's not finished yet, but you may find some ideas to solve your problems.  ;)

Well damn, that is as good as I've ever seen deserts done in any terrain generator!

Bravo Sir! And thank you for having put in the effort to make a tutorial for it as well!