I am loading a 3D model using SCNScene
in SwiftUI, my object looks better in lambert
or phong
shading. I am trying to change the lighting model like this:
var scene: SCNScene? {
let scene = SCNScene(named: "model.usdz")
scene?.rootNode.geometry?.firstMaterial?.lightingModel = .lambert
scene?.rootNode.scale = SCNVector3(scale, scale, scale)
return scene
}
and then load the scene in body:
var body: some View {
SceneView(
scene: scene,
pointOfView: cameraNode,
options: [.allowsCameraControl, .autoenablesDefaultLighting]
)
}
but changing the lighting model doesn't affect the model, or even tried manually in the scene kit editor but still no luck, any solution would be great.