第二章 04 魔镜世界

编程入门 行业动态 更新时间:2024-10-24 04:44:09

<a href=https://www.elefans.com/category/jswz/34/1669396.html style=第二章 04 魔镜世界"/>

第二章 04 魔镜世界

项目预览图: 

ase:

 Code:

Shader "ShaderCode/04/Mirror_Stencil_Code"
{Properties{_MainTex ("Texture", 2D) = "white" {}}SubShader{Tags { "Queue"="AlphaTest+10"  }Pass{ ZWrite OffColorMask 0Stencil{Ref 1Comp alwaysPass replace}CGPROGRAM#pragma vertex vert#pragma fragment frag#include "UnityCG.cginc"struct appdata{float4 vertex : POSITION;float2 uv : TEXCOORD0;};struct v2f{float2 uv : TEXCOORD0;float4 vertex : SV_POSITION;};sampler2D _MainTex;float4 _MainTex_ST;v2f vert (appdata v){v2f o;o.vertex = UnityObjectToClipPos(v.vertex);o.uv = TRANSFORM_TEX(v.uv, _MainTex);return o;}fixed4 frag (v2f i) : SV_Target{// sample the texturefixed4 col = tex2D(_MainTex, i.uv);return col;}ENDCG}}
}

Shader "ShaderCode/04/Scene_Mirror_Code"
{Properties{_Diffuse ("Texture", 2D) = "white" {}}SubShader{Tags { "Queue"="AlphaTest+20" }LOD 100Pass{Stencil{Ref 1Comp Equal}CGPROGRAM#pragma vertex vert#pragma fragment frag// make fog work#pragma multi_compile_fog#include "UnityCG.cginc"struct appdata{float4 vertex : POSITION;float2 uv : TEXCOORD0;};struct v2f{float2 uv : TEXCOORD0;UNITY_FOG_COORDS(1)float4 vertex : SV_POSITION;};sampler2D _Diffuse;float4 _Diffuse_ST;v2f vert (appdata v){v2f o;o.vertex = UnityObjectToClipPos(v.vertex);o.uv = TRANSFORM_TEX(v.uv, _Diffuse);UNITY_TRANSFER_FOG(o,o.vertex);return o;}fixed4 frag (v2f i) : SV_Target{// sample the texturefixed4 col = tex2D(_Diffuse, i.uv);clip(col.a - 0.5);// apply fogUNITY_APPLY_FOG(i.fogCoord, col);return col;}ENDCG}}
}
Shader "ShaderCode/04/Mirror_Skybox_Code"
{Properties{_MainTex ("Texture", 2D) = "black" {}}SubShader{Tags {"Queue"="AlphaTest+15"}LOD 100Pass{ZTest AlwaysStencil{Ref 1Comp Equal}CGPROGRAM#pragma vertex vert#pragma fragment frag// make fog work#pragma multi_compile_fog#include "UnityCG.cginc"struct appdata{float4 vertex : POSITION;float2 uv : TEXCOORD0;};struct v2f{float2 uv : TEXCOORD0;UNITY_FOG_COORDS(1)float4 vertex : SV_POSITION;};sampler2D _MainTex;float4 _MainTex_ST;v2f vert (appdata v){v2f o;o.vertex = UnityObjectToClipPos(v.vertex);o.uv = TRANSFORM_TEX(v.uv, _MainTex);UNITY_TRANSFER_FOG(o,o.vertex);return o;}fixed4 frag (v2f i) : SV_Target{// sample the texturefixed4 col = tex2D(_MainTex, i.uv);// apply fogUNITY_APPLY_FOG(i.fogCoord, col);return col;}ENDCG}}
}

更多推荐

第二章 04 魔镜世界

本文发布于:2023-06-16 17:35:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/747796.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:第二章   魔镜   世界

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!