How do you stencil in cycles

How do you use a texture to mask one texture and replace that masked part with another texture? In Blender render you use stencils between the 2 textures you want to mix but I can’t figure out how its done in Cycles. For instance I was wondering how you would add patches of dirt to a grass texture?

Simplest option is to use the mask texture as the Fac input of a Mix Shader

Here you go - plug your stencil image texture into the fac of the mix shader node, and it will determine where your textures show up. I used a stark black and white, but you can experiment with painting grey scale values for effect


Thanks that is very helpful and simple. What is the texture node mode used for? I never see anyone use it.

the actual texture node editor is broken, so you won’t see that fixed until probably after 2.7 if we are lucky. there is a lot to fix under the hood to make that work.

Texture nodes are for BI based texture nodes… doesnt work with cycles.