Mask Surface Layers

Started by JimHT, July 01, 2008, 10:07:12 AM

Previous topic - Next topic

JimHT

Maybe a dumb question, but is there a way to mask a surface layer? I am applying a displacement to a surface layer to simulate grass, but the these displacements affect subsequent layers (such as the fake stones shader). Some of the shaders have a "Blend by shader" function, but the surface layers do not, so I can't see a way to have the areas affected by the fake stones shader "masked out" of the grass shader. Am I back to the solution of having two separate planets, one inside the other?

Tangled-Universe

No luckily your're not :)

My approach for displacement-types like these is that for every surface layer I create I create a parent surface layer.
So, if I want a layer of fake stones I first make a surface layer and attach the fake stones to it as a child.
This way I can also control heighth and slope constrictions.
If you do this for each fake stone layer you will also avoid the problem of having fake stones on top of each-other.

The reason your displacement is also on your fake stone is because you probably set the displacement layer to be on the "final normal" instead of the "terrain normal".
If you add displacement to the final normal the displacement will be added to the whole surface, fake stones included because they also have normals of course. If you use terrain normal only displacement will be added to the terrain.
It is then important to keep in mind where to place the surface layer you're going to displace.
The higher in hierarchy, the more surfaces it will affect.

If you put it as a last shader and on the terrain normal you should have full control and no displacement of the fake stones.

Martin

Matt

#2
I think what Jim wants to do is prevent the other displacements from appearing where the fake stones are, am I right? For this you need to mask the other displacement using a mask representing the stones. The Surface Layer doesn't have a blend shader option like some of the others (although it will in future), but instead of this you can plug a mask into the fractal breakup input and set the surface layer's coverage to 0.5. It's not exactly the same as a proper blend/mask, but it's close enough for most purposes. For the actual mask, use a separate copy of your fake stones shader, with no inputs (unless you want to chain other fake stones shaders), and give it a white colour. That should give you a stones mask. You can invert this mask by using a function node after the mask (Function -> Inverse -> Complement Colour), or by simply enabling "invert breakup" on the surface layer.

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

JimHT

Quote from: Matt on July 01, 2008, 02:39:08 PM
I think what Jim wants to do is prevent the other displacements from appearing where the fake stones are, am I right? For this you need to mask the other displacement using a mask representing the stones. The Surface Layer doesn't have a blend shader option like some of the others (although it will in future), but instead of this you can plug a mask into the fractal breakup input and set the surface layer's coverage to 0.5

Thanks for your reply Matt. Yes, that is exactly what I want to do. Your solution kinda sorta works, but some displacement bleeds through anyway. The two planet approach works, and really doesn't seem to affect rendering time that much. I do think that a unified approach to the way all the shaders work is the way to go. Surface shaders lack specular settings, Default shader lacks masking and altitude and slope coverage controls, etc.

moodflow

Quote from: Matt on July 01, 2008, 02:39:08 PM
...The Surface Layer doesn't have a blend shader option like some of the others (although it will in future)...

Matt


Nice!  This will be really helpful.

Otherwise, one idea I can think of off the top is:  use a merge shader (which has a blend shader input) and shifting the mix to 1 so it only shows the second input (which can be masked by a blend shader).  Hopefully this makes more sense.  I haven't tested it, so I am not 100% sure it will work (yet).

http://www.moodflow.com
mood-inspiring images and music