What does Clamp High or Low Color do ?

Started by Alf15000, July 19, 2012, 06:37:00 AM

Previous topic - Next topic

Alf15000

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

Tangled-Universe

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.

Alf15000


FrankB

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.


Alf15000

Thank to both of you. I better understand this "subtil" function. After other tests, I noticed very small variations on some areas, barely visible.

Tangled-Universe

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?

rcallicotte

Glad you're back posting, TU.  You have a great knack of thoroughly explaining things.
So this is Disney World.  Can we live here?

Matt

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
Just because milk is white doesn't mean that clouds are made of milk.

Matt

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
Just because milk is white doesn't mean that clouds are made of milk.

Tangled-Universe

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.

Alf15000

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 :-)

efflux

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.

Tangled-Universe

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)?

efflux

#13
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.

Hetzen

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.