美文网首页
改造Unity的Alpha Blended Shader,加入Z

改造Unity的Alpha Blended Shader,加入Z

作者: 全新的饭 | 来源:发表于2024-02-18 17:08 被阅读0次

概念说明:Unity Shader-渲染队列,ZTest,ZWrite,Early-Z

shader代码

Shader "Fan/Particles/Alpha Blended" {
    Properties {
        _MainTex ("Particle Texture", 2D) = "white" {}
        [Enum(Off,0,On,1)]_ZWrite("ZWrite",int) = 0
        [Enum(UnityEngine.Rendering.CompareFunction)]_ZTest("ZTest",int) = 0
    }
   
    Category {
        Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
        Blend SrcAlpha OneMinusSrcAlpha
        Cull Off Lighting Off ZWrite Off Fog { Color (0,0,0,0) }
        ZWrite[_ZWrite]
        ZTest[_ZTest]
       
        BindChannels {
            Bind "Color", color
            Bind "Vertex", vertex
            Bind "TexCoord", texcoord
        }
       
        SubShader {
            Pass {
                SetTexture [_MainTex] {
                    combine texture * primary
                }
            }
        }
    }
}
框出修改内容.png

相关文章

网友评论

      本文标题:改造Unity的Alpha Blended Shader,加入Z

      本文链接:https://www.haomeiwen.com/subject/ahrmadtx.html