iOS12: Obj Model shows up without texture/color


#1

Hi Guys,

With the new iOS update, the obj files created by structure sdk arent previewing properly. The model is shown in white without any texture. Has anyone else faced the same issue or has any suggestions for fixing this issue?

iOS 12 https://image.ibb.co/i9sVGp/PNG_image.png
iOS 11 https://image.ibb.co/bBRCU9/IMG_0145.png

Thanks


#2

I haven’t seen this issue with our scanner sample app being built with Xcode 10 in iOS 12.

Is there a specific application you are using that is displaying this issue?


#3

Just now realised after seeing that screenshot, that yes that does seem to work fine for us as well. It is only when we try to preview it (after it has been saved to the device) using SceneKit that is where it shows up in white. The code for that is here: https://codeshare.io/ax6o4X.
That narrows down the problem a bit but looks like something was changed recently with SceneKit (or specifically what we have been using in the code)


#4

I’ve taken a look at your code, and while I don’t see any direct issues, maybe there have been changes to how lightning works when applied to the scene as it looks like you are loading the OBJ file directly into the root node instead of a child node. I am refering to the lines where you set the lightNode and ambientNode to whiteColor:

_lightNode.light.color = [UIColor whiteColor];
ambientLightNode.light.color = [UIColor whiteColor];

Maybe this is the issue? Could you try loading the savedMesh into a child node instead of the root node, as outlined here, though I may be on the wrong track:


#5

Thank you for your response Anthony. I already tried setting the obj as a child node and the result was still the same. That was the first thing I tried, as I felt that is definitely a better way to implement this.
After playing around with the exposure and other options related to it, the closest I could get to is this:


#6

It looks like a white shader is being placed over the color textures though I am unsure if this is true. Maybe try changing the opacity of the child node that the OBJ is loaded into? Does that help?

https://developer.apple.com/documentation/scenekit/scnnode/1408010-opacity


#7

If you are importing using ModelI/O you need to do this:

self.glkMeshes = [GLKMesh newMeshesFromAsset:self.mdlAsset sourceMeshes:&mdlMeshes error:&newMeshesError];
if (newMeshesError) {
NSLog(@“Error: %@”, newMeshesError.localizedDescription);
}
self.mdlMeshes = mdlMeshes;

Check the docs, I think it is for iOS 11 and up, but doesn’t matter if you target your build for something earlier, building on Xcode 10, you still need to call it if the devices is running 11 and up so the URL can resolve and pull in the texture. Kind of like the camera intrinsics in the scanner sample.

Double check if you need to wrap it in this : if (@available(iOS 11.0, *))