soft maximum/minimum

Started by Dune, December 04, 2015, 03:14:45 AM

Previous topic - Next topic

Dune

I can't get these to work for me, so is there anyone who can explain? I am hoping to make the hard clamped colors of a PF into a 'soft-clamped' version.

WAS

Quote from: Dune on December 04, 2015, 03:14:45 AM
I can't get these to work for me, so is there anyone who can explain? I am hoping to make the hard clamped colors of a PF into a 'soft-clamped' version.

I think Chris can help with this, he's actually helped me with understanding them more, and I do use them so soften things up a bit. Just haven't been able to achieve a true soft effect.

AP

It is for a Power fractal though, what i used were noise functions. The Power fractal noise needs to be converted into something that those functions can read but i tried and nothing so far.

bobbystahr

We need an all purpose Gaussian Blur shader......just stick it in the stack and adjust....
something borrowed,
something Blue.
Ring out the Old.
Bring in the New
Bobby Stahr, Paracosmologist


bobbystahr

something borrowed,
something Blue.
Ring out the Old.
Bring in the New
Bobby Stahr, Paracosmologist

AP

Perhaps someday some programming genius will come along and solve this. It happened to erosion.

Dune

Thanks guys. I got it working somehow, but probably not what it's meant for and how it's supposed to be. Seems like the input gets a constant, the softness too, and the input 2 is for a PF. And if you apply a soft max, strangely the minimum is softened, and vice versa, and the whole terrain is raised. Strange.

bobbystahr

Quote from: Dune on December 05, 2015, 02:42:57 AM
Thanks guys. I got it working somehow, but probably not what it's meant for and how it's supposed to be. Seems like the input gets a constant, the softness too, and the input 2 is for a PF. And if you apply a soft max, strangely the minimum is softened, and vice versa, and the whole terrain is raised. Strange.

node network screen grab please and thank you.
something borrowed,
something Blue.
Ring out the Old.
Bring in the New
Bobby Stahr, Paracosmologist

WAS

#9
Quote from: Chris on December 05, 2015, 02:19:06 AM
Perhaps someday some programming genius will come along and solve this. It happened to erosion.

I feel as though if there is a Motion Blur function, we can utilize that as a Blur Function for a texture. For example. 3D Studio Max allows you to blot motion on a object that isn't actually moving, and blur it. If we could utilize similar on a function, blurring it or w/e so only said object/surface is blurred.



There is no actual motion there.

Another example of vectoring being blurred in a non-roster environment. This method is a trick and just multiplying and dimming the edges. Called false-colour on logarithmic scale or FDTD. Which is used in Radio imagining and Astronomy devices to obtain clearer images, or softer images of the cosmos from IR/Radiation data.



So it's very possible and done in a lot of programs already, it's just a matter of someone knowing how to do it for TG.

There is even another method based on FDTD which is called Log Scale Matplotlib PatchCollection Colors someone is trying in Python.

It's basically a edge filter, multiplying and fading the edge colour and blending. But not going to lie it looks like the most complex math ever and probably why NASA and stuff uses it.

Dune

Interesting. No doubt Matt can think of something (in due time)  ;) In the image map shader you can choose for smooth interpretation, but that's pixels, turning off breakup in a surface shader make the edges of fractals smoother also.
Here you go, Bobby. The start terrain is a colored fractal.

WAS

Quote from: Dune on December 06, 2015, 02:20:14 AM
Interesting. No doubt Matt can think of something (in due time)  ;) In the image map shader you can choose for smooth interpretation, but that's pixels, turning off breakup in a surface shader make the edges of fractals smoother also.
Here you go, Bobby. The start terrain is a colored fractal.

I forgot about that, and that will help my.coastal scene so much. Was trying to colums and it just wasn't working right

bobbystahr

Quote from: Dune on December 06, 2015, 02:20:14 AM
Interesting. No doubt Matt can think of something (in due time)  ;) In the image map shader you can choose for smooth interpretation, but that's pixels, turning off breakup in a surface shader make the edges of fractals smoother also.
Here you go, Bobby. The start terrain is a colored fractal.

Wild, although I can rarely grok them I periodically get inspiration from these spidery networks..thanks for posting it mate.
something borrowed,
something Blue.
Ring out the Old.
Bring in the New
Bobby Stahr, Paracosmologist

Matt

#13
Soft Maximum is based on the soft maximum described by John D. Cook:

http://www.johndcook.com/blog/2010/01/13/soft-maximum/

However, Cook's soft maximum uses a parameter called 'k' which can be interpreted as the 'hardness'. For Terragen I wanted this to be a 'softness' parameter instead. For those interested in the math, softness = 1/k. Thinking in terms of softness is more intuitive when working with displacements, because you can consider the 'softness' to be in the same units as the displacement, i.e. metres.

And of course Soft Minimum works in a similar way but upside down.

Quote from: Dune on December 05, 2015, 02:42:57 AM
Thanks guys. I got it working somehow, but probably not what it's meant for and how it's supposed to be. Seems like the input gets a constant, the softness too, and the input 2 is for a PF.

The first two inputs are interchangeable. But when the node is disabled, the main input ("input node") is the pass-through just like every other node in Terragen, so that might affect which one you decide should be the main input.

They don't need to be constants. You could input two fractals, for example. Even the softness could be a fractal.

Quote
And if you apply a soft max, strangely the minimum is softened, and vice versa, and the whole terrain is raised. Strange.

Max and Soft Maximum are supposed to return the maximum of two values. I know that it seems counter-intuitive if you think of it as a clamping function (and I used to have the same feeling when I started coding graphics), but hopefully it makes sense when you think of it as "the greater of A and B".

Matt
Just because milk is white doesn't mean that clouds are made of milk.

Dune

#14
Thanks for your explanation, Matt. I have to dive into it again. I assume the fractal softness needs to have a minimum of a value above black for the least bit of softness, 1 being max? And I also assume the fractal sizes then vary this over space. Some experiments will be enlightening, no doubt.

Or... is it too much to ask for a quick and simple setup of its workings? I was just trying to get it to work (smoothing the lowest areas of a fractal terrain into a valley), but the terrain only doubled in height  :(