How to change intensity or color of light for physicallyBased lightingModel?

288 views Asked by At

I'm using ARKit and trying to apply a texture to a face anchor, following an Apple example. However, the texture has an extremely bright light applied to it.

How can I reduce the intensity or color of the light created by physicallyBased lightingModel?

func createFaceNode(_ renderer: SCNSceneRenderer) {
    guard let sceneView = renderer as? ARSCNView,
          let geometry = ARSCNFaceGeometry(device: sceneView.device!),
          let material = geometry.firstMaterial
    else { return }

    material.diffuse.contents = #imageLiteral(resourceName: "texture")
    material.normal.contents = #imageLiteral(resourceName: "normal")    
    material.lightingModel = .physicallyBased    
    material.ambientOcclusion.contents = UIColor.darkGray
}
1

There are 1 answers

0
Andy Jazz On BEST ANSWER

To reduce an intensity of light's diffusion for physically based shader is as easy as this (but consider that intensity's range is normalised from 0 to 1):

node.geometry?.materials.first?.diffuse.intensity = 0.1

enter image description here

Or surface's reaction to light is normal:

node.geometry?.materials.first?.diffuse.intensity = 1.0

enter image description here