隐藏SCN材料的区域 [英] Hide area of an SCNMaterial

查看:114
本文介绍了隐藏SCN材料的区域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用SceneKit和ARKit 1.5,一旦映射了曲面,便向其应用了材质.

I'm using SceneKit and ARKit 1.5, once a surface has been mapped I apply a material to it.

我只想显示具有alpha效果的特定半径范围内的相机下方的内容.我想保持材质的静态性,即当相机移动时它不会移动,只有半径形状会移动.

I would like to only show what's under the camera in a certain radius with an alpha effect. I want to keep the material static meaning that it does not move when the camera moves, only the radius shape will move.

我可以使用哪种技术?

Google的ArCore完美地做到了这一点.

ArCore by Google does this perfectly.

实际渲染:

所需的渲染:

ARCore示例:(单击以查看GIF)

ARCore example: (click to see GIF)

谢谢!

推荐答案

我将使用着色器修饰符来实现.

I would use a shader modifier to achieve that.

使用 .surface 您可以将 _surface.transparent 设置为一个值,该值取决于阴影点与视点之间的距离:

Using the .surface entry point you could set _surface.transparent to a value that depends on the distance between the shaded point and the point of view:

_surface.transparent = attenuation(length(_surface.position));

这篇关于隐藏SCN材料的区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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