Use a mask for vertex painting

Hi. I need to vertex paint a texture on a large and complex area. I have the areas already painted in a “Blueprint”. If I export a black and white image from Photoshop, is it possible to use this image as a mask so the black areas automatically will be vertex painted with the texture?

You don’t need OSL for that (although you can use OSL).
The shader editor let’s you use both textures and vertex paint layers without any constrains.

In OSL you can access textures using texture(string filename, float s, float t, ...params...) calls, and vertex layers with getattribute(string name, output type destination) calls. You can find more information in the OSL_LanguageSpec.pdf.

The process would be a simple color mix between the VertexPaint and some other color using the Mask as the factor. In OSL you would do the same using the linearstep function (or any of the other interpolation functions available).

Posted in the wrong category first, rather not use OSL :grimacing:
What nodes do I use for the color mix process? Sry, new at blender.

AddNode > Color > Mix

Factor will be the value from 0 to 1… your Mask texture.
If the factor is 0 (black) then Color1 will be the output. If the factor is 1 (white) then it will output the Color2. Anything in between 0 and 1, will mix Color1 with Color2.

You can access the VertexPaint using the Attribute Node (in AddNode > Input), and for Textures you need to use the ImageTexture Node (AddNode > Texture).

1 Like