gpt4 book ai didi

ios - SceneKit 和 ARKit – 柔和阴影或模糊阴影

转载 作者:行者123 更新时间:2023-12-01 19:37:10 25 4
gpt4 key购买 nike

我已经在 ARKit 中设置了阴影,但结果并不令人满意,我们需要与 safari 中的快速查看相同的阴影。请帮助我如何设置它。我们附上了两张图片。

代码

var light = SCNLight()
var lightNode = SCNNode()
light.castsShadow = true
light.automaticallyAdjustsShadowProjection = true
light.maximumShadowDistance = 20.0
light.orthographicScale = 1
light.type = .directional
light.shadowMapSize = CGSize(width: 2048, height: 2048)
light.shadowMode = .deferred
light.shadowSampleCount = 128
light.shadowRadius = 3
light.shadowBias = 32
light.zNear = 1
light.zFar = 1000
light.shadowColor = UIColor.black.withAlphaComponent(0.36)
lightNode.light = light2
lightNode.eulerAngles = SCNVector3(-Float.pi / 2, 0, 0)
self.sceneView.scene.rootNode.addChildNode(lightNode)

enter image description here

最佳答案

提供阴影偏移并增加阴影半径。使用这些值来获得所需的输出。

light.shadowOffset = CGSize(width: 1, height: 1) //controls spread
light.shadowOpacity = 0.5 // controls opacity
light.shadowRadius = 5.0 // controls blur level

关于ios - SceneKit 和 ARKit – 柔和阴影或模糊阴影,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59818131/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com