How do I make a grunge texture appear only on specific parts of a model?

I'm trying to make a cog with scratches on it. However, when I apply the texture, the scratches appear all over the model.
I'd like to only have it appear in a few areas through a procedural texture, such as a noise texture, where the black parts of the noise will show the grunge texture and the white will not (or vice versa). I am using Cycles Render.

EDIT

I forgot to mention that this is for a bump map, if that makes any difference.

• Please add images that shows what you have so far, images of your current node setup. If you have a reference of what you are after it would help others as well. Also consider uploadong your blend file, you can use blend-exchange.giantcowfilms.com
– user1853
Commented Dec 19, 2016 at 7:22

To control where a bump map affects a object, all you have to do is is multiply the mask by the bump map. Let me explain.

See a bump map is 1-0, white to black. White is up, black is down and 0.5 is no change.
So when you have a bump map, like this scratches image its values are affecting the perceived height of the surface, if you make more of that image 0.5 (gray) then there will be no change in the bumps.

This is where the mask comes in to play, it too is just a 0-1, black and white image (or procedural texture) in this case. So multiplying the two makes all the places where the mask is black, black; and where the mask is white the bump map stays unchanged.
This goes back to basic math 0*x = 0 and 1*x = x.
Last thing needed is to add 0.5 to everything, so the black (0) is neutral in the bump map.

Here are the cycles nodes. The two nodes outlined in red are the two math nodes used to multiply the mask and the bump map and then add 0.5 to neutralize it. The image texture is just the bump map, and the Voronoi Texture and color ramp define the black and white parts which act as a mask.

This is pretty easy to do in cycles. The procedural texture acts as a mask, that mask controls the Mix Factor between your base material, and the scratches.

In this picture I have my scratches image in a diffuse node plugged in the top Shader socket of the Mix node, and my base color in the bottom socket.
The procedural texture is the mix factor, after running through the ColorRamp node it get plugged in to the Fac socket of the mix node.

Instead of the normal value slider on the mix node here I am using the Voronoi Texture to define the black and white parts which act as a mask.

• Sorry. I forgot to mention that what I'm using for the grunge is a bump map. Would this work similarly with a bump?
– Tobi
Commented Dec 19, 2016 at 4:49
• Do note that this can apply to more then just bump maps, this works any time you need to mask a black and white texture. Commented Dec 22, 2016 at 1:44
• This will also work in the compositor, and BI nodes. Commented Dec 22, 2016 at 1:46