Planetside Software Forums

Function Nodes In Practice => Function Node General Discussion => Topic started by: WAS on October 22, 2019, 05:45:52 PM

Title: Cloud Altitude and Density
Post by: WAS on October 22, 2019, 05:45:52 PM
Is it possible to get the cloud Altitude ranges of the shader from functions or something? So you wouldn't need surface layers and editing their alts with the cloud layer? I don't think there is but curious nevertheless.
Title: Re: Cloud Altitude and Density
Post by: Dune on October 23, 2019, 02:47:57 AM
Get altitude and some smooth scalar with altitudes, I suppose.
Title: Re: Cloud Altitude and Density
Post by: Hetzen on October 23, 2019, 07:36:11 AM
Yes that's the way I'd do it too. You can also achieve the same thing with a series of Distribution or Surface Layers. The advantage of doing it in function nodes is you can modulate the ranges with PFs to make an undulating transition which would look more natural.
Title: Re: Cloud Altitude and Density
Post by: WAS on October 23, 2019, 12:48:09 PM
Thanks Ulco, and Jon, that looks much cleaner than than tabbing into surface layers or distribution layers, despite extra nodes.
Title: Re: Cloud Altitude and Density
Post by: bobbystahr on October 27, 2019, 11:48:00 AM
Very cool, thanks.
Title: Re: Cloud Altitude and Density
Post by: WAS on October 27, 2019, 12:52:19 PM
It would be cool if there was a function that could read the cloud layers altitude position and give you a density disc of it's area (or map for v2). Which you could than divide up and Target all parts of the cloud. This would automatically adjust to changing cloud altitudes or depth of clouds.

Something like Get Cloud Altitudes. Even if multiple layers exist in the data, it should still apply in same alt ranges and thus target those clouds in those ranges.
Title: Re: Cloud Altitude and Density
Post by: WAS on October 28, 2019, 06:53:54 PM
For some reason when I use this as a mask it alters the PF into a solid colour.

For example, lets say I have a cloud range at altitude 1750, with a depth of 1000, so base alt 1250, max alt 2250.

If I set a get altitude up for a range of 1750 to 2250, the Density Fractal becomes solid, and doesn't seem to be masking, but breaking the PF.

If I step out of range, like minimum 800, maximum 2500, definition of the actual density starts showing as most of it is within the mask, but it's mostly the whole cloud range, and not the "tops" like id like to isolate.
Title: Re: Cloud Altitude and Density
Post by: Hetzen on October 29, 2019, 06:49:08 AM
Your TGD is working correctly. If you change your minimum altitude values incrementally every 200m or so, you'll start to see the base of your clouds flatten out until they are completely flat. The 'solidity' of your clouds is down to the 0.25 Coverage you have in the cloud node. Setting this back to 0, you'll see break up in the Density Fractals, ie gaps in your clouds again.

If you change your camera position to above the clouds, you'll see that the top detail is still there.
Title: Re: Cloud Altitude and Density
Post by: WAS on October 29, 2019, 12:46:35 PM
Quote from: Hetzen on October 29, 2019, 06:49:08 AMYour TGD is working correctly. If you change your minimum altitude values incrementally every 200m or so, you'll start to see the base of your clouds flatten out until they are completely flat. The 'solidity' of your clouds is down to the -0.25 Coverage you have in the cloud node. Setting this back to 0, you'll see break up in the Density Fractals, ie gaps in your clouds again.

If you change your camera position to above the clouds, you'll see that the top detail is still there.


Interesting. See in the final clouds there is a final density based on the merged densities, with black point at 0.25 for a little more coverage as main density is at -0.5 coverage. It still does this complete coverage thing when the final density doesn't allow that. Must need to clamp something
Title: Re: Cloud Altitude and Density
Post by: WAS on October 29, 2019, 01:12:22 PM
Another issue I have is when I go to drop the "top" of the clouds to capture the "base", it doesn't work as well. A smaller end, where I want it to cutoff at 2750, captures the whole cloud, and when I set the top (end) to 4750 (actual end of the cloud layer limit), it then seems to cut the clouds in half. Lol

Additionally, inverting the masks seems to cause it show top and bottom, with the middle masked or clamped looking.

These are weird oddities I was getting with surface layers as well, and I don't quite understand them.
Title: Re: Cloud Altitude and Density
Post by: Hetzen on October 29, 2019, 03:07:48 PM
The Smooth Step creates a soft ramp from 0 to 1. It will do this over the range you put in to it. The output will seem to 'flip' when the step start value is larger than the step end value:

Step Start = 100 : Step End = 400 : Outputs 0 at 100m, 1 at 400m
Step Start = 400 : Step End = 100 : Outputs 0 at 400m, 1 at 100m

Step Start sets the black point, Step End sets the white point, is another way of looking at it. It's similar to how a Colour Adjust works when working with its black or white points in the Input Levels tab. If you move the black slider past the white, you'll see a similar 'flip'.
Title: Re: Cloud Altitude and Density
Post by: WAS on October 29, 2019, 03:20:54 PM
Quote from: Hetzen on October 29, 2019, 03:07:48 PMThe Smooth Step creates a soft ramp from 0 to 1. It will do this over the range you put in to it. The output will seem to 'flip' when the step start value is larger than the step end value:

Step Start = 100 : Step End = 400 : Outputs 0 at 100m, 1 at 400m
Step Start = 400 : Step End = 100 : Outputs 0 at 400m, 1 at 100m

Step Start sets the black point, Step End sets the white point, is another way of looking at it. It's similar to how a Colour Adjust works when working with its black or white points in the Input Levels tab. If you move the black slider past the white, you'll see a similar 'flip'.

Thank you! That explained it well for me. Especially the last bit. There is a lot of colour adjust stepping which is where the coverages were going out of control. So I'll need to rethink that, and I need to invert stepping for different isolation as you show. Thanks a lot.
Title: Re: Cloud Altitude and Density
Post by: RogueNZ on November 18, 2019, 05:36:52 AM
I barely understand how this works, but I managed to put the concepts here towards making a large CB cloud! Very basic start, and I have some more complicated ideas around shapes which I can hopefully accomplish. Thanks for sharing your TGD Hetzen.

Has there been much discussion on the use of this sort of technique to build cloud structures? Keen to read more.
Title: Re: Cloud Altitude and Density
Post by: Tangled-Universe on November 18, 2019, 06:35:06 AM
That's an insane cloud, really cool!
What's the cloud altitude and depth in this case?
I see stepping goes all the way up to 20km altitude. While such extremes do exist it's usually up to around 12km.

I guess render time is pretty long for such a large depth cloud layer?
(Can't wait until the new threadrippers are released next week!)
Quote from: Hetzen on October 29, 2019, 03:07:48 PMStep Start sets the black point, Step End sets the white point, is another way of looking at it. It's similar to how a Colour Adjust works when working with its black or white points in the Input Levels tab. If you move the black slider past the white, you'll see a similar 'flip'.

Colour adjusts are my preferred nodes to perform these kind of selections.
Besides using PF's as input for smooth steps is there any other reason why I should go for smooth step scalars instead of colour adjust?
I like it that it's doing the job with just 1 node.

@WAS Perhaps you already know, but it might still be valuable for others to know... Be aware that "get altitude" are world space values and "get altitude in texture" are specific for the element the node network eventually ends up, in this case a cloud.
So if you have a cloud layer at 1000m altitude and 2000m depth (base = 0 meters and top = 2000 meters) then when using similar smooth step scalars the results are different between get altitude and get altitude in texture.
Assume step start = 0
Assumte step end = 2000
If input = get altitude --> output is smooth gradient from 0 to 2000 meters in world space.
If input = get altitude in texture ---> output is smooth gradient from cloud altitude to cloud altitude + 2000 meters, because the cloud's principle altitude of 1000m = 0 meters in texture space.
To match the "get altitude" result you'd need to set step start to -1000 and step end to 1000.

In turn this depends on whether you use the checkbox to keep textures when moving clouds.
So before setting up any cloud work think ahead of what you intend to do with the cloud layer and (un)check the "keep texture when moving clouds" box or whatever it's called.
This assures that should you decide to make your cloud movable that you don't have to recalculate and retransform your whole network, also for altitude.
Personally I prefer to work this way by default.
Title: Re: Cloud Altitude and Density
Post by: Dune on November 18, 2019, 09:05:21 AM
Quote from: Tangled-Universe on November 18, 2019, 06:35:06 AMBesides using PF's as input for smooth steps is there any other reason why I should go for smooth step scalars instead of colour adjust?
The only thing (and you probably know) is that a smooth step has a smooth transition (from any 'grey' say into black), whereas the color adjust (when clamped) has hard edges for the same transition. Not really important for clouds, maybe, especially when used unclamped.
Title: Re: Cloud Altitude and Density
Post by: WAS on November 18, 2019, 01:11:06 PM
Quote from: Tangled-Universe on November 18, 2019, 06:35:06 AMThat's an insane cloud, really cool!
What's the cloud altitude and depth in this case?
I see stepping goes all the way up to 20km altitude. While such extremes do exist it's usually up to around 12km.

I guess render time is pretty long for such a large depth cloud layer?
(Can't wait until the new threadrippers are released next week!)
Quote from: Hetzen on October 29, 2019, 03:07:48 PMStep Start sets the black point, Step End sets the white point, is another way of looking at it. It's similar to how a Colour Adjust works when working with its black or white points in the Input Levels tab. If you move the black slider past the white, you'll see a similar 'flip'.

Colour adjusts are my preferred nodes to perform these kind of selections.
Besides using PF's as input for smooth steps is there any other reason why I should go for smooth step scalars instead of colour adjust?
I like it that it's doing the job with just 1 node.

@WAS Perhaps you already know, but it might still be valuable for others to know... Be aware that "get altitude" are world space values and "get altitude in texture" are specific for the element the node network eventually ends up, in this case a cloud.
So if you have a cloud layer at 1000m altitude and 2000m depth (base = 0 meters and top = 2000 meters) then when using similar smooth step scalars the results are different between get altitude and get altitude in texture.
Assume step start = 0
Assumte step end = 2000
If input = get altitude --> output is smooth gradient from 0 to 2000 meters in world space.
If input = get altitude in texture ---> output is smooth gradient from cloud altitude to cloud altitude + 2000 meters, because the cloud's principle altitude of 1000m = 0 meters in texture space.
To match the "get altitude" result you'd need to set step start to -1000 and step end to 1000.

In turn this depends on whether you use the checkbox to keep textures when moving clouds.
So before setting up any cloud work think ahead of what you intend to do with the cloud layer and (un)check the "keep texture when moving clouds" box or whatever it's called.
This assures that should you decide to make your cloud movable that you don't have to recalculate and retransform your whole network, also for altitude.
Personally I prefer to work this way by default.


Thanks for the additional information. I did know this. One thing to keep in mind is texture space altitude keys do not relate to altitude heights. 

Also great work RogueNZ, it seems you got the idea of what I wanted from the discussion or just had the same ideas.
Title: Re: Cloud Altitude and Density
Post by: RogueNZ on November 18, 2019, 04:00:41 PM
Good info there TU.

Cloud depth I believe was 20km, base altitude 500m. Render time was surprisingly quick, about 17mins I believe on the 3900x. AA6 and MPD of 0.5, 100million voxels and no cloud acceleration. Everything else was default I believe.

I still struggle to understand how the Cloud Depth Modulator can be used exclusively to create 3D shapes like this - I understand how density can work (in a 3D space), but in my mind a depth modulator should act like a 2D height map. It clearly doesn't, I must need to think about it some more.

Plugging that branch into Density produces a similar result, but not exactly the same.

This image shows the shapes I would like to create eventually. At the moment I am using three ellipses to drive the shape. In the drawing I'm visualizing how I imagine using these shapes (red) to mask the Power Fractal (grey) should work. I expect I should be seeing flat edges where the mask cuts off the PF. But I don't in my render?

Edit: maybe the edge fall off on the shapes blends the hard edges away? Will test when I get home.
Title: Re: Cloud Altitude and Density
Post by: Hetzen on November 18, 2019, 05:14:39 PM
Good to see you guys working with this setup.

RogueNZ, those profile shapes are possible. One way would be to warp the position of a simple shape shader that has a soft edge using a Get Altitude to determine how it shifts along X or Z through Y. And apply 3 variants with TGD I posted.

You would also need to shift the black and white points of that mask to give you the tapered profile. Colour Adjust does shift black and white points, but it does so statically, ie it doesn't change once set.

So looking at the base of your shape, lets say we have a circular SSS with a radius of 1000m with a Linear edge thickness of 1000m. This node will have a pure white spot in the centre and pure black at its edge, with a linear greyscale ramp from edge to centre.

What you can then do is use a Linear Step node to shift where black and white is within that circles ramp. Just as you can with a Colour Adjust shader. The difference being is the scalar inputs can be adjusted with further functions.

In this example you could use one Linear Step with Get Altitude as its input to create a black point at 0m altitude and white at 500m ramp, which you would multiply by a fraction (0.2 for example) so the output would be 0 to 0.2 and you can use this output to be the black point of another Linear Step which has the SSS as its input. This will shift the black point of the SSS ramp through altitude 0 to 500, from 0 to 0.2. Giving you that tapered shape at the base of your example.

The next step would be to do the same with the white point so that you have a constant falloff from edge to centre of the SSS disk. To do this, take the output of the Get Altitude/ Linear Step/ Muliply (0.2) you've just made and add another fraction (say 0.3) and plug that into Input 2 (the white point) of the Linear Step you used with the SSS input. This will give the profile 'solidity' in the centre and a feather edge of 0.3 all the way up through its altitude.

You can then use that output to Multiply a Density Fractal, or plug it into the DFs mask input, same thing.
Title: Re: Cloud Altitude and Density
Post by: Tangled-Universe on November 19, 2019, 04:00:58 AM
Quote from: WAS on November 18, 2019, 01:11:06 PMThanks for the additional information. I did know this. One thing to keep in mind is texture space altitude keys do not relate to altitude heights.


Ehhh...that was basically my whole story/point ;)
Title: Re: Cloud Altitude and Density
Post by: WAS on November 19, 2019, 04:06:48 AM
Quote from: Tangled-Universe on November 19, 2019, 04:00:58 AM
Quote from: WAS on November 18, 2019, 01:11:06 PMThanks for the additional information. I did know this. One thing to keep in mind is texture space altitude keys do not relate to altitude heights.


Ehhh...that was basically my whole story/point ;)

The offset seems greater than 1000, or am I mistaken? I remember with surface layers I was having to do like -5000 to get around 1750 default base.

It's late and not checking right now. Right mad that windows store won't install anything I just found out. No clue why and no steps online are helping. Was hoping to install the Ubuntu LSS to test the Linux node further but nooo. Ehh nighty night for me
Title: Re: Cloud Altitude and Density
Post by: RogueNZ on November 19, 2019, 05:27:07 AM
Quote from: Hetzen on November 18, 2019, 05:14:39 PMGood to see you guys working with this setup.

RogueNZ, those profile shapes are possible. One way would be to warp the position of a simple shape shader that has a soft edge using a Get Altitude to determine how it shifts along X or Z through Y. And apply 3 variants with TGD I posted.

You would also need to shift the black and white points of that mask to give you the tapered profile. Colour Adjust does shift black and white points, but it does so statically, ie it doesn't change once set.

So looking at the base of your shape, lets say we have a circular SSS with a radius of 1000m with a Linear edge thickness of 1000m. This node will have a pure white spot in the centre and pure black at its edge, with a linear greyscale ramp from edge to centre.

What you can then do is use a Linear Step node to shift where black and white is within that circles ramp. Just as you can with a Colour Adjust shader. The difference being is the scalar inputs can be adjusted with further functions.

In this example you could use one Linear Step with Get Altitude as its input to create a black point at 0m altitude and white at 500m ramp, which you would multiply by a fraction (0.2 for example) so the output would be 0 to 0.2 and you can use this output to be the black point of another Linear Step which has the SSS as its input. This will shift the black point of the SSS ramp through altitude 0 to 500, from 0 to 0.2. Giving you that tapered shape at the base of your example.

The next step would be to do the same with the white point so that you have a constant falloff from edge to centre of the SSS disk. To do this, take the output of the Get Altitude/ Linear Step/ Muliply (0.2) you've just made and add another fraction (say 0.3) and plug that into Input 2 (the white point) of the Linear Step you used with the SSS input. This will give the profile 'solidity' in the centre and a feather edge of 0.3 all the way up through its altitude.

You can then use that output to Multiply a Density Fractal, or plug it into the DFs mask input, same thing.

Wow thanks Hetzen. Can I ask a stupid question? Is this meant to be driving the density function, or the depth function of the cloud layer?

I'm getting some interesting results (trying the taper), not quite what I am expecting, even though I think I understand your explanation. Will post some shots tomorrow
Title: Re: Cloud Altitude and Density
Post by: Hetzen on November 19, 2019, 09:33:52 AM
The above is about shaping the density shape, so should eventually be plugged in to the Density Shader input.

Whilst you experiment with this, it maybe helpful to turn off the Taper Top and Base toggle in the Cloud Layer/Tweaks tab, so that you can see what's happening with your functions without the Cloud Layers internal altitude falloff. And probably work on one shape at a time. Your mid and top shapes will need the altitude Linear Step to have a Compliment Scalar node before it's multiplied, as you will want your shape to be thinner at the bottom widening out towards the top.
Title: Re: Cloud Altitude and Density
Post by: Hetzen on November 19, 2019, 09:36:56 AM
I'm also wondering if this topic should be moved into the Function Node General area?
Title: Re: Cloud Altitude and Density
Post by: Oshyan on November 19, 2019, 01:26:37 PM
Quote from: Hetzen on November 19, 2019, 09:36:56 AMI'm also wondering if this topic should be moved into the Function Node General area?
I was thinking about that too. If you think it's a good fit, happy to do so.

- Oshyan
Title: Re: Cloud Altitude and Density
Post by: WAS on November 19, 2019, 01:28:53 PM
Quote from: Oshyan on November 19, 2019, 01:26:37 PM
Quote from: Hetzen on November 19, 2019, 09:36:56 AMI'm also wondering if this topic should be moved into the Function Node General area?
I was thinking about that too. If you think it's a good fit, happy to do so.

- Oshyan

Seems like a good Get Altitude / Get Altitude in Texture discussion. I'd maybe rename to the topic to be a little more helpful to find.

Also if anyone figures out how to taper column effects please share. For example in RogueNZ example, how could we do a mix, but in the soft zone, get some expansion or contraction
Title: Re: Cloud Altitude and Density
Post by: Hetzen on November 19, 2019, 07:51:31 PM
Quote from: Oshyan on November 19, 2019, 01:26:37 PM
Quote from: Hetzen on November 19, 2019, 09:36:56 AMI'm also wondering if this topic should be moved into the Function Node General area?
I was thinking about that too. If you think it's a good fit, happy to do so.

- Oshyan
I'd say so. It's a good base to explain some techniques.
Title: Re: Cloud Altitude and Density
Post by: RogueNZ on November 23, 2019, 04:56:04 PM
I've spent quite a bit of time playing around and trying to implement Hetzen's suggestions, although I'm now struggling to get the 'natural' cumulus effects I did with my original file. These are some really brain teasing concepts!

Not sure If I have implemented this exactly how you intended. I was also really confused with the effects of the warping. For the mid section (main updraft), I would have thought I should set the black point at zero, and the white point at the top of the cloud, that warp should push the cloud with the base fixed. However I found I had to set the black point at a large negative value (-12000) for this to happen.

There are also quite sharp edges when masking the density fractals, that I never had in the original. In the original, the billows look like they sit on top of the underlying mask, in the latest version they look like they are carving material out of the cloud. 

I've attached my original file and the latest version. Please feel free to play with them and see if you can improve. Note the Fractals currently aren't plugged into the density shader.
Title: Re: Cloud Altitude and Density
Post by: Hetzen on November 24, 2019, 01:26:29 PM
That's a good start. I'll have a proper look at your .tgd this afternoon. One thing that will help the fall off cutting into the noise would be to increase the white point fraction number we talked about earlier from 0.3 to say 0.7. You also may need to widen the Simple Shape Shaders to accommodate a wider fall off. This will make the edge transition softer. Also the mix ranges for base, mid and top could also be thicker to allow a softer transition between the zones.

I like to think of these sorts of masks as 'areas of influence' rather than the final shape.

You will also need to find a noise that works well within these bounds. Something less dense in the PF. A Transform Input node will be useful to position a section of your DF noise that visually looks good into your mask zone.

I'll get onto reversing the taper later.

Lastly for now, the anvil section of a cloud tends not to be as dense as the rising stack, so that may need another cloud layer with a softer look to achieve. Not sure if it's technically possible to modulate Edge Sharpness and Cloud Density options in the Cloud node, but I think that would help making these sorts of structures within one node.
Title: Re: Cloud Altitude and Density
Post by: Dune on November 25, 2019, 02:20:03 AM
I added a white-grey (2-0.5) power fractal as a (blue node) power to the density to get texture in the clouds, and added a transform shader set to world to keep these billows from warping with the cloud. But indeed found that the central column is too dense  in relation to top and bottom.
Title: Re: Cloud Altitude and Density
Post by: Ariel DK on December 01, 2019, 03:02:58 PM
Ok, this was another thing that i wanted to achieve in my planetary clouds setup for my Earth scene...
Time to revisit that old project again 8)
Title: Re: Cloud Altitude and Density
Post by: Valri on January 10, 2020, 02:47:10 PM
It's times like these I really wish Terragen had a better way to group nodes, you can really overload the node network quickly just trying to make a single complex cloud like this, maybe the devs can create a group/box where you don't have to have the nodes all shown at once, sort of like how operating systems have file/folder standards. Just a thought!
Title: Re: Cloud Altitude and Density
Post by: WAS on January 10, 2020, 06:37:50 PM
Quote from: Valri on January 10, 2020, 02:47:10 PMIt's times like these I really wish Terragen had a better way to group nodes, you can really overload the node network quickly just trying to make a single complex cloud like this, maybe the devs can create a group/box where you don't have to have the nodes all shown at once, sort of like how operating systems have file/folder standards. Just a thought!

Have you looked into the Null Shader? You can even store a cloud layers shaders within it's node.

You can highlight, and cut (Ctrl + X) shaders, and enter the internal node network of the parent shader, and paste them in. Here is an example video.

When there are shaders present within a node, that little [ + ] box appears at the right side of the shader, acting as a shortcut to the internal node network.
Title: Re: Cloud Altitude and Density
Post by: Valri on January 10, 2020, 07:23:13 PM
Quote from: WAS on January 10, 2020, 06:37:50 PM
Quote from: Valri on January 10, 2020, 02:47:10 PMIt's times like these I really wish Terragen had a better way to group nodes, you can really overload the node network quickly just trying to make a single complex cloud like this, maybe the devs can create a group/box where you don't have to have the nodes all shown at once, sort of like how operating systems have file/folder standards. Just a thought!

Have you looked into the Null Shader? You can even store a cloud layers shaders within it's node.

You can highlight, and cut (Ctrl + X) shaders, and enter the internal node network of the parent shader, and paste them in. Here is an example video.

When there are shaders present within a node, that little [ + ] box appears at the right side of the shader, acting as a shortcut to the internal node network.
Alrighty! That works! I tried something like this before, I just was not quite sure how to use the null shader before, this show come in handy in the future!
Title: Re: Cloud Altitude and Density
Post by: Oshyan on January 10, 2020, 09:06:12 PM
There's a handy article in the docs (wiki) on this: https://planetside.co.uk/wiki/index.php?title=Organizing_Your_Terragen_Project#Organizing_with_Null_Shaders

Also a video will be published soon about it.

- Oshyan
Title: Re: Cloud Altitude and Density
Post by: WAS on January 10, 2020, 09:47:41 PM
Quote from: Oshyan on January 10, 2020, 09:06:12 PMThere's a handy article in the docs (wiki) on this: https://planetside.co.uk/wiki/index.php?title=Organizing_Your_Terragen_Project#Organizing_with_Notes

Also a video will be published soon about it.

- Oshyan

Too add to what Oshyan... added... you can also conveniently put shaders within a Note, though you'll need to "anchor connect" any output. But it could be a great waiy to explain what's going on within that specific shader group.