title: In SceneKit, putting a text label onto SCNGeometry or SCNBox
body: <p>I'm trying to put a simple text label onto one (hopefully all types) of built in SCNGeometry shapes as they move across the screen. The closest I have come to success is adding a CALayer with CATextLayer to a SCNBox via .firstMaterial.diffuse.contents, as <a href="https://stackoverflow.com/questions/28387116/write-text-on-sphere-surface-scenekit">described in this thread</a>.</p>
  
  <p>BUT, the text is never readable. With a SCNBox of height 1.0: when the size of the layer.frame and textLayer.fontSize is 1.0, the text does not appear; as the frame and font size increase (not the box) the text appears blotchy, like in the image below; and when very large, the text appears as squiggly lines.</p>
  
  <p><a href="https://i.stack.imgur.com/KINXp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KINXp.png" alt="enter image description here"></a></p>
  
  <p>The following code is part of the method that spawns shapes:</p>
  
  <pre><code>    var geometry:SCNGeometry
  
      let layer = CALayer()
      layer.frame = CGRect(x: 0, y: 0, width: 4, height: 4)
      layer.backgroundColor = UIColor.white.cgColor
  
      var textLayer = CATextLayer()
      textLayer.frame = layer.bounds
      textLayer.fontSize = layer.bounds.size.height
      textLayer.string = "Matilda"
      textLayer.alignmentMode = kCAAlignmentLeft
      textLayer.foregroundColor = UIColor.black.cgColor
      textLayer.display()
      layer.addSublayer(textLayer)
  
      let geometry = SCNBox(width: 1.0,
                            height: 1.0, 
                            length: 3.0,
                            chamferRadius: 0.0)
  
      geometry.firstMaterial?.locksAmbientWithDiffuse = true
      geometry.firstMaterial?.diffuse.contents = layer
  
      let geometryNode = SCNNode(geometry: geometry)
      geometryNode.position = SCNVector3(x: 0.0, y: 0.0, z: 0.0)
  
      scnScene.rootNode.addChildNode(geometryNode)
  </code></pre>