SceneKit LIDAR iOS:以不同的颜色/纹理在背景中显示相机视图的未扫描区域

发布于 2025-01-20 12:16:51 字数 1051 浏览 1 评论 0原文

我正在构建一个类似于Polycam,3D扫描仪应用程序,Scaniverse等的应用程序。我可视化扫描区域的网格并将其导出到不同的格式。我想向用户展示哪些区域被扫描,什么没有。为此,我需要区分它们。

我的想法是构建像Polycam这样的东西。 < 我尝试更改场景的背景内容属性的未频率区域的Polycam蓝色背景

,但它导致整个相机视图被颜色替换。

arSceneView.scene.background.contents = UIColor.black

我正在使用ARSCNVIEW并设置平面检测,如下所示:

private func setupPlaneDetection() {
        let configuration = ARWorldTrackingConfiguration()
        configuration.planeDetection = [.horizontal, .vertical]
        configuration.sceneReconstruction = .meshWithClassification
        configuration.frameSemantics = .smoothedSceneDepth
        
        arSceneView.session.run(configuration)
        arSceneView.session.delegate = self
       // arSceneView.scene.background.contents = UIColor.black
        arSceneView.delegate = self
        UIApplication.shared.isIdleTimerDisabled = true
        
        arSceneView.showsStatistics = true
    }

预先感谢您提供的任何帮助!

I'm building an app similar to Polycam, 3D Scanner App, Scaniverse, etc. I visualize a mesh for scanned regions and export it into different formats. I would like to show the user what regions are scanned, and what not. To do so, I need to differentiate between them.

My idea is to build something like Polycam does..
< Polycam blue background for unscanned regions >

I tried changing the background content property of the scene, but it causes the whole camera view to be replaced by the color.

arSceneView.scene.background.contents = UIColor.black

I'm using ARSCNView and setting up plane detection as follows:

private func setupPlaneDetection() {
        let configuration = ARWorldTrackingConfiguration()
        configuration.planeDetection = [.horizontal, .vertical]
        configuration.sceneReconstruction = .meshWithClassification
        configuration.frameSemantics = .smoothedSceneDepth
        
        arSceneView.session.run(configuration)
        arSceneView.session.delegate = self
       // arSceneView.scene.background.contents = UIColor.black
        arSceneView.delegate = self
        UIApplication.shared.isIdleTimerDisabled = true
        
        arSceneView.showsStatistics = true
    }

Thanks in advance for any help you can provide!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

旧人九事 2025-01-27 12:16:51

我之前已经通过在场景中添加一个球体来完成此操作,该球体具有两侧材质(稍微透明)并且半径足够大,以便相机和扫描的表面始终位于其内部。下面是如何执行此操作的示例:

let backgroundSphereNode = SCNNode() 
backgroundSphereNode.geometry = SCNSphere(radius: 500)

let material = SCNMaterial()
material.isDoubleSided = true
material?.diffuse.contents = UIColor(white: 0, alpha: 0.9)
backgroundSphereNode.geometry?.materials = [material]

请注意,我使用的是黑色 - 您显然可以将其更改为您需要的任何颜色,但保持 alpha 通道稍微透明。并调整球体的半径,使其适合您的场景。

I’ve done this before by adding a sphere to the scene with a two-sided material (slightly transparent) and with a radius large enough that the camera and the scanned surface will always be inside of it. Here’s an example of how to do that:

let backgroundSphereNode = SCNNode() 
backgroundSphereNode.geometry = SCNSphere(radius: 500)

let material = SCNMaterial()
material.isDoubleSided = true
material?.diffuse.contents = UIColor(white: 0, alpha: 0.9)
backgroundSphereNode.geometry?.materials = [material]

Note that I’m using a black color - you can obviously change this to whatever you need, but keep the alpha channel slightly transparent. And tweak the radius of the sphere so it works for your scene.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文