Planetside Software Forums

General => Terragen Discussion => Topic started by: Alf15000 on July 19, 2012, 06:37:00 AM

Title: What does Clamp High or Low Color do ?
Post by: Alf15000 on July 19, 2012, 06:37:00 AM
Hi everyone,

I just test the Clamp High Color function in Power Fractal Shader V3, but results are the same even this function is activated or not. I think Clamp High (or Low) Color "force" color value to stay between 0 and 1, but a green high color with value of 5 or -5 doesn't change regardless the Clamp High Color activation (same thing with low color).

So is Clamp color function really useful ? Can you give me an example ?

Thank you for answer
Title: Re: What does Clamp High or Low Color do ?
Post by: Tangled-Universe on July 19, 2012, 07:26:29 AM
The fractal usually generates a value between -1 and 1 and indeed, the clamp tickboxes make sure that the output of the fractal is within that range.

However, somehow and I don't know why Matt made it that way, the output can be < -1 or >1.

This depends on the contrast setting I'd tend to say. High contrast increases the range of output in both directions.
I'm not sure if this is correct, but if it is I'm wondering why the output just can't be between -1 to 1 and have the contrast function be a bias colour/scalar.

So perhaps the reason you don't see a difference is due to the contrast value.
Other parameters in the fractal can influence this as well like noise variation.

In my experience you see this clamping effect the best when using clouds.
Title: Re: What does Clamp High or Low Color do ?
Post by: Alf15000 on July 19, 2012, 07:42:01 AM
Thank you !  :)
Title: Re: What does Clamp High or Low Color do ?
Post by: FrankB on July 19, 2012, 08:27:44 AM
Actually a typical use case is whenever you use the grayscale color from a power fractal as a blend shader for some other function.
(The clamp functions definitely work on greyscale.)

As I understand it, the key to your questions lies in the noise variation method. For any method except "clamped multi fractal", the power fractal will add variation and generate greyscale value below and above the low and high color specified.

Now, for example with clamp low color activated, you can clamp the low color output of the power fractal to 0, whereas you still allow the power fractal to have a noise variation that exceeds the high color you have specified.

Title: Re: What does Clamp High or Low Color do ?
Post by: Alf15000 on July 19, 2012, 11:00:40 AM
Thank to both of you. I better understand this "subtil" function. After other tests, I noticed very small variations on some areas, barely visible.
Title: Re: What does Clamp High or Low Color do ?
Post by: Tangled-Universe on July 19, 2012, 11:52:56 AM
Quote from: FrankB on July 19, 2012, 08:27:44 AM
Now, for example with clamp low color activated, you can clamp the low color output of the power fractal to 0, whereas you still allow the power fractal to have a noise variation that exceeds the high color you have specified.

Doesn't it clamp to -1 for low colour?
Title: Re: What does Clamp High or Low Color do ?
Post by: rcallicotte on July 19, 2012, 12:29:36 PM
Glad you're back posting, TU.  You have a great knack of thoroughly explaining things.
Title: Re: What does Clamp High or Low Color do ?
Post by: Matt on July 19, 2012, 05:47:12 PM
The fractal controls the blend between the low colour and high colour. Imagine the fractal produces values ranging between 0 and 1. Where 0 is produced, the shader outputs the low colour. Where 1 is produced, the shader outputs the high colour. However, the fractal is controlled by the "colour contrast", "colour offset" and "colour roughness" parameters. Especially "colour contrast" and "colour offset", these can push the fractal outside the range 0 to 1. The simplest way to test this is to set contrast to a high value e.g. 10. When this happens, colours will be extrapolated outside the range of the low colour and high colour. If these colours are simply white and black (with values 1 and 0), you can easily predict the outcome. You'll get greyscale colours that are brighter than white (greater than 1) and on the low end you'll get negative colours. With other colours, mathematically the same extrapolation occurs, but figuring out what colours will be produced is a bit less intuitive.

The clamp options allow you to clamp the fractal values to the range 0 to 1 so that the output colours never extrapolate outside of the mix between the low colour and the high colour. So, it does not clamp the output colours to black and white - it clamps at the colours specified in by "low colour" and "high colour".

Unfortunately the explanation in the Wiki is wrong. I'll have to fix that.

Matt
Title: Re: What does Clamp High or Low Color do ?
Post by: Matt on July 19, 2012, 05:49:42 PM
Quote from: Tangled-Universe on July 19, 2012, 11:52:56 AM
Quote from: FrankB on July 19, 2012, 08:27:44 AM
Now, for example with clamp low color activated, you can clamp the low color output of the power fractal to 0, whereas you still allow the power fractal to have a noise variation that exceeds the high color you have specified.

Doesn't it clamp to -1 for low colour?

You never see the value of the fractal directly, so it doesn't make sense to attribute a value to it. You only see the values after it's mapped onto the high colour and low colour. In my explanation I chose to call the low point 0 and the high point 1 to simplify the explanation, but I think in the code it might actually be -0.5 to +0.5 and then mapped to 0..1 to control the interpolation. It doesn't really matter - that's an implementation detail that could easily be different and the shader output would still depend on the low colour and high colour.

Matt
Title: Re: What does Clamp High or Low Color do ?
Post by: Tangled-Universe on July 20, 2012, 02:36:31 AM
Quote from: Matt on July 19, 2012, 05:47:12 PM
The clamp options allow you to clamp the fractal values to the range 0 to 1 so that the output colours never extrapolate outside of the mix between the low colour and the high colour. So, it does not clamp the output colours to black and white - it clamps at the colours specified in by "low colour" and "high colour".

Ah thanks, so basically anytime contrast is >1 you can expect the output to be greater than 1 x "high colour".
Especially the latter I didn't know, that it was clamped to the high colour, even if it's 50% gray.

Quote from: Matt on July 19, 2012, 05:49:42 PM

You never see the value of the fractal directly, so it doesn't make sense to attribute a value to it. You only see the values after it's mapped onto the high colour and low colour. In my explanation I chose to call the low point 0 and the high point 1 to simplify the explanation, but I think in the code it might actually be -0.5 to +0.5 and then mapped to 0..1 to control the interpolation. It doesn't really matter - that's an implementation detail that could easily be different and the shader output would still depend on the low colour and high colour.

Matt


But what if you want to do a bit of math on it? Don't you want to know or at least have an idea what the 'value' is?

Quote from: Matt on July 19, 2012, 05:47:12 PM
Unfortunately the explanation in the Wiki is wrong. I'll have to fix that.

Talking about this. Since understanding the powerfractal is such an important shader to understand and likely key to succesful/nice images, can you go through the whole powerfractal reference? It's pretty old and feels a bit unfinished as some things are very shortly explained while there's more to it.
Especially the working of variation method + buoyancy + clamping is what interests me.
Title: Re: What does Clamp High or Low Color do ?
Post by: Alf15000 on July 20, 2012, 05:01:40 AM
Thank you for your explanation, Matt. I'm going to test Clamp color function WITH high value of color contrast, I think it will get better :-)
Title: Re: What does Clamp High or Low Color do ?
Post by: efflux on November 09, 2012, 11:10:03 AM
Just a comparison note with Mojoworld in relation to this. It's one aspect of Mojoworld that is really good. You can tweak around with the basis functions and blend them a whole load before they goes to the fractal. This window even have it's own curve graph. You also see the basis form in a small preview. This window does give you a readout of the lowest and highest values being created so you know if it's gone way out of the normal range. Then in the curve graph after the fractal you can adjust highest and lowest range of input and output. This is also where you can apply several different forms of clamp but to any values. So you see that this whole aspect of manipulating the lowest and highest values and everything in-between is very weak and long winded in TG2.
Title: Re: What does Clamp High or Low Color do ?
Post by: Tangled-Universe on November 10, 2012, 04:15:52 AM
Interesting Efflux. Are you able to show an example here? How does that look in your GUI for example and what kind of results can you achieve (more easily or even not possible with TG)?
Title: Re: What does Clamp High or Low Color do ?
Post by: efflux on November 29, 2012, 12:38:11 PM
I haven't even got Mojoworld installed anymore. Sadly, it's not multi core which pretty much kills it in render speeds. The UI of Mojoworld and it's whole method for dealing with "curving" functions is absolutely great. Unfortunately the Mojo UI elsewhere makes it a total pain. It's not like TG2 where you have total control of what the graphs are like i.e. connecting certain nodes from one graph into another means going out of one graph, into another and then bringing the connecting node in. You'd completly lose track when things got complex.

I did find a shot though. it's the third one down on this page. You also have a curve graph purely for the basis function. Then another one after the fractal. The curve graph can also be a separate node. It's just that Mojo has "simple" UI and then a more complex UI using nodes. Both are a pain.

http://calyxa.pandromeda.com/tutorial/materialexamples/stoneroses.html

By the way, you can't follow through what is described here by converting the technique to TG2 or at least with fractals. Why? Because unlike TG2 you can choose the positioning of the fractal in Mojoworld so you can line up displacements and colours exactly the way you want.

TG2 will eventually get a curve graph (badly needed).

Being able to see the actual full range of the basis function output was useful in Mojo because it was possible to go way out of range. You'd apply a function where you might expect -1 to 1 but the results weren't within what you were after. However, Mojoworld did allow tweaks where this scenario was very likely. Seeing the actual max and min of the basis function was useul. It was only the basis function though. Further tweaking could move it out.
Title: Re: What does Clamp High or Low Color do ?
Post by: Hetzen on November 29, 2012, 05:16:22 PM
How does Mojo apply it's displacements? There must be a hierachy of where the surface meets the next displacement? I've not played with Mojo at all, I should have a look.
Title: Re: What does Clamp High or Low Color do ?
Post by: Hetzen on November 29, 2012, 05:24:18 PM
Quote from: efflux on November 29, 2012, 12:38:11 PM
Being able to see the actual full range of the basis function output was useful in Mojo because it was possible to go way out of range. You'd apply a function where you might expect -1 to 1 but the results weren't within what you were after. However, Mojoworld did allow tweaks where this scenario was very likely. Seeing the actual max and min of the basis function was useul. It was only the basis function though. Further tweaking could move it out.

Something I use on occasion to see if something in my node network is behaving properly, is a conditional scaler, where I use the input as the test signal input, tested against a scaler comparison value, that would give either 1 if positive and 0 if negative. I can then open up the node and then open the preview of that node to see my result.

I've found it quite useful to test ranges. Almost like a multimeter.
Title: Re: What does Clamp High or Low Color do ?
Post by: efflux on December 01, 2012, 06:36:22 AM
Quote from: Hetzen on November 29, 2012, 05:16:22 PM
How does Mojo apply it's displacements? There must be a hierachy of where the surface meets the next displacement? I've not played with Mojo at all, I should have a look.

If you look at that link, there is a bit where Calyxa describes (and with picture) the differences of using World Position, Surface Position and Undisplaced Surface Position. There is also Undisplaced World Position but you also have slope and altitude or any other positioning graphs you can tweak up. Positions are nodes (like TG2) except in Mojoworld nothing has a set position. You can choose that. There are no closed off red nodes.

Calyxa creates the spires which can sit on top of another terrain but they are still terrain. This is all done in a terrain part of the app that has no colour applied. Colour and further displacements are done elsewhere as materials. This is where she uses Undisplaced Surface Position as the blend positioning to blend the materials between spires and surround because she takes the spires fractal as the mask and she wants it's surface position but before displacement otherwise any further displacements will move outside the initial surface position and colour will go wrong because that will be in a new position. The colour from surface position must move with the displacement.

Most importantly, Mojoworld can have surface piled on surface and you have full control of all the positioning and hence the masking needed. TG2 on the other hand give you no control when using fractals. It's the single most crippled aspect of the app. I actually don't think any other 3D app limits you to such an extent. The fractal at minimum needs a box where you choose whatever positions are available but better still, you should be able to choose to hook in a positioning node (or nodes).

I wish I didn't keep having to harp on about Mojoworld but the fact is that despite it's other major flaws including being pretty useless now for rendering (not multu core) there is no other procedural app that even begins to come near Mojoworld in it's tweakability. This is really a tragic situation. There may never be an app again like Mojoworld. Seems crazy but this can happen with software like things in the real world. Somebody makes something and nobody ever matches it. Often for financial reasons. Lightzone is what I use for post editing. That's dead now. Already it doesn't work right on Windows 7. Fortunately there is a Linux version which means it lasts forever as is.

You might think code is code so can be replicated but it doesn't always happen. Also, some code is secret. You have to know how to replicate it and have people willing to pay for that. Not really that different from knowing how to make something in the real world. Gibson guitars are junk now but the guys who made the original Gibson electrics still make guitars. I have one and Gibson's Gibsons are no contest yet they appear to be the same.