1

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
}
Andy Jazz
  • 49,178
  • 17
  • 136
  • 220
Alex Stone
  • 46,408
  • 55
  • 231
  • 407

1 Answers1

2

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

Andy Jazz
  • 49,178
  • 17
  • 136
  • 220