unity3d 实现遮罩效果
发布时间:2020-12-15 18:40:26 所属栏目:百科 来源:网络整理
导读:Masking is a fundamental technique that has hundreds of usages.? Just take a look through some of the Flash work in my portfolio and you’ll see where masking really shines with respect to animating the introducing of visual elements.? Com
Masking is a fundamental technique that has hundreds of usages.? Just take a look through some of the Flash work in my portfolio and you’ll see where masking really shines with respect to animating the introducing of visual elements.? Coming from a Flash background,I was dumbfounded when I realized Unity didn’t have any technique for masking geometry and images.? Luckily I finally found the answer in the “Depth Mask” shader.Though the “Depth Mask” shader is Unity’s answer to masking its not without it quirks if you are looking for a 1:1 comparison with the traditional 2D mask.? The way this shader works is whatever geometry is utilizing it will essentially hide whatever is behind it.? This means EVERYTHING behind it. The best way to constrain the effects of this is by layering cameras that specifically render masked “scenarios”.
The actual code for the a depth mask shader is short and sweet:
工程下载:http://pixelplacement.com/wp-content/uploads/2011/02/Masking.zip ? 转自移动终端开发网www.yeehot.com (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |