VR下UI-3D遮罩的问题与优化-RectMask2D

mask组件
适用于UI-2D空间

  • 此时遮罩效果正常
    在这里插入图片描述
    滚动区域的Viewport 挂载mask组件
    在这里插入图片描述

但是改为3D-世界模式下渲染, 某些情况下会出现不遮罩的问题
这时
将mask组件改为RectMask2D组件 此组件在2D 3D模式下均生效

RectMask2D

官方文档:

A RectMask2D is a masking control similar to the Mask control.
The mask restricts the child elements to the rectangle of the parent
element. Unlike the standard Mask control it has some limitations,
but it also has a number of performance benefits.

Description

A common use of a RectMask2D is to show small sections of a larger
area. Using the RectMask2D to frame this area.

The limitations of RectMask2D control are:

It only works in 2D space It will not properly mask elements that are
not coplanar The advantages of RectMask2D are:

It does not use the stencil buffer No extra draw calls No material
changes Fast performance

译文
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_38531633/article/details/120450316