## Cloud Busting

Started by Hetzen, August 18, 2010, 12:07:43 pm

#### Hetzen

##### August 18, 2010, 12:07:43 pmLast Edit: August 18, 2010, 03:04:23 pm by Hetzen
Something I've always failed to do so far in TG, is coming up with interestingly shaped clouds. What I've found to be the problem, is the clamping that goes on in the cloud node itself. Essentially, the cloud node defines the top and bottom of the cloud layer. Anything that falls below the base altitude is rolled off to flat. This is actually desireable, as most cloud's bases appear flattish. The same thing happens at the cloud node's cloud ceiling, which in some cases is what we want, but when I look outside at the armada of white fluffy ships sailing in the wind, I always see curvature and tall bastion spires to their tops.

So I've been scratching my head on how to control how much the tops of our clouds reach the cuttoff point in the cloud node's ceiling.

Just to explain, the cloud node's settings which determine the top and bottom of a cloud layer are, altitude which sets the mid point of the cloud layer, and depth is how deep the layer is from this midpoint. In other words, a cloud layer set at 4000m with a depth of 2000m means the base of the cloud is 3000m and it's top is 5000m.

The problem is, is that by just using another PF to modify the DF, you end up just subtracting islands of 3d noise, which have no concept of a top or bottom to your cloud layer. So you end up with clouds subtracted by clouds, which equals lots of smaller clouds, and still being cutoff by the cloud node ceiling.

What I needed to do, is subtract a shape from the cloud density fractal. Something that does not exist outside a set range. Like a heightfield. HFs have a floor and a maximum height, that can be coloured to base black, max height white, so we now have a range we can subtract from the cloud density fractal.

Here's where I am with this so far. All images use the same cloud density fractal and cloud node. The first has no subtraction. The second has full subtraction. The third has half subtraction.

Now this is early days, as I've not played around too much with the heitfield fractal, and am sure there are better shapes to be had. I also want to find a better way other than using HFs. I've not tried 2d PFs (setting y to 0 in the PF scale) with much success yet. So if anyone has some thoughts, please chime in.

#### dandelO

##### August 18, 2010, 01:02:12 pm #1
Nice ideas, Hetzen. What I've been doing is much the same idea; using a set cloud depth and, in much the same way as you describe, subtracting shapes from that. For example, I'll set a cloud layer to have 3 or 4 thousand metres depth, without a fractal that's just one big, solid block of cloud. I then use surface layers(Y for alt) for distributing the forms within that boundary. Multiple surface layers can control many fractal's distribution, per single cloud layer. I done this with my cumulus-fractus to control the wispiness distribution, I'm also doing much the same with my new WIP mammatus setups. Subtracting from a block of bare cloud is definitely the way to go, though. Keep going!

#### Hetzen

##### August 18, 2010, 01:03:16 pm #2
Two more. This time a more varied and interesting Heightfield, an a new cloud DF seed. The second image has had a colour adjust put in between the HF and the subtraction function.

As you can see in both images, there is little to no clamping on the top of the clouds.

Another way of looking at this technique. Imagine creating a terrain, then say that clouds can only exist inside those mountains.

#### Hetzen

##### August 18, 2010, 01:06:56 pm #3
Quote from: dandelO on August 18, 2010, 01:02:12 pm
Nice ideas, Hetzen. What I've been doing is much the same idea; using a set cloud depth and, in much the same way as you describe, subtracting shapes from that. For example, I'll set a cloud layer to have 3 or 4 thousand metres depth, without a fractal that's just one big, solid block of cloud. I then use surface layers(Y for alt) for distributing the forms within that boundary. Multiple surface layers can control many fractal's distribution, per single cloud layer. I done this with my cumulus-fractus to control the wispiness distribution, I'm also doing much the same with my new WIP mammatus setups. Subtracting from a block of bare cloud is definitely the way to go, though. Keep going!

Yeah I've been playing around with subtracting from white. But I actually like getting the weird shapes out of PFs, then subtracting into those.

Have you ever managed to get a flat PF. ie one that doesn't change over Y. I've not really looked into it, but when I had, I didn't get the result I was looking for, by setting the y scale to 0. Maybe a really small number instead. The problem with HFs, is that you are limited to it's boundry and resolution.

#### Hetzen

##### August 18, 2010, 02:38:04 pm #4
Actually, re-reading your post Martin, using surface/distribution throughout the altitude is not a bad idea, although I'd imagine getting things to line up is a bit of a pain.

#### Hetzen

##### August 18, 2010, 02:59:35 pm #5 Last Edit: August 18, 2010, 03:05:34 pm by Hetzen
Just a few more. The first shows the connections, second a softer edge on the clouds, the third with the heightfield underneith it (although you have to take perspective into consideration).

I've circled in red the important bit in the HF shader. You need a control of 0 to 1. This also applies for your DF. It needs to be clamped in upper and lower colour.

#### Tangled-Universe

##### August 18, 2010, 03:21:23 pm #6
Very interesting techniques Jon. Definitely worth investigating.

There's indeed no clamping at the bottom and top of the clouds, that's already a great improvement.
However, in some parts the density of the fractal drops completely and leaves huge features without any profile. See what I mean?

I don't think that has something to do with your technique, it's inherent to the cloud-/fractal architecture.
It's extremely difficult to get an absolute homogenous distribution of same sized, dense, tall/high features. I wonder if it is even possible at all?

Luckily, for still images, it isn't a huge problem, but still very challenging. However, for animation purposes it's very important to have this.

#### Hetzen

##### August 18, 2010, 03:41:55 pm #7
Yes you are right Martin. But I think this can be fixed with the warp shader, although I do actually like the variation in texture, especially if you have a couple of other cloud layers in there.

As for animation, everyting should stay still. There is very little one arm banditing with the seeds here. What would be very usefull, is being able to simulate the Heightfield generate, without creating a bitmap. ie a 2d fractal. Even better if it warps around the planets altitude.

But the real goal here is to create far more interesting variation in cloud tops. This I think has been achieved in the context with what I need it for right now, which is essentially above cloud, rather than the looking up perspective.

#### domdib

##### August 18, 2010, 05:39:04 pm #8
Looks very interesting  - hope your investigations bear further fruit.

#### dandelO

##### August 18, 2010, 07:49:17 pm #9
I had the wrong idea when you said 'subtracting' from the cloud. I thought you meant cutting away at a fixed block, not subtracting from each fractal.

I meant something like this(as crude as it gets but I can't think how to describe it without a diagram).

[attachimg=#]

Using this method, I can constrain as many fractals as I want to a given height range. Here, just 2; a low base fractal and a high billowy one. I blend them together, so the billows only appear where the base fractal is and constrain them to intersect and fade into each other with alt fuzzy zones. This way, I am not relying on the cloud layer depth, or its boundary limits, I'm just filling a pre-set space with layers that I can blend in myself.

It's been working for me, I was facing nasty limitations trying to stretch fractal forms with a default layer's depths and such, maybe this is far from what you are talking about.

#### dandelO

##### August 18, 2010, 08:00:49 pm #10
In practice, here's my quickie(the simple shape shader here simply serves to isolate the cloud, so we can see the edge profile).

[attachimg=#]

The numbers are a bit different in this clip than they are in the theory diagram but it's the very same technique.

This cloud clip will appear in the sky at; X=0m/Z=10,000m. It's also 10,000m square, you can't miss it!

[attachimg=#]

Still, I don't know if that's any help at all, sorry if I'm off the beat!

#### dandelO

##### August 18, 2010, 08:10:55 pm #11 Last Edit: August 18, 2010, 11:01:55 pm by dandelO
Quote from: Hetzen on August 18, 2010, 12:07:43 pm
Essentially, the cloud node defines the top and bottom of the cloud layer.

Reading back, I think I do understand you correctly, after all.
With altitude constraints, the cloud node no longer defines this, you do!

Make the base cloud as deep as you like, you only need show your own restricted portions of that depth. Just find a good balance of initial cloud layer depth/samples, you won't want a 100,000m deep cloud, or you'll be there for 100,000 days rendering.

* Edit: A limitation of this method is, there will be falloff the further you get from the origin because Y is used for altitude, I think.
Would using non Y altitude surface layers take measurements from the planet surface normal, like the cloud layer does?

You can see multiple floors and ceilings here, still only one cloud layer but, density fractals with surface layers control each floor/ceiling.
It's still blended by the simple shape shader so, these 'floors' are stacked atop one another, you could fly between them.
Sorry they're horrid fractals I've quickly thrown together, it just shows basically how I would slice a single cloud layer.

[attachimg=#]

And, a nasty one with some noisy cloud on top of the second floor(has its own floor too, it's hidden in the middle of the second).

[attachimg=#]

#### Tangled-Universe

##### August 19, 2010, 02:18:34 am #12
Interesting techniques Martin, definitely useful. The culprit with your technique is that you still have a soft base and top of the cloud. Yes, you can set the fuzzy zones to 0, but it will highly probably chop away clouds somewhere.

I think a "hybrid" approach might work best, but I think I'll Jon let that explain himself, because he showed me his way of subtracting fractals (it's slightly different of "just" subtracting).

It's just very hard to get natural looking unclamped clouds.
Hopefully Matt finds time ever to create Cloud V4.

#### dandelO

##### August 19, 2010, 05:30:44 am #13
Indeed, Martin. But, if it wasn't a hugely flawed, hack-n-slash method(as per my usual) I wouldn't be proud to put my name to it!

I never got the heightfield method to work on a cloud before, I remember someone posted some great work on this about a year ago, too.

The fractal colour subtraction in combination with a generated heightfield shape is a great idea.
I'll keep playing but I'll let Hetzen have this thread back and post to a different one if I need to, sorry again for the invasion.

#### Hetzen

##### August 19, 2010, 06:24:23 am #14
Hey, no problem with anyone chiming in on this at all. As far as I'm concerned, the challenge was set in the first few lines at the top of the thread, and your method certainly conforms to the idea of being able to shape clouds. Thanks for taking the time to explain it.

My problem with blending fractals in the cloud layer, is the softness you get as you hack into white with greys, as Tangled Martin has pointed out. The way I wanted to approach this, is by using billows noise to at least keep the integrity of billows from the cutting off the top. The other advantage, is that I can see what my HF is doing extruded from the ground, and allows me to paint in/out areas, or add other features if wanted, before I go into long cloud preview renders. So I think I get more control, at the cost of being restricted to HF boundries and resolution.

What I would like to know, is how to create a 2d fractal from PFs. I can do this with perlin functions, I just keep 0 in it's y input, but then I'd have to end up recreating a PF from scratch, to get the variation of noise in. And tbh, that scares me atm.