code: def render_colors(vertices, triangles, colors, h, w, c=3):
      """render mesh with colors
      Args:
          vertices: [nver, 3]
          triangles: [ntri, 3]
          colors: [nver, 3]
          h: height
          w: width
      Returns:
          image: [h, w, c].
      """
      assert vertices.shape[0] == colors.shape[0]
  
      # initial
      image = np.zeros((h, w, c))
      depth_buffer = np.zeros([h, w]) - 999999.0
  
      for i in range(triangles.shape[0]):
          tri = triangles[i, :]  # 3 vertex indices
  
          # the inner bounding box
          umin = max(int(np.ceil(np.min(vertices[tri, 0]))), 0)
          umax = min(int(np.floor(np.max(vertices[tri, 0]))), w - 1)
  
          vmin = max(int(np.ceil(np.min(vertices[tri, 1]))), 0)
          vmax = min(int(np.floor(np.max(vertices[tri, 1]))), h - 1)
  
          if umax < umin or vmax < vmin:
              continue
  
          for u in range(umin, umax + 1):
              for v in range(vmin, vmax + 1):
                  if not isPointInTri([u, v], vertices[tri, :2]):
                      continue
                  w0, w1, w2 = get_point_weight(
                      [u, v], vertices[tri, :2]
                  )
                  point_depth = (
                      w0 * vertices[tri[0], 2]
                      + w1 * vertices[tri[1], 2]
                      + w2 * vertices[tri[2], 2]
                  )
  
                  if point_depth > depth_buffer[v, u]:
                      depth_buffer[v, u] = point_depth
                      image[v, u, :] = (
                          w0 * colors[tri[0], :]
                          + w1 * colors[tri[1], :]
                          + w2 * colors[tri[2], :]
                      )
      return image
  
file_path: insightface/python-package/insightface/thirdparty/face3d/mesh_numpy/render.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  from time import time
label_desc: Use image node_id 5 for calling a global function with example usage: render_colors(vertices, triangles, colors, h, w, c) and returns: image