【问题标题】:Lack of blooming effect in iOS 13.0iOS 13.0 缺少绽放效果
【发布时间】:2020-03-11 10:46:07
【问题描述】:

我想通过相机设置在arkit中制作绽放效果:

self.sceneView.pointOfView.camera.bloomIntensity = 2.0;
self.sceneView.pointOfView.camera.bloomBlurRadius = 30;
self.sceneView.pointOfView.camera.bloomThreshold = 0.6;

它在 iOS 13.0 下运行良好,如下所示:

但是当相同的代码在 iOS 13 或更高版本的系统上运行时,它的工作方式如下:

相机的光晕设置不起作用。

【问题讨论】:

    标签: swift scenekit augmented-reality arkit ios13


    【解决方案1】:

    根据官方文档,要在 iOS 13 中使用绽放效果,首先需要启用相机的 wantsHDR 实例属性(将后处理效果应用于场景) .

    所以您的代码可能如下所示:

    @IBOutlet var sceneView: ARSCNView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
    
        let scene = SCNScene(named: "art.scnassets/myScene.scn")!
    
        sceneView.pointOfView!.camera!.wantsHDR = true                 // ENABLED
        sceneView.pointOfView!.camera!.bloomIterationSpread = 10
        sceneView.pointOfView!.camera!.bloomIterationCount = 3
        sceneView.pointOfView!.camera!.bloomIntensity = 20
        sceneView.pointOfView!.camera!.bloomBlurRadius = 3
        sceneView.pointOfView!.camera!.bloomThreshold = 0.5
    
        sceneView.scene = scene
    }
    

    【讨论】:

    • 谢谢你,先生,但我已经设置了“wantsHDR = true”并且没有效果......
    【解决方案2】:

    我能够使用这种方法将bloom添加到节点。

    func addBloom() -> [CIFilter]? {
      let bloomFilter = CIFilter(name:"CIBloom")!
      bloomFilter.setValue(10.0, forKey: "inputIntensity")
      bloomFilter.setValue(30.0, forKey: "inputRadius")
      return [bloomFilter]
    }
    

    然后你可以像这样将它添加到你的节点:

    myNode.filters = addBloom()
    

    【讨论】:

      【解决方案3】:

      答案很晚,但我认为您必须在 SceneView 上禁用 rendersCameraGrain,因为不幸的是,启用此功能会与应用的 SCNTechniques 混淆(其中 afaik 用于在引擎盖下应用 Bloom 等效果,饱和度等……)

      【讨论】:

        猜你喜欢
        • 2014-04-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-02-16
        • 2018-02-15
        • 1970-01-01
        • 2019-04-17
        相关资源
        最近更新 更多