I am playing with a low-poly/color-ramp style that is somewhat similar to pixel art in the sense that I want to paint individual quad faces sharply with different materials picked from a list (quite like painting square pixels with colors from a palette). The end result would be an object with 3 to 5 different shader materials assigned for certain faces.

The standard way to do that is to select the wanted faces, go to the materials list, select the desired material (different from the one applied to the object) and click assign. Then I have to deselect the painted faces, select the new faces to paint again, select desired material (again, since it resets to default material assigned to the whole mesh), press assign again and so on. This flow is way to cumbersome to feel like "painting" the faces in a quick way by single clicking or dragging over faces.

The flow I would try to achieve is: select a material on the list, then, in face edit mode, simply assign the currently selected material to any face I click on, with a single click. Paint multiple faces by click and dragging over them like in MS paint with pixels would be great but I think is too complex to pull off.

Do you guys think there is any way I could achieve that workflow with a script? If possible, where should I begin with this? Thanks in advance for any pointers.


Here is a solution similar to what you are asking, but not exactly. For this solution, you will be selecting the faces you wish to color, then assigning the color from a palette.

Create a 5x5 pixel image (or other tiny resolution image), and fill each pixel with a color you want to use.

Then open the shader editor.

Then, ⇧ Shift + A, S for search, then type image texture.

Connect the image texture Color output to the Base Color input of the Principled BSDF node.

Then, open the UV Editor, and in the dropdown select your palette image.

Scroll up to zoom in to your image.

Then, tab into edit mode on your object, hover over the UV editor, then press A, S, $0$.

Now, your faces should be tiny in the UV editor.

When you want to change the color of a face or multiple faces, you can select any faces in the 3D View, hover over the UV Editor, and press G to grab the faces and move them onto any of the colors in your palette.



The below two lines will set the active face in Edit Mode to use the active Material Slot currently in the Material Properties panel:

bmesh.from_edit_mesh(C.object.data).faces.active.material_index = C.object.active_material_index

You can throw this in a modal operator or bind it to a keymap to automatically assign material slots on clicking each face.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.