I've been trying to overlay a simple 2D interface over a 3D Scenekit node using SpriteKit. The goal is to have the user interact with a virtual object.
Something like the above.
To create the other "selectionBorder" node I tried using SpriteKit scene with a SKShapeNode.
let borderSKNode = SKShapeNode(rectOf: CGSize(width: 200, height: 200))
borderSKNode.name = "border"
borderSKNode.fillColor = colorLiteral(red: 0.807843148708344, green: 0.0274509806185961, blue: 0.333333343267441, alpha: 1.0)
borderSKNode.strokeColor = colorLiteral(red: 0.439215689897537, green: 0.0117647061124444, blue: 0.192156866192818, alpha: 1.0)
borderSKNode.lineWidth = 5
let skScene = SKScene(size: CGSize(width: 100 + selectionMargin, height: 100 + selectionMargin))
skScene.anchorPoint = CGPoint(x: 0.5, y: 0.5)
skScene.backgroundColor = .clear
print("adding border to the spritekit scene")
skScene.addChild(borderSKNode)
let labelGeometry = SCNPlane(width: width, height: height)
labelGeometry.firstMaterial!.diffuse.contents = skScene
let originLabelNode = SCNNode(geometry: labelGeometry)
originLabelNode.name = "border"
let constraint = SCNBillboardConstraint()
constraint.freeAxes = [.Y, .X]
originLabelNode.constraints = [constraint]
print("trying to addd border node")
self.addChildNode(originLabelNode)
Each time I try running this it fails with a cryptic message that says: "
validateDepthStencilState:3671: failed assertion `MTLDepthStencilDescriptor uses frontFaceStencil but MTLRenderPassDescriptor has a nil stencilAttachment texture'
"
Is this a bug in xCode 9 beta 6 or iOS 11 beta 7?