//玻璃效果 10.2.2
Shader "Unlit/Chapter10-GlassRefraction"
{
Properties
{
//玻璃的材质纹理
_MainTex ("Texture", 2D) = "white" {}
//玻璃的法线纹理
_BumpMap("Normal Map",2D) = "bump"{}
//模拟反射环境的纹理
_Cubemap("Environment Cubemap",Cube) = "_Skybox"{}
//模拟折射时的图像扭曲程度
_Distortion("Distortion",Range(0,100))=10
//控制折射程度
_RefractAmount("Reftact Amount",Range(0.0,1.0))=1.0
}
SubShader
{
// We must be transparent, so other objects are drawn before this one.(transparent必须透明的,这样其他的物体就会被画在这个之前。)
Tags{ "Queue" = "Transparent" "RenderType" = "Opaque" }
// This pass grabs the screen behind the object into a texture.(这个传递将对象后面的屏幕抓取到一个纹理中。)
// We can access the result in the next pass as _RefractionTex(我们可以在下一次传递中访问结果为_RefractionTex)
GrabPass{ "_RefractionTex" }
Pass{
CGPROGRAM
#pragma vertex vert
#pragma fr
玻璃效果【Unity Shader 入门精要10.2.2】
最新推荐文章于 2024-05-29 11:39:33 发布