Planetside Software Forums

General => Terragen Discussion => Topic started by: WAS on October 01, 2018, 03:25:05 PM

Title: Fuzzy Zones Colour Falloff Problem
Post by: WAS on October 01, 2018, 03:25:05 PM
Is there anyway to defeat TG hard falloff? With surface layers I can never achieve actual smooth transitions. There is always a noticeable line where it drops from above 0 to 0. The only way to defeat it is breakup, but that doesn't help with smooth gradient transitions.

Here you can see the lines created by two surface layers with no breakup and fuzzy zones.

There seems to be a falloff at both 1 to below 1 and from above 0 to 0.
Title: Re: Fuzzy Zones Colour Falloff Problem
Post by: N-drju on October 01, 2018, 03:59:47 PM
Hmm, I always use SSS for smooth transitions be it colors, textures, terrain, even clouds. It leaves no seams at all and, personally at least, I consider it to be the best transition tool, especially combined with warpers.

You can make entire smooth transition chains that way, though you need to remember to disable black color.
Title: Re: Fuzzy Zones Colour Falloff Problem
Post by: WAS on October 01, 2018, 04:37:39 PM
Quote from: N-drju on October 01, 2018, 03:59:47 PM
Hmm, I always use SSS for smooth transitions be it colors, textures, terrain, even clouds. It leaves no seams at all and, personally at least, I consider it to be the best transition tool, especially combined with warpers.

You can make entire smooth transition chains that way, though you need to remember to disable black color.


It's unfortunately entirely useless for altitudes.

I suppose the problem is probably due to the fuzzy zones being clamped, at least they appear to be from 2D preview.
Title: Re: Fuzzy Zones Colour Falloff Problem
Post by: N-drju on October 01, 2018, 04:50:41 PM
You can make an SSS altitude-dependent too, though it may be too cumbersome for your application. This is what I made in the Simple Strata Shader file. Notice how strata area starts only 1/3 up the mesa's altitude:

https://planetside.co.uk/forums/index.php/topic,23627.msg239126.html#msg239126

The trick is that one SSS is tighter, therefore affecting higher altitude than the other SSS. I think I also used distribution shader combined with SSS... not sure how the node network looked, but I think I made it somehow.
Title: Re: Fuzzy Zones Colour Falloff Problem
Post by: WAS on October 01, 2018, 04:54:21 PM
That would rely on slopes. Not really possible when the zone you're working with is an outcrop pass the vertical base.

It also seems it could also be part of how TG handles geometry. Note this hard transition pyramid with SSS. It's faces are smooth, but when applied a surface layer, it creates subdivided like edges, new faces, basically. Naturally this wouldn't be as viable when the terrain has fine detail and isn't smooth. The cliff I'm working with all has smooth faces, with hard edges, which may just be translating badly with the compute terrain patch size, and planet displacement tolerance. But I'm not sure how to adjust to fix. A smaller patch size gives you better/more faces, but nothing smooth.

Note, the idea here was to create a offset like the remaining plaster on the great pyramids, and than fractalize and vdisp warp the fuzzy zone on Y to mimic the look IRL.
Title: Re: Fuzzy Zones Colour Falloff Problem
Post by: Dune on October 02, 2018, 01:53:45 AM
You are correct in saying that the fuzzy zone is clamped (at least, that was my conclusion too), and I've struggeld with this hard edge over the years too, so looked for a solution. I use a get altitude, with a smooth step, masking whatever you want masked. But you need a compute terrain.
You can also use a get altitude in texture, which will give a more erratic altitude (likely due to patch size), but that can be warped. Handy too.
I thought I had another way too, but I can't remember atm.
Title: Re: Fuzzy Zones Colour Falloff Problem
Post by: WAS on October 02, 2018, 02:00:38 AM
Wow, what nifty masking methods Ulco, thanks for sharing. This is definitely going to come in use.

I wonder if Matt might throw that on a future update for the surface layer, a simple Clamp Fuzzy Zone checkbox.
Title: Re: Fuzzy Zones Colour Falloff Problem
Post by: Matt on October 02, 2018, 11:34:02 PM
I've been looking into this and I see what's causing it now.

The fuzzy zone uses a smooth step, so that's not the problem. It also uses an exponential function, but instead of using exp() it uses a fast approximation which has some discontinuities in the first order derivative. You don't notice this problem when it's only used for colour, but when it's used to affect displacement you notice a few edges within the fuzzy zone. It's not just a problem at the very edge of the fuzzy zone; it occurs at multiple points in the fuzzy zone.

There was a similar problem in the Power Fractal and in 4.1 I added new options called "better colour continuity" and "better displacement continuity". They are a little slower to calculate but solve these issues. I'll need to add something similar to Surface Layer's constraints feature.
Title: Re: Fuzzy Zones Colour Falloff Problem
Post by: WAS on October 02, 2018, 11:35:53 PM
Quote from: Matt on October 02, 2018, 11:34:02 PM
I've been looking into this and I see what's causing it now.

The fuzzy zone uses a smooth step, so that's not the problem. It also uses an exponential function, but instead of using exp() it uses a fast approximation which has some discontinuities in the first order derivative. You don't notice this problem when it's only used for colour, but when it's used to affect displacement you notice a few edges within the fuzzy zone. It's not just a problem at the very edge of the fuzzy zone; it occurs at multiple points in the fuzzy zone.

There was a similar problem in the Power Fractal and in 4.1 I added new options called "better colour continuity" and "better displacement continuity". They are a little slower to calculate but solve these issues. I'll need to add something similar to Surface Layer's constraints feature.

Thanks for this post Matt, not only explains the issue here, but helps me better explain these additions to the PF shader. It also explains the anomalies on smooth displacement like SSS shapes. I notice in looking back at the pyramid, for example, the extra edges don't have anything to do with the actual fade of displacement. Which does fade with a perfect transition from what I see.
Title: Re: Fuzzy Zones Colour Falloff Problem
Post by: Matt on October 02, 2018, 11:38:45 PM
Whatever is happening with the Simple Shape Shader would be a different issue. I don't know if there's a bug there - I haven't looked into that yet.
Title: Re: Fuzzy Zones Colour Falloff Problem
Post by: Matt on October 02, 2018, 11:42:28 PM
If you have a pyramid with sharp edges like that, I would recommend setting the Surface Layer's displacement direction to Vertical, not Along Normal. The Compute Terrain and Compute Normal won't be able to create smooth normals from the pyramid, so it'll always look a bit off.
Title: Re: Fuzzy Zones Colour Falloff Problem
Post by: WAS on October 02, 2018, 11:45:32 PM
Quote from: Matt on October 02, 2018, 11:42:28 PM
If you have a pyramid with sharp edges like that, I would recommend setting the Surface Layer's displacement direction to Vertical, not Along Normal. The Compute Terrain and Compute Normal won't be able to create smooth normals from the pyramid, so it'll always look a bit off.

Yeah, I figured the angles are too hard. Which is OK, it's hard to texture a pyramid like this anyway from terrain so best to use an object or something.
Title: Re: Fuzzy Zones Colour Falloff Problem
Post by: Dune on October 03, 2018, 01:41:18 AM
Thanks for your explanation and attention to this, Matt.