How to show TextureImage in .usdz model image frame in ARView?

I'm using below code to show image in .usdz model image frame

     var imageMaterial = UnlitMaterial()     imageMaterial.color = .init(tint: .white, texture: .init(texture))     modelEntity.model?.materials = [imageMaterial]           anchorEntity.addChild(modelEntity)

The issue is that image is showing on frame border as well but we need to show in image inside frame not on frame border

frame.usdz file

frame after adding image

Accepted Answer

It looks like modelEntity.model represents the mesh for the entire model, including the frame. You'd need a USDZ model with separate entities for frame and canvas, so that you can replace the material only for the canvas. You could also generate a new plane mesh in your app, add it as a child of the picture frame entity, and scale/offset it such that it fills up the canvas. Then you can assign the texture to that plane and leave the frame untouched.

Hi, I have a .usdz model. I want to get an image out of that model to calculate bounding box or vertices out of it

How to show TextureImage in .usdz model image frame in ARView?
 
 
Q