code: def render_texture(vertices, colors, triangles, h, w, c=3):
      """render mesh by z buffer
      Args:
          vertices: 3 x nver
          colors: 3 x nver
          triangles: 3 x ntri
          h: height
          w: width
      """
      # initial
      image = np.zeros((h, w, c))
  
      depth_buffer = np.zeros([h, w]) - 999999.0
      # triangle depth: approximate the depth to the average value of z in each vertex(v0, v1, v2), since the vertices are closed to each other
      tri_depth = (
          vertices[2, triangles[0, :]]
          + vertices[2, triangles[1, :]]
          + vertices[2, triangles[2, :]]
      ) / 3.0
      tri_tex = (
          colors[:, triangles[0, :]]
          + colors[:, triangles[1, :]]
          + colors[:, triangles[2, :]]
      ) / 3.0
  
      for i in range(triangles.shape[1]):
          tri = triangles[:, i]  # 3 vertex indices
  
          # the inner bounding box
          umin = max(int(np.ceil(np.min(vertices[0, tri]))), 0)
          umax = min(int(np.floor(np.max(vertices[0, tri]))), w - 1)
  
          vmin = max(int(np.ceil(np.min(vertices[1, tri]))), 0)
          vmax = min(int(np.floor(np.max(vertices[1, tri]))), h - 1)
  
          if umax < umin or vmax < vmin:
              continue
  
          for u in range(umin, umax + 1):
              for v in range(vmin, vmax + 1):
                  if tri_depth[i] > depth_buffer[v, u] and isPointInTri(
                      [u, v], vertices[:2, tri]
                  ):
                      depth_buffer[v, u] = tri_depth[i]
                      image[v, u, :] = tri_tex[:, i]
      return image
  
imports: import numpy
label_desc: Use image node_id 3 for calling a global function with example usage: render_texture(vertices, colors, triangles, h, w, c) and returns: image