# Planetside Software Forums

## General => Image Sharing => Topic started by: KlausK on May 16, 2017, 12:44:03 AM

Title: Blue Node Playground
Post by: KlausK on May 16, 2017, 12:44:03 AM
Hello everyone

wouldn`t it be nice to have a thread where anybody can show random examples of his or her blue node functions.
Code snippets so to speak. Not too complicated and elaborated but more of a place to start and see some combinations of nodes in action.
Converting simple mathematical functions to blue nodes, or just start off with a "Get position" node and connect in trial and error.
This could help build up a library of simple building blocks to give everyone some ideas how to implement them in their terrains.

A place to get started in playful examination, perhaps. Join in if you like.
Title: Re: Blue Node Playground
Post by: KlausK on May 16, 2017, 12:56:44 AM
I`ll start off with this one:

extract the x value from the "Get position" two times, rotate it around y, convert to scalar and on one side of the tree
divide the scalar and, on the other side connect a sin function node and multiply it with a scalar value. Mix the results
and feed them into a "Displacement" node. This gives you the wavy forms of the "Mix scalar Preview" (125m scale).
You better mask this off - as I did in the surface layer - because else it covers the whole planet and gets very slow.
The "Fractal Warp shader" makes for the nice connection of the waves and the surrounding terrain / surface.
No "Compute Normals" involved.
cheers, Klaus
Title: Re: Blue Node Playground
Post by: cyphyr on May 16, 2017, 01:29:16 AM
nice  ;D
I guess you could replace one of the rotate nodes with a "z to scalar" and get a similar (but different) result.
Very limited travel lappy so can't test stuff too easily ...
Title: Re: Blue Node Playground
Post by: Dune on May 16, 2017, 05:31:54 AM
Cool idea, Klaus. I'll add if I think of something, but do have very little time now.
Title: Re: Blue Node Playground
Post by: archonforest on May 16, 2017, 06:44:26 AM
Great idea!
If someone also can explain what those nodes are doing would be even better. That would help to really understand what is going on under the hood!
Title: Re: Blue Node Playground
Post by: KlausK on May 16, 2017, 07:27:10 AM
Thank you, guys.

@cyphyr: Right. But that is for the re-builder to explore. Possibilities are endless as they say.
This is really only ment as a starting point (see attached new picture).

@Dune: That would be very good.

@archonforest: My intention was that if one rebuilds the shown functions on their own
(that is also a reason why I think these examples should only be small networks) you`ll
start to see the changes every blue node induces when you connected.
Those big and complicated examples one finds in the forum are often way too overwhelming to find
a way through for me. "Divide and conquer" should be the Mantra for this thread.
Small nets, easy to rebuild and try on your own. Sooner or later you`ll get the Blues  ;)

Look at the new picture I attached. That demonstrates my way of working with blue nodes especially.
I open the preview window of a node I try to use or a node later in the network to see a intermediate
result of the connected nodes. This way I get a good indication of what the current node really does.

Regarding your remark to have an explanation of what every node does the WIKI really is the place to go.
The networks here should help you better understand the reference text in the WIKI.
I think it would be too time consuming for the contributor to do that. It also takes out the fun of "hacking"
with blue nodes to a certain degree, I think.
Not everyone has the patience or time or wants to read through lengthy post (like this one eg)...
If you ask to much the thread never really takes off, don`t you think?

Anyway, I`ll try to stay on this and post on a more regular basis. Happy networking!
cheers, Klaus

ps: opening up too many of those previews yields in the little but kind of annoying message which can sometimes lead to a crash.
And yes, I reduced the thread count. So, SAFE OFTEN!
Title: Re: Blue Node Playground
Post by: luvsmuzik on May 16, 2017, 08:01:02 PM
The simple shape layer mask explanation is great here, as well as the "tree formation". We do experiment to see what happens with changing variables, and can use that node setup again elsewhere after trials, which is a great part of the fun! Thanks!
Title: Re: Blue Node Playground
Post by: cyphyr on May 17, 2017, 02:49:18 PM
Here is a small selection from my variable voronoi question in Terragen discussion.
Title: Re: Blue Node Playground
Post by: luvsmuzik on May 17, 2017, 04:40:56 PM
Those look like great results, Richard and Klaus.
I am wondering (as I noticed in a few clip files) possible to give original value in the name of the node...like constant scalar 3,  or constant scalar 50? This would help when trying these setups from these great examples....

I already found out that most of these are not huge values....and intended to delve into what I can find WIKI-wise.
Title: Re: Blue Node Playground
Post by: KlausK on May 17, 2017, 05:05:09 PM
That is cool, Richard.

@luvsmuzik: I agree that it is helpful to include the value in the node name.
Even simpler, since this is not production stuff but a playground, I post the file, of course.
Simply forgot...
cheers, Klaus
Title: Re: Blue Node Playground
Post by: KlausK on May 18, 2017, 01:53:00 AM
Here`s a new one.
Masking with a animated "Get Altitude" node.
This could have been done with simple masks as well, I guess.
I wanted to try the "Get Altitude" node(s) because I do not quite understand how to use them.
Maybe I`ll stumble upon other ways to incorporate them in a node tree.
Other network with this node are very welcome.
cheers, Klaus

Title: Re: Blue Node Playground
Post by: luvsmuzik on May 18, 2017, 01:44:33 PM
That is so awesome!  :)
Title: Re: Blue Node Playground
Post by: KlausK on May 19, 2017, 05:26:38 PM
This one was about trying to find out what to do with the "Function / Trigger" nodes.
I will prepare the project file with some notes when I find the time.
Quite nice the structures I could get with these few nodes. Looks a little like man made
stuff broken by forces of nature or whatever to me. Anyways, could be a good start to
build on after the "Compute Terrain" node, I guess.
There is also some trickery with colour displacement involved.
cheers, Klaus

ps: once more I find that 5mb is not really much for a movie file  :-\
Title: Re: Blue Node Playground
Post by: KlausK on May 19, 2017, 05:27:30 PM
The Movie.
Title: Re: Blue Node Playground
Post by: Oshyan on May 19, 2017, 11:01:03 PM
We're not really intending to host anything except very small videos here. If you need to share larger files of video you can just upload to YouTube or Vimeo, and if you don't want it to be public, just set it to private/link only.

- Oshyan
Title: Re: Blue Node Playground
Post by: Dune on May 20, 2017, 06:23:50 AM
Nice experiments, Klaus. But I wonder, are you just putting lines of random blues together or is there some knowledge behind this (that eludes me)? Positively meant! E.g. what does luminance to scalar do with get position (is there luminance in a position?)? And what does the degrees to radians do? I think the result would be the same with just the get position and the sinus.
I sometimes put blues together, but some of those I never really understand, like 'get final color'`, 'normalize vector'.... I was hoping to use them for something interesting, but always failed.
Title: Re: Blue Node Playground
Post by: masonspappy on May 20, 2017, 01:15:02 PM
I like the implementation of this.  Most people in this group are extremely visually-oriented, so it never made much sense  to see blue nodes described primarily with plain text.
Title: Re: Blue Node Playground
Post by: KlausK on May 22, 2017, 11:42:03 AM
@ masonspuppy
well, i started this thread in the hope to build up some sort of illustrated blue node dictionary.
This is simply a reaction to the latest discussion about the Help files and Documentation for TG.
I intend to post my low level blue node examples here as I go along.

@ Dune
It is a bit of both, actually.
I know my way around Trigonometry quite well (thinking how many decades back I learned about it in school), I think.
So it is not random stacking most of the time.
I have some ideas about what I want to do, which blue node is available in TG for the task, read up upon the nodes in
question in the TG Wiki node reference and then try to verify if I understand correctly what the Wiki description states.
If the resulting output fits my expectation, I am on the right track (regarding the problem).
If not, read again and grab the old math books from the shelf or find another way. That`s about it.
It is the same learning experience you or anybody else is make using the "high level" prefab terrain nodes, I think.

Starting out with just a "Get Position" and going on from there gives me the fastest and "purest" output of a node
or function I use in the network. As I understand it these low level blue nodes are the ingredients making up the
high level shaders (with a lot more going on under the hood, I presume).
So understanding and recognizing the effect they have helps me understand the inner workings of the program a little better.
And it is fun to do. It`s like visual programing in Softimage ICE again.

On the other hand, I cannot for example explain mathematically correct and logically to you why the "Get Position"
is represented in TG the way it is. Reading the nodes description and the description of the "Render State" does not
make it all that clear to me. But what I can investigate is how this representation of the "Get Position" node can be
altered by following nodes in a certain context. I am presented with colour information in the first place - not the
numerical values of a position. Where there is colour information there must be luminance information embedded as well.
That is how I "jump" to conclusions. Looking at the result of the stacking I can then compare this to my conclusion / expectation.
Like this:
[attach=1]
So, here is what the "Luminance to Scalar" node does to the "Get Position":
[attach=2]

Looking up the Wiki Node Reference you`ll find that a Trigger function node like "Sin Scalar"
expects a Input value in radians rather than degrees if you are doing trigonometric calculations.
That is what the "Degrees to radians scalar" node is used for.
[attach=3]
And this is directly from "Get Position" to "Sin Scalar". Very different result:
[attach=4]

Take from it what you might find useful.
I am not doing tutorials on how to achieve this or that effect or terrain.
That is not what I am interested in. And for you my little experiments won`t be too helpful anyways since
you know your way around TG so well already. Looks like you can achive most of what you want even without
those little helpers...For me through better understanding those simple networks knowing what to do when
building specific terrains with those "high level" nodes is what I am aiming at.

And I am doing it just for fun. There is no greater purpose behind what I am doing.
I am not aiming for a end result so to speak. I am not looking for the perfect picture here.
cheers, Klaus

ps: sorry for another "speech".

Title: Re: Blue Node Playground
Post by: luvsmuzik on May 22, 2017, 12:46:24 PM
:) It is about the fun of it for many of us, Klaus and Dune. I remember eons ago using another program where you could calculate your sky and stars with a simple input calculator, (number of stars, distance, size variation, etc). This resulted in a spherical shape with small spheres surrounding your scene, able to rotate on a target axis. From there you could change the star colors or vary brightness in your little animation. My point is this, thinking back to develop an object for my fountain quest, I thought okay...try to duplicate that in an object and the filter may pick up the brightness with the new burst function in rendering. So we do go back to our early days and try to combine with the new I think.
Ever grateful for all this discussion and examples. :) You never know what showing one little thing can make someone think about trying to do.
Title: Re: Blue Node Playground
Post by: Dune on May 22, 2017, 01:38:27 PM
Thanks for explaining, Klaus. I really appreciate your experimentation, and indeed, it has taught me a lot as well, though I can't fantom the more intricate blues. And I am too lazy too look up anything in the wiki.
Sometimes you figure out some line of nodes in your head, put it together and it doesn't work, mmm, then start working around it, trying different alternatives. And sometimes find interesting results (or get frustrated).
It's the fun indeed!
Title: Re: Blue Node Playground
Post by: KlausK on July 06, 2017, 11:59:25 AM
Hi, while putting together another Blue Node example I animated the Gradient Patch Size of the Compute Terrain for a change.
I was curious how that would look. A little disappointing I must say. I expected to see a rather organic shaping of the terrain but
this looks a little like two 2D pictures being aligned over time. Well, at least I know now  :-\
Cheers, Klaus
Title: Re: Blue Node Playground
Post by: luvsmuzik on July 06, 2017, 02:41:54 PM
Wonder if this could be useful using water shaders? Probably enormous render time, I suppose.
Anyway, great effort! :)
Title: Re: Blue Node Playground
Post by: KlausK on July 06, 2017, 04:43:27 PM
While I am at it...a little comparison of the Gradient Patch Size of the Compute Terrain node.
This is always the same terrain and pov. Pretty dramatic changes, right?!
There is a similar example in the Wiki to show the effect of varying sizes on a snow shader layer.
@luvsmuzik: worth a try with a water shader.
Cheers, Klaus
Title: Re: Blue Node Playground
Post by: Dune on July 07, 2017, 06:48:16 AM
Interesting experiment, Klaus.
For newbies; it's often very handy to vary the patch size for certain effects, like really big (50+) for smoother snow fields when using a displacement intersection in later surface shader, or very small for detailed lateral or recalculated normal displacements (which should come after that compute terrain).
Title: Re: Blue Node Playground
Post by: KlausK on July 10, 2017, 01:40:10 AM
@Dune: thanks and thanks for the additional info.
Cheers, Klaus
Title: Re: Blue Node Playground
Post by: KlausK on July 10, 2017, 01:49:49 AM
Time for another round.

Starting with the default scene I always unhook the "Terrain" nodes from the "Compute Terrain" node first. In goes the "Displacement shader" node.
Here I can connect to all the blue node functions I come up with.

In this example I take a "Perlin 3D scalar" node, feed a "Get position in geometry" into the input and try to find a interesting or useful pattern.
Constant scalars going into the "Scale" and "Seed" input of the "Perlin 3D scalar" node. The "CS Perlin Scale" node carries my initial scalar value
(which looked good to me together with the "Seed" node number).
Using the "Multiply Scalar" node with a "Constant Scalar" node as multiplier is like using a slider. This way I keep the initial value I liked so far and
only change the multiplier to change the scale of the pattern. Setting it to 1 resets to the initial value.
I tend to forget the values I change after a few minutes testing and trying... Now I have the pattern I want to go on with.

Then I use the "Length to scalar" node. The node calculates the length, or magnitude of the input vector and then outputs the length as a scalar (Wiki-text).
So, it takes the set of three scalars the vector consists of, and then uses a formula (explained in the Wiki Node Reference) to calculate a single scalar value.
The node views illustrate the steps from Perlin 3D Pattern over Length to scalar to the then clamped output. As you can see disabling the conversion node
(Length to scalar) and connecting the "Perlin 3D scalar" directly to the "Clamp scalar" Input yields a very different result.
Which lets me choose how I want to go on.

The "Divide scalar" and its "Input 2" could be replaced with a "Colour Adjust shader".
They work essentially the same. With the "Divide scalar" node you only need to control one value (CS Divide Input 2).
Faster and easier for the time being.
Feed this into the "Displacement shader"s "Function" input and adjust the value in the "Displacement multiplier" field.
Putting in a positive value will give you something like trenches, carvings, engravings or whatever these things are called;
using a negative value lets rise the ridges (or lowers the rest).
The brownish areas are the result of the "Fractal terrain" attached to the "Input node" of the "Displacement shader".

That`s it. Hope these easy setups are useful to someone (and hopefully I did not mess up the description  ::) ).
Cheers, Klaus
Title: Re: Blue Node Playground
Post by: KlausK on July 10, 2017, 01:06:15 PM
This is going a little bit further.
Using the "Sin scalar" to feed a "Fractal warp shader". The rings are the output of the "Sin scalar".
The "Constant scalar" connected to the "Divide scalar" is sort of a slider again and controls the "steepness" of the rings.
Meaning, how fast the ring rises: slower and softer, or faster and steeper.
Combined with the "Fractal warp shader" results in the masked out center of the node preview image.
Then I merge the output of the "Displacement shader" I already have, controlled by the original "Fractal terrain" node.
Play a bit with the "Merge mode" of the colour and especially the "Merge Displacement" tab - in this case it is set to
"Multiply (A * Input`s diffuse colour)", add the "Base colours", and this is what I get.
Cheers, Klaus
Title: Re: Blue Node Playground
Post by: Matt on July 16, 2017, 01:34:00 PM
Then I use the "Length to scalar" node. The node calculates the length, or magnitude of the input vector and then outputs the length as a scalar (Wiki-text).
So, it takes the set of three scalars the vector consists of, and then uses a formula (explained in the Wiki Node Reference) to calculate a single scalar value.
The node views illustrate the steps from Perlin 3D Pattern over Length to scalar to the then clamped output. As you can see disabling the conversion node
(Length to scalar) and connecting the "Perlin 3D scalar" directly to the "Clamp scalar" Input yields a very different result.
Which lets me choose how I want to go on.

Length to Scalar is designed for a vector input, but Perlin 3D Scalar outputs a scalar. If you plug a scalar into a function that expects a vector, Terragen automatically converts the scalar to a vector by copying the scalar into all 3 components of the vector, so if the scalar has value 't' then the vector will be (t,t,t). Now when Length to Scalar computes the magnitude of this vector it will be sqrt(t^2 + t^2 + t^2), which is equal to t * sqrt(3). In other words, using Length to Scalar on a scalar input is simply an inefficient way to multiply it by 1.732.

Matt
Title: Re: Blue Node Playground
Post by: KlausK on July 16, 2017, 11:33:33 PM
OK, thank you for the explanation, Matt. I changed the network accordingly.
Cheers, Klaus
Title: Re: Blue Node Playground
Post by: KlausK on July 17, 2017, 12:08:13 AM
Instead of painting a mask I generated it with blue nodes. "Mask Manipulator" in the network view.
This is fed into the "Fractal terrain" node which acts as a "Mix Controller" in the "Merge" node.
The pictures show the effect of the mask, using positive and negative values (+- 10) for the applied "White Colour".
This helps to control elevated or sunk in terrain respectively. Very nicely carved out structures, I think.
"Base colours" have the scale values manipulated differently.
Cheers, Klaus
Title: Re: Blue Node Playground
Post by: bobbystahr on July 19, 2017, 01:02:31 PM
Cool thread and given a case of insanity I may try it, heh heh heh, cuz it'll make me nuts anyway...Interesting work Klaus...