Loading USDZ at runtime from web url results in black texture

Context

https://developer.apple.com/forums/thread/751036

I found some sample code that does the process I described in my other post for ModelEntity here: https://www.youtube.com/watch?v=TqZ72kVle8A&ab_channel=ZackZack

At runtime I'm loading:

  1. Immersive scene in a RealityView from Reality Compose Pro with the robot model baked into the file (not remote - asset in project)
  2. A Model3D view that pulls in the robot model from the web url
  3. A RemoteObjectView (RealityView) which downloads the model to temp, creates a ModelEntity, and adds it to the content of the RealityView

Method 1 above is fine, but Methods 2 + 3 load the model with a pure black texture for some reason.

Ideal state is Methods 2 + 3 look like the Method 1 result (see screenshot).

Am I doing something wrong? e.g. I shouldn't use multiple Reality Views at once?

Screenshot

Code

struct ImmersiveView: View {
    var body: some View {
        RealityView { content in
            // Add the initial RealityKit content
            if let immersiveContentEntity = try? await Entity(named: "Immersive", in: realityKitContentBundle) {
                content.add(immersiveContentEntity)

                // Add an ImageBasedLight for the immersive content
                guard let resource = try? await EnvironmentResource(named: "ImageBasedLight") else { return }
                let iblComponent = ImageBasedLightComponent(source: .single(resource), intensityExponent: 0.25)
                immersiveContentEntity.components.set(iblComponent)
                immersiveContentEntity.components.set(ImageBasedLightReceiverComponent(imageBasedLight: immersiveContentEntity))

                // Put skybox here.  See example in World project available at
                // https://developer.apple.com/
            }
        }
        
        Model3D(url: URL(string: "https://developer.apple.com/augmented-reality/quick-look/models/vintagerobot2k/robot_walk_idle.usdz")!)
        
        SkyboxView()
        
//        RemoteObjectView(remoteURL: "https://developer.apple.com/augmented-reality/quick-look/models/retrotv/tv_retro.usdz")
        RemoteObjectView(remoteURL: "https://developer.apple.com/augmented-reality/quick-look/models/vintagerobot2k/robot_walk_idle.usdz")
    }
}
Answered by DTS Engineer in 786811022

Hello @davecancode,

My guess is that your downloaded model does have valid textures, but that your RemoteObjectView doesn't set up the ImageBasedLightComponent, so there is nothing lighting the remote model, and so it appears completely black.

Accepted Answer

Hello @davecancode,

My guess is that your downloaded model does have valid textures, but that your RemoteObjectView doesn't set up the ImageBasedLightComponent, so there is nothing lighting the remote model, and so it appears completely black.

Loading USDZ at runtime from web url results in black texture
 
 
Q