屏幕深度和法线纹理简介中对深度和法线纹理的来源、使用及推导过程进行了讲解,激光雷达特效中讲述了一种重构屏幕像素点世界坐标的方法,本文将沿用激光雷达特效中重构像素点世界坐标的方法,实现平面光罩特效。 假设平面光罩的高度为 shieldHeight,高亮线的宽度为 lineWidth,待检测像素点对应的世界坐标的高度值为 height,则该点的着色分以下三种情况: height < shieldHeight - lineWidth:渲染背景颜色,即 tex2D(_MainTex, i.uv); height > shieldHeight + lineWidth:渲染遮罩与背景的混合颜色; abs(height - shieldHeight) <= lineWidth:渲染高亮线的颜色。 本文完整资源见→Unity3D平面光罩特效。 PlaneShield.cs using UnityEngine; [RequireComponent(typeof(Camera))] // 需要相机组件 public class PlaneShield : MonoBehaviour...
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile