Hide area of an SCNMaterial

懵懂的女人 提交于 2021-01-28 09:19:53

问题


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

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.

What kind of technique could I use for this ?

ArCore by Google does this perfectly.

Actual rendering:

Desired Rendering:

ARCore example: (click to see GIF)

Thank you!


回答1:


I would use a shader modifier to achieve that.

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));


来源:https://stackoverflow.com/questions/49681088/hide-area-of-an-scnmaterial

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!