# Gradient between two materials on the same mesh

I am trying to colorize a mesh for a 3d illustration, and I have been using Steven's technique so far.

The problem is that, as Stephen notes at the end of his answer, the contrast between the two materials is rather sharp.

Is there a way to blur or gradient the line between the two materials?

I was thinking about colorizing faces with a ramp between the two different colors, but that sounds complicated, and I'm using Cycles, so maybe there's another, simpler way to do this?

• Consider creating a third material that mixes the first two materials according to the U coordinate of a UV map. Commented Dec 11, 2015 at 15:44
• Scroll down to the snippet "SMOOTH BLEND" - it might help you out using OSL for your effect: blendersushi.blogspot.de/2013/08/osl-disk-grid.html Commented Apr 14, 2016 at 17:59

It's just a matter of values. Paul Brachmanns Answer is the right direction... with a little tweaking you'll get:

Use Generated Texture Coordinates followed by a Vector Mapping Node with Rotation: [35.2°, 45°, 90°]; Scale: [1, 1, 5.189] followed by a Converter Math node set to Modulo with a Value of 1, invert it with an Color Invert Node and use the result as the Mix Shaders factor...

You can add another Mapping node in front of the shown Mapping node to rotate the coordinates along one single axis (Z or X). To flip it around by 180°, add a Color Ramp node after the Modulo and flip the black and white sliders...

• Instead of the Math Modulo you can use a Color Ramp node to have a single transition without the repeating pattern. Tweak it a bit to get the positions of the color changes (as they are not linear in thirds) with constant interpolation and then switch to linear or easing once you found the proper positions. It will give you an even better result. Commented Dec 13, 2015 at 13:35
• Oh and give Paul an Upvote as well as he already pointed out the proper direction. ;-) Commented Dec 13, 2015 at 13:36
• Hi! Just went back to this project and I'm having a hard time directing the gradients (up > down, down > up, left > right, right > left...) could you help and edit your answer to indicate how to use the Mapping node to give the gradient a direction? Thanks! Commented Feb 11, 2016 at 19:40
• Did you try to manage rotating it on your own? I figured it out in no time... And your original question wasn't about different angles, so you might leave this question answered and ask a new one referring to this for further details ;-) Commented Feb 12, 2016 at 21:31

Simply using a gradient texture to blend two shaders using a mix shader node is not an option?

Setup goes like this:

The two emission shaders of course would be replaced by your material setups.

I think that is about as simple as it gets.

• Hi Paul! Thanks for the answer. Could you please elaborate on how to tweak the direction of the gradient using the Mapping node? I've been trying every possible number combination in every box to make a linear gradient go from left to right and it's so counter-intuitive... so hard! thanks Commented Feb 11, 2016 at 19:39
• One idea would be to use 'Object' mapping and then use a helper object's coordinates (select it from the 'Object' drop-down). This enables you to transform the gradient by moving, rotating and scaling the helper object (which to me appears to be a lot more intuitive). Commented Feb 13, 2016 at 9:56