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
}
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
Or surface's reaction to light is normal:
node.geometry?.materials.first?.diffuse.intensity = 1.0