如何更改基于物理的光照模型的光强度或颜色?
How to change intensity or color of light for physicallyBased lightingModel?
我正在使用 ARKit 并尝试按照 Apple 示例将纹理应用于面部锚点。但是,纹理上应用了极其明亮的光线。
如何降低由 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
}
为基于物理的着色器减少光的漫射强度就这么简单(但考虑到强度的范围从 0 标准化到 1):
node.geometry?.materials.first?.diffuse.intensity = 0.1
或者表面对光的反应正常:
node.geometry?.materials.first?.diffuse.intensity = 1.0
我正在使用 ARKit 并尝试按照 Apple 示例将纹理应用于面部锚点。但是,纹理上应用了极其明亮的光线。
如何降低由 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
}
为基于物理的着色器减少光的漫射强度就这么简单(但考虑到强度的范围从 0 标准化到 1):
node.geometry?.materials.first?.diffuse.intensity = 0.1
或者表面对光的反应正常:
node.geometry?.materials.first?.diffuse.intensity = 1.0