I realise this might be a very simple and stupid question as I am just getting started with Blender.

I am trying to procedurally colour vertices to produce pseudo-colour maps.

I created this simple test with the default cube where I attempt to colour vertex 0 with red and the rest with black. I get the following result:

Vertex 0 in red and the red to black interpolation. All hidden vertices are black as expected.

I understand that the colours are stored in the faces through the face loops, but I can't seem to understand why I would get a different interpolation behaviour in some faces (one is a triangular shape and the other two are rectangular shapes) and also why this interpolation is not linear. Is there a simple explanation for this? Are there alternative interpolations? Am I doing something wrong or missing something?

Here is the snippet of code I am using to produce this result (on 2.93.0):

import bpy
import bmesh

objectName = "Cube"
nodeId = 0 
color = [1.0, 0.0, 0.0]

currentMesh = bpy.data.objects[objectName].data
currentBm = bmesh.new()

if not currentBm.loops.layers.color:
colorLayer = currentBm.loops.layers.color[0]

for face in currentBm.faces:
    for loop in face.loops:
        currentVert = loop.vert
        index = currentVert.index
        if index == nodeId:
            loop[colorLayer] = (color[0], color[1], color[2], 1.0)
            loop[colorLayer] = (0.0, 0.0, 0.0, 1.0)



  • 4
    $\begingroup$ A quad is really drawn as two tris, and how it looks depends on which of the two diagonals you split it along. This article is about a emulator, but it explains the issue pretty well. $\endgroup$
    – scurest
    Jun 18, 2021 at 16:00
  • $\begingroup$ Thanks @scurest. It makes sense. $\endgroup$
    – Rui Costa
    Jun 18, 2021 at 16:45
  • $\begingroup$ @scurest this would make a fine answer on its own $\endgroup$ Jun 18, 2021 at 21:03


You must log in to answer this question.

Browse other questions tagged .