code: def render_colors_ras(vertices, triangles, colors, h, w, c=3):
      """render mesh with colors(rasterize triangle first)
      Args:
          vertices: [nver, 3]
          triangles: [ntri, 3]
          colors: [nver, 3]
          h: height
          w: width
          c: channel
      Returns:
          image: [h, w, c]. rendering.
      """
      assert vertices.shape[0] == colors.shape[0]
  
      (
          depth_buffer,
          triangle_buffer,
          barycentric_weight,
      ) = rasterize_triangles(vertices, triangles, h, w)
  
      triangle_buffer_flat = np.reshape(triangle_buffer, [-1])  # [h*w]
      barycentric_weight_flat = np.reshape(
          barycentric_weight, [-1, c]
      )  # [h*w, c]
      weight = barycentric_weight_flat[
          :, :, np.newaxis
      ]  # [h*w, 3(ver in tri), 1]
  
      colors_flat = colors[
          triangles[triangle_buffer_flat, :], :
      ]  # [h*w(tri id in pixel), 3(ver in tri), c(color in ver)]
      colors_flat = weight * colors_flat  # [h*w, 3, 3]
      colors_flat = np.sum(colors_flat, 1)  # [h*w, 3]. add tri.
  
      image = np.reshape(colors_flat, [h, w, c])
      # mask = (triangle_buffer[:,:] > -1).astype(np.float32)
      # image = image*mask[:,:,np.newaxis]
      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 4 for calling a global function with example usage: render_colors_ras(vertices, triangles, colors, h, w, c) and returns: image