Is there a way to randomize texture masks?

Hey all,

Just getting back into blender and trying to create a scene with 1000 gold coins that each have unique splotches of blood on them. They share the same base mesh and material (a simple golden-hued metal texture), instanced with a particle system and then made ‘real’ into individual meshes. Currently I’m adding the splotches of blood on five or so different coins using texture painting (each has it’s own material of the base metal mixed with a dark red diffuse where the factor is controlled by a texture mask), putting them into a collection, and referencing that collection in the particle system. It looks alright, but I’m curious if there’s a way to procedurally create the blood splotches on each coin. I’ve tried using the Object Info node’s random output, but I don’t think I’m doing it correctly, as the entire mesh turns the dark red color of my diffuse and the other copies stay completely gold. My sense is that there’s likely an easy work-around using a noise/musgrave/voronoi texture and tying that to the object info node’s randomness, but I’m curious if there’s any way to have that affect a texture mask. Hope this makes sense.

Thanks!

1 Like

Welcome to BA :slight_smile:
There are quite a few different ways to approach this. Let me show you a couple tricks that you should be able to adopt for your use case.

Method 1: Using 4D Voronoi, and using Random as the W. This works if the objects are duplicates or instances of each other:


You can change the spatter amount/distribution/shape/etc with other procedurals and math.

Method 2: Using Random to switch between textures:

This method will work well if you have different image textures you’re using as masks, you can just switch the Voronoi textures out for those images.
Note the LogicalAND nodes- these don’t come with Blender, they’re a group I made. That group has this:


So you can switch each LogicalAND with those three math nodes to get the same effect

Method 3: Combining both methods
You can see that Method two has the masks all in the same place. If you don’t like this, you can incorporate Method 1:


If you want more variation in the mapping, multiply the Random by X before using it as the W:

When X = 0, there will be no variation. As X increases, mapping variation increases

3 Likes

This is incredible, thank you so much! I’m not great at logic-ing my way through the math nodes on my own yet, but this makes complete sense. You’re the best :slight_smile:

1 Like

Sure thing :slight_smile: Here’s my Blend file, it has the LogicalAND nodes included already as well:
mix_masks.blend (1.4 MB)

@unitybeats One other thing I forgot to mention- if you’re using image textures, the W slot won’t work, obviously. In that case, you can do this:

And here’s that blend file:
mix_masks.blend (1.4 MB)

3 Likes

Noted, thanks :slight_smile:

1 Like

You could also break the splashes a bit up if you break your coins in bunches of coins and give them an overall splash that is not individual:


splats.blend (121.6 KB)

2 Likes

Hi!

Hopefully the BA search engine will find this EXCELLENT explanation

because I think this question has and will be asked a lot!

As usual, great job . Thank you!

3 Likes