We are trying to create a SCNNode with a SCNMaterial which has an image (.png extension) in ARSCNView with the ARKit framework.
The problem is that image rendering has a problem that image is shown as black and red colors only, it doesn't render image correctly.
The problem exists only in iOS 11.2 version. There is no problem in iOS 11.0, 11.1 and 11.3 beta versions.
Our code is below;
let materialMain_Front_Back = SCNMaterial()
let fromBackImage = createImage(color:mainNode_Color)
materialMain_Front_Back.diffuse.contents = UIImage(named: "nodeBackground")
let materialMain_Other = SCNMaterial()
materialMain_Other.diffuse.contents = createImage(color:mainNode_Color)
let boxGeometryMain = SCNBox(width: CGFloat(mainNode_Width), height: CGFloat(mainNode_Height), length: 0, chamferRadius: 0.0)
boxGeometryMain.firstMaterial?.diffuse.contents = UIColor.white
boxGeometryMain.materials = [materialMain_Front_Back, materialMain_Other, materialMain_Front_Back, materialMain_Other, materialMain_Other, materialMain_Other]
let nodeMain = SCNNode(geometry: boxGeometryMain)
nodeMain.position = SCNVector3(x: 0, y: 0, z: -1)
//... other codes
annotationNode.addChildNode(nodeMain)
Does anyone have an idea?
I solved it just using .jpg images. Yes just using jpg image instead of png. I also reported this to Apple as a bug. They answered as that is a problem in 11.2 only with grayscale images with transparency. They fixed it in 11.3.