The designer has delivered three files:
- image.jpg
- something.mtl
- whatever.obj
I can successfully load the .obj file into my scene like such:
SCNView * sceneView = [SCNView new];
sceneView.frame = view.bounds;
[view addSubview:sceneView];
SCNScene * scene = [SCNScene sceneNamed:@"models.scnassets/whatever.obj"];
[sceneView setScene:scene];
What I'm struggling with is applying the .jpg and .mtl files to the .obj file. I've tried applying the image with the following code, but no love:
SCNMaterial * material = [SCNMaterial material];
material.diffuse.contents = [UIImage imageNamed:@"image.jpg"];
SCNNode * materialNode = [SCNNode node];
materialNode.geometry.firstMaterial = material;
[scene.rootNode addChildNode:materialNode];
I run into the same problem and only solution i found is in this link Click here. I could load the .mtl information was to create the object through scene
Make sure to have the .mtl and the jpg with the textures in your bundle.