Surface Layer blending

Started by tempaccount, June 18, 2009, 03:29:52 AM

Previous topic - Next topic

tempaccount

Has anyone figured out the optimal way to blend two surface layers?

The crux of the problem is that I have two surface layers - lets call them surface layer A and B. I've created a fractal color mask that I use as a blending shader in layer A, and as an inverted blending shader in layer B, so they can blend smoothly. This is fine - but when it comes to displacement, I'm finding out that the blend doesn't look good and the "bleeding" of the displacement to the other layer can create some interesting-looking shapes, especially if the two layers have quite different displacement fractals.

What I'd like to do, is to either control the blending mask smoothness myself, by layer (for example to have a rough, high-contrast mask on layer B, and a smooth, slightly overlapping mask in layer A) - OR, restrict the displacement fractal in either layer to very mild values around the edges of the blend.

I've tried the following methods:

a) Trying to restrict the displacement. This didn't work out so great, since I'm not sure how to restrict the displacement to happen only on the + axis, or only above a certain height on the terrain. Also, the displacement should be smooth around the edges, and it's difficult to control the fractal like that.

b) Trying to figure out how to smooth the mask fractal. I guess I could do it an image-editing software, but I couldn't figure out how to do it with the functions. I tried scaling the mask fractal, but this proved fruitless, so I quickly abandoned this approach and moved on to...

c) Using a very smooth, low-contrast mask fractal, and then using two color adjust shaders to control how they blend to each other.

Method c) is giving me the best results at the moment, but it's difficult to get it "just right". I think method a) would give the optimal result, if I could get it to work.

Apologies for the text only-explanation, I don't have access to my scene at the moment, but I'll try to provide some pictures later on.


Hetzen

Try plugging the fractal you are using to blend with, directly into the blending input of the displacment fractal you've plugged into the surface layer. This should roll off the displacement only, rather than colour as well. Another alternative is using the merge shader to blend the two displacements, where you have some further options on for example, favour rises/depressions etc. The colour adjust shader is also extremely usefull as well for 'tightening' masks.

It's a bit difficult to help without seeing the problem. When you get a chance, post up some renders.

domdib

You might be able to learn something from Volker's excellent Powerfractal lesson here:
http://forums.planetside.co.uk/index.php?topic=2287.0

tempaccount

Quote from: Hetzen on June 18, 2009, 04:29:05 AM
Try plugging the fractal you are using to blend with, directly into the blending input of the displacment fractal you've plugged into the surface layer. This should roll off the displacement only, rather than colour as well. Another alternative is using the merge shader to blend the two displacements, where you have some further options on for example, favour rises/depressions etc. The colour adjust shader is also extremely usefull as well for 'tightening' masks.

It's a bit difficult to help without seeing the problem. When you get a chance, post up some renders.

Yes, I tried blending the displacement fractal with the coverage input - this works in theory, but I would still need two masks, if I want layer A to be the dominating displacement on the blending point. Maybe there is something there though, a sort of intermediary between a) and c).

Also, thank you domdib for that tutorial, it's excellent. Definitely going to my bookmarks. I'll have to read it wholly and see if it gives any insight on masking.

tempaccount

Well, I think I cracked it! Thinking in the sauna always does wonders :p

In short, the color adjust shader is my new best friend.

The basic solution to the problem is to have a coverage mask with contrast/roughness of 1, then have multiple color adjust shaders to control the falloff and blending roughness. I used three masks as a bare minimum - one control mask for each of the layers, and then a smoothed mask to control the displacement in layer B.

It really does work wonderfully, as I can control each of the blending "seam" independetly. Attached is a picture of a very simple node network, it does have an additional bleed mask I used as an intermediary layer between the two main layers, to enhance the blending effect even more. In a later iteration I used a few gain scalars to control the roughness as well.

This technique is actually pretty uniform, so maybe I should provide a test scene and more detailed pictures about it - not sure how the solution comes through with just text. But maybe it would be useful for someone else as well.

domdib

Please do show us a test render, and maybe even a TGD  or clip file if you're feeling generous.

Hetzen

I'd like to see what was troubling you, and see three colours on your seperate masks for the solution if possible.

tempaccount

Hey guys, sorry for the late reply, but I just started my holiday and haven't been around TG2 so much :)

Attached is a display of the node masks I used for layer A, and the clip file for the nodes if you want to take a closer look at the color adjustment shaders.

In the picture, mask 1 is the base distribution mask. Mask 2 is the blending mask I used for layer A's displacement. Mask 3 is the blending mask for layer A's distribution.

The other layers are basically inverses of these. In the clip file there's also an additional mask called "Bleed mask" I used for the distribution and displacement of the intermediary layer.

The problem this solves is the blending of displacement between two layers. My surface layers had very different displacements and trying to blend them regularly didn't look very good. With the color adjust shaders, I can have a direct control of how coarse the blending of the displacement is, and have an intermediary layer to soften the blend in between.