title: SceneKit selectively color a face by a certain index
body: <p>My objective: given some index <code>i</code> and some <code>UIColor</code> <code>c</code>, make the face at that index turn into that color.</p>
  
  <pre><code>let vertices = // all of my vertices in the format of SCNVector3
  
  let vertexSource = SCNGeometrySource(data: verticesData,
                                      semantic: .vertex,
                                      vectorCount: vertices.count,
                                      usesFloatComponents: true,
                                      componentsPerVector: 3,
                                      bytesPerComponent: MemoryLayout&lt;Float&gt;.size,
                                      dataOffset: 0,
                                      dataStride: MemoryLayout&lt;SCNVector3&gt;.size)
  
  
  var colors: [SCNVector3] = vertices.map { SCNVector3(1, 1, 1) } // Make it all white color at first
  colors[10] = SCNVector3(1, 0, 0)                                // Pick one at random and make it red
  let colorSource = SCNGeometrySource(data: NSData(bytes: colors, length: MemoryLayout&lt;SCNVector3&gt;.size * colors.count) as Data,
                                      semantic: .color,
                                      vectorCount: colors.count,
                                      usesFloatComponents: true,
                                      componentsPerVector: 3,
                                      bytesPerComponent: MemoryLayout&lt;Float&gt;.size,
                                      dataOffset: 0,
                                      dataStride: MemoryLayout&lt;SCNVector3&gt;.size)
  
  let elements = SCNGeometryElement(data: NSData(bytes: indices, length: MemoryLayout&lt;Int32&gt;.size * indices.count) as Data,
                                  primitiveType: .polygon,
                                  primitiveCount: indices.count / 4,
                                  bytesPerIndex: MemoryLayout&lt;Int32&gt;.size)
  
  let g = SCNGeometry(sources: [vertexSource, colorSource], elements: [element])
  </code></pre>
  
  <p>My 3D object renders correctly. It is all white color, as expected. The red face, however, doesn't appear. I see a hint of red, but it looks like SceneKit is trying to color around the vertices rather than the face those vertices form. How can I force it to just color the face/polygon created by those vertices?</p>