How to load 3D model to UIView with better quality in iOS Swift?

45 views Asked by At

I'm trying to load 3D (using usdz file) content to SCNView and SCNView is set to UIView. 3D content is loaded to successfully without any issues and all interaction and gestures are worked as expectedly.

3D content is generated by RoomPlan API and content has mix of white and grey colors. Once it is loaded and rotated to some angle, 3D content is partially visible and some part are not visible properly. UIView is not used any background color.

Anyone has idea about how to show 3D model in UIView with better quality?.

Please, refer my code part, it is used to bind the SCNView to UIView.

Creating SCNView:

var threeDScnView: SCNView = {
    let view = SCNView(frame: .zero)
    view.translatesAutoresizingMaskIntoConstraints = false
    view.isHidden = true
    return view
}()

Set Data to SCNView:

threeDScnView.autoenablesDefaultLighting = true
    do {
        let scnScene = try SCNScene(url: usdzFileUrl)
        threeDScnView.scene = scnScene
        threeDScnView.allowsCameraControl = true
    } catch let error as NSError {
        print(error)
    }

Please, refer attached image for how it looks.

First Image - it is showing all parts of 3D model.

enter image description here

Second image is taken, once it is rotated and some parts are not clear.

enter image description here

If someone has idea , please, share with me and i really appreciate your ideas and feedback.

0

There are 0 answers