I'm trying to create a material for my SCNBox
with colored borders and transparent sides. Here's the code I use for creating material:
class CubeSide: UIView {
override func draw(_ rect: CGRect) {
let path = UIBezierPath(rect: rect)
UIColor.yellow.setStroke()
path.stroke()
}
}
let sideView = CubeSide(frame: rect)
sideView.backgroundColor = UIColor.clear
let material = SCNMaterial()
material.diffuse.contents = sideView
material.isDoubleSided = true
box.materials = [material]
It works fine but the center part is white instead of transparent. I've tried a lot of experiments with SCNMaterial's transparent property and transparentModes, but with my limited understanding of 3D rendering I couldn't get it working. What am I missing here?
Thank you!