I am trying to load a UIView into SceneKit with a translucent background, but currently it just fades to white when I reduce the opacity. I have a very simple UIView layout in a .xib file that I want to load into SceneKit. While I can display the UIView in SCNMaterial, without any problems changing any text fields, images, etc. Inside the view. However, I cannot let it have transparency. If I change the alpha of the view, it just fades to white.
most of the code is below:
if let cardView = Bundle.main.loadNibNamed("OverlayCard", owner: self, options: nil)?.first as? OverlayCard {
cardView.backgroundColor = UIColor(displayP3Red: 1.0, green: 0.4, blue: 0.9, alpha: 0.2)
let newplane = SCNPlane()
let newMaterial = SCNMaterial()
cardView.alpha = 0.2
cardView.isOpaque = false
newMaterial.diffuse.contents = cardView
newMaterial.blendMode = .add
newplane.materials = [newMaterial]
let viewNode = SCNNode(geometry: newplane)
self.addChildNode(viewNode)
}
, , blendMode, backgroundColor 0,2 , , , , ontop of white . blendMode =.alpha, .
"self" SCNNode.
- , , ? SceneKit.
!