# Cycles - is there a way to invert procedural texture colors for displacement?

Hello. I need small caverns filled with darker color on surface of my material. I generated musgrave procedural texture and use it as factor for mixing of two shaders: Basic color shader and darker shader for small caverns.

I also try to use it as displacement texture, beause i need smooth surface with rare small caverns filled with darker color. But displacement alorithm do quite the opposite.

How do i invert colors of my procedural texture for proper displacement?

With the “invert” node.

and for fac is 1 math node enough substract node (1 - fac)

@Lumpengnome. Thank you!

But i end up with the same result. I guess i’m doing something wrong.
UPD: I find my mistake. It seems that my noise texture is used for displacement as a whole, not as factor for two shaders mixing. Strange.

@nudelZ
Shouldn´t it be 0 - fac? or fac * (-1)?

no you dont want negative values - to invert a factor it is just 1-fac (invert of factor 1 is 0 -> 1 - 1 = 0 :))

@ alive-one add a multiply node before the displacement slot or use a bump node connected to the shader normals

@alive-one:
It appears that simply inverting witht he invert node doesn´t work as expected. Stuff like this can be tested best if you simply use an emission node and plug the setup into that.
If you simply invert the Musgrave texture with the invert node the texture is inverted but overbright. This is weird. The same happens if you plug the Musgrave into a mix node and set the mix nodes colors to black and white.

Thank you.
Interestingly plugging a Musgrave into a Math node and multiplying it by -1 or subracting it from 0 wields exactly the expected results.

interesting… the musgrave texture gives negative and > 1 values… i thought every cycles fac is 0-1… testing!

@nudelZ Thank you for suggestion. Multiply node does not help. I can not use Normals since i need true displacement.

@Lumpengnome. for me it works with smaller values of Scale in Musgrave settings, but dark caverns are too big.
[ATTACH=CONFIG]411790[/ATTACH]
[ATTACH=CONFIG]411789[/ATTACH]
Is there a way to make them smaller without increasing Musgrave scale?

The attachments don´t work.

Have you tried a different interpolation type in the Color Ramp? Ease or BSpline instead of linear perhaps.

BTW, have you noticed that the object outpout of the Texture Coordinate node appears to be buggy when using it for diplacement? It behaves strange.

you can replace the color ramp with a rgb curve and set the points as needed.

Thank you, i will try another mode of ColorRamp, and also RGBCurves node instead of ColorRamp. I noticed displacement strange behavior, but i thought that it is me doing something wrong.

At current moment, I reduced multiply value to 0.01 and get some result, but still not good enough i guess.
Nodes

Result

UPD: B-Spline interpolation mode works just fine. Combined with Math->Multiply node it provide all necessary control over displacement.
Here is result.

you could add some noise to modulate with bump map on the diffuse shader !
see on the right with smoother edges

happy cl