Texture Painting Object with multiple materials

I have a scene composed of multiple objects. One of the objects is a lamp (that looks like a house). This lamp has differnet parts to it, but is a single Blender object. The parts are shown below with different colors: roof, windows, walls and floor.

I'm starting to texture paint only this object, but I'm having trouble painting its different parts independently from each other, as when I paint the windows, I can accidentaly go over the walls for example.

The only way I've found to paint each aprt independently is by separting the mesh by material, so now I have 4 individual objects. That's how I managed to show each aprt of the lamp with different colors in the image above.

But I'm wondering, was separating the lamp in different objects the only way? I would have lioked to keep it as a single object, and have some klind of mask that only allowed to hand paint a texture in the active material. Is this possible?


I found something that looked promising but didn't work for my case as this masks out a single material, whereas I have 4 materials in this object, so I needed to mask out 3 of them:

By the way, I'm using a single UV Map with a single texture:

  • CG GroundBirdie(groundbird) replied

    Im not sure if this works, but have you tried hiding the parts with you don't want to paint? Just select the faces you want to paint, then Ctrl+i (invert selection) and then H (hide). Try that, maybe it will help.

  • Daniel Wilches(danielwilches) replied

    Hello,

    I tried it but it didn't work. The moment I went to "Texture Painting" all of the parts of the lamp that were hidden became visible again, and I could paint over them.

    Thanks.

  • spikeyxxx replied

    You could paint directly in the Image Editor.

    In older versions of Blender you could turn off Project Paint and that would do exactly what you want, but that is no longer an option...

    You can probably join the different objects again after you've finished painting, that should preserve the different materials. (CTRL+J, with the diferent parts selected in Object Mode).

  • Daniel Wilches(danielwilches) replied

    Thanks, I didn't know I could paint in the image editor.

    At the end I ended up splitting and joining as you saaid, but I wondered if that was the recommended workflow.

    Thanks!

  • spikeyxxx replied

    There is another way!

    In Edit Mode select the parts you want to paint:

    Then in Texture Paint Mode enable Face Selection Masking:

    Never used it myself, that's why I had completely forgotten about this;)

  • Daniel Wilches(danielwilches) replied

    Yes! this one works pretty well. I hadn't noticed the Face Selection button.

    Thanks!

  • Shawn Blanch(blanchsb) replied

    Freak spikeyxxx I was coming here to share this "Paint Mask" technique because I have been using it all week. It is great and you can combine it with other cool options.

    danielwilches  If you find yourself needing to do a lot of this it is pretty handy to make vertex groups for easy "paint masking" selection over and over again when you don't want to risk painting over stuff you just worked hard on. Just tab between edit mode and paint mode in the 3D viewport and swap between vertex groups. That paint mask stays active and just swaps over to the next vertex group selected.


    There is also really cool way to texture paint stuff that is overlapping or even in-the-way on a single object. You can combine this "Paint Masking" with a Mask Modifier and assign the vertex group to the mod and click the "Invert" Button (dual arrow to the right of the assigned vertex group) and it inverts the mask to show everything else and hide/mask the assigned vertex group. The you can swap out vertex groups as you paint around the object and even use the spikeyxxx "Paint Masking to make an Uber Paint Mask workflow! Muahahaha!

    Here's an example of using the mask modifier so I could see what I was painting below the top shade of my tribal hut.

  • Daniel Wilches(danielwilches) replied

    I didn't know that one either. I'll try it forthe next time. Thanks!