我尝试在模型的深度部分显示阴影。我已经尝试将代码隐藏起来以显示阴影吗?
var light = SCNLight()
var lightNode = SCNNode()
light.castsShadow = true
light.automaticallyAdjustsShadowProjection = true
light.maximumShadowDistance = 40.0
light.orthographicScale = 1
light.type = .directional
light.shadowMapSize = CGSize(width: 2048, height: 2048)
light.shadowMode = .forward
light.shadowSampleCount = 128
light.shadowRadius = 3
light.shadowBias = 32
light.zNear=1;
light.zFar=1000;
light.shadowColor = UIColor.black.withAlphaComponent(1)
lightNode.light = light
//lightNodeb2.position = SCNVector3(x: -1, y: 10, z: 1)
lightNodeb2.rotation = SCNVector4Make(2, 0, 0, -Float.pi / 3)
self.sceneView.scene.rootNode.addChildNode(lightNode)
我已附上当前结果和预期结果。
当前结果
预期结果