Questions tagged [apple-model-io]
19 questions
9
votes
1 answer
Save ARFaceGeometry to OBJ file
In an iOS ARKit app, I've been trying to save the ARFaceGeometry data to an OBJ file. I followed the explanation here: How to make a 3D model from AVDepthData?. However, the OBJ isn't created correctly. Here's what I have:
func renderer(_…

Daniel McLean
- 451
- 7
- 10
3
votes
0 answers
Adding UV Map to Model IO MDLMesh
I'm trying to generate UV map for a mesh using Model/IO. The code runs on the simulator and generates a UV map for the input mesh but when I run it on a device it crashes on
mdlMesh.addUnwrappedTextureCoordinates(forAttributeNamed:…

Reza Hemadi
- 46
- 3
3
votes
1 answer
Can I load both obj and materials as an MDLAsset?
I have a directory containing an obj, mtl, and the textures. If I do
let asset = MDLAsset(url: url) then it loads the mesh, but no textures. Now, if I go rename the model.mtl file to model.abc and run the same code, I get the following on the…

blueether
- 3,666
- 4
- 26
- 32
3
votes
0 answers
printing vertex positions of an MDLMesh
I'm trying to print the vertex positions of an MDLMesh. I have the following code in a playground:
import Cocoa
import ModelIO
let boxURL = Bundle.main.url(forResource: "box", withExtension: "obj")!
let asset = MDLAsset(url: boxURL)
let mesh =…

Taylor
- 5,871
- 2
- 30
- 64
2
votes
0 answers
ModelIO: change material of MDLAsset / MDLMesh / MDLSubmesh
I load models inside my iPad app as a MDLAsset to view them using RealityKit. As I need to change the texture of the models I currently simply apply a SimpleMaterial on the ModelEntity in RealityKit. This works fine, but as there is no elegant way…

1024kilobyte
- 413
- 4
- 10
1
vote
0 answers
Why are MDLMesh initializers making degenerate triangles?
This sphere, generated with an MDLMesh initializer, have degenerate triangles at the top and bottom of its geometry (see images below). Why is this happening?
image1
image2
image3
Generating a cylinder with an MDLMesh initializer produces degenerate…

pamplemousse
- 13
- 3
1
vote
0 answers
How to get USD / USDZ model metersPerUnit value in iOS?
I've been trying for a few years to find out how to get the USD / USDZ metersPerUnit value in an iOS / macCatalyst app but so far have not discovered any solution. The issue has become more important as our users utilize more of their own USDZ…

LenK
- 2,944
- 2
- 20
- 26
1
vote
1 answer
Metal - How to adapt the vertexDescriptor created by Metal I/O to my MTLRenderPipelineState?
I am developing a Metal macOS app that displays my own 3D models and some other 3D model.obj I import through the Model I/O. I am getting some conflict between my own vertexDescriptor and the vertexDescriptor embedded into the model.obj.
I have…

Leonardo
- 751
- 8
- 15
1
vote
0 answers
Get SCNGeometry from Model I/O
I am trying to import a Mesh into a SCNGeometry. I do want to manipulate the vertices individually from the CPU. Therefore, I want to do it according to the following post: https://developer.apple.com/forums/thread/91618 .
So far I have imported it…

MarcoPepunkt
- 11
- 2
1
vote
0 answers
Visualization of voxels/octrees in SceneKit
I want to render Voxel/Octree objects (cubes with different sizes basically) in iOS; so far, I have been looking at SceneKit to perform the visualization. The goal is to render 10 to 15k voxels in a scene like rendering an Octomap for robotics…

jochemverboom
- 21
- 1
1
vote
0 answers
importing obj (or dae or lidar scan ) into swift SceneAssests without using xcode gui interface from files during app runtime
System. (Mac OS:Catalina 10.15.7 ,xcode version: 12.3 , swift language version 5)
Has anyone accessed a .dae or .obj in the project file ( in files ) on an ipad/iphone and been able to create a sceneAsset from this file? I do not want to use the…

Spencer Oliver
- 11
- 1
1
vote
1 answer
If I allocate MDLAsset using metal, then inititialize an SCNNode using that asset, are the SCNGeometrySource objects copied to non-Metal buffers?
If I allocate an MDLAsset and SCNNode like so
let device: MTLDevice = (sceneView?.device)!
let allocator = MTKMeshBufferAllocator(device: device)
let url = Bundle.main.url(forResource: name, withExtension: "obj")
let asset = MDLAsset(url: url! as…

blueether
- 3,666
- 4
- 26
- 32
0
votes
0 answers
Write animated MDLMesh to collada in swift with Model I/O
I want to animate an MDLObject and then export it to a .dae file. Currently, only the objects mesh is exported, but without animation. I could not find any articles online how to animate objects correctly, so I came here to ask for help.
Here is the…

Herbert
- 21
- 5
0
votes
1 answer
Crash on MDLLightProbe
I was trying to bake an MDLLightProbe but the app is crashing. I have stripped down the code to bare minimum but still getting the same crash. Attaching the code and the stack.
SCNNode *ambientLight = [SCNNode node];
ambientLight.light =…

midi
- 460
- 3
- 17
0
votes
1 answer
Extract faces information from SCNGeometry in SceneKit
I want to extract faces information from a SCNNode geometry just like we can extract vertices information from geometry sources. Any idea on how that can be achieved?

Mahnoor Khan
- 25
- 4