RealityKit – 如何为自然光创建阴影捕捉器? [英] RealityKit – How to create shadow catcher for natural lighting?

查看:21
本文介绍了RealityKit – 如何为自然光创建阴影捕捉器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一架飞机:

func getShadowPlane(_ width: Float, _ height: Float) -> ModelEntity {

    let sphereResource = MeshResource.generatePlane(width: width, 
                                                    depth: height)
    let myMaterial = ShadowMataerial . ????
    return ModelEntity(mesh: sphereResource, materials: [myMaterial])
}

&将它添加到我的锚点的特定位置.我想从照明"中获取阴影数据我从我的相机中得知 RealityKit 能够捕捉/生成.

& add it to my anchor at specific position. I'd like to get shadow data from the "lighting" I get from my camera that RealityKit is able to capture/generate.

我不想使用

AnchorEntity(plane: AnchoringComponent.Target.Alignment.horizontal)

知道如何实现吗?

我找不到 shadowCatcher 材料.

I can not find shadowCatcher material.

推荐答案

恐怕在 RealityKit 2.0 中没有只捕捉阴影的公式,就像 SceneKit 一样:

I'm afraid there's NO formula for catching only shadows in RealityKit 2.0, like SceneKit's:

SCNMaterial().lightingModel = .shadowOnly

但是,您可以使用假阴影 基于 .png 图像,或者您可以实现 Metal单独捉一个影子.

However, you can use Fake Shadows based on .png image or you can implement Metal to separately catch a shadow.

这篇关于RealityKit – 如何为自然光创建阴影捕捉器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆