长毛象_ 2017-06-16 08:45 采纳率: 0%
浏览 2240

Unity3d 图片添加shader,透明部分被覆盖,请问shader哪写错了

Unity3d 图片添加shader,透明部分被覆盖,请问shader哪写错了

  • 写回答

1条回答 默认 最新

  • 长毛象_ 2017-06-16 08:46
    关注

    shader 部分
    Shader "Unlit/NewUnlitShader"
    {
    Properties
    {
    _MainTex("Base (RGB), Alpha (A)", 2D) = "white" {}
    _RendTex("Base (RGB), Alpha (A)", 2D) = "white" {}
    }

    SubShader
    {
        LOD 200
    
        Tags
        {
            "Queue" = "Transparent"
            "IgnoreProjector" = "True"
            "RenderType" = "Transparent"
        }
    
        Pass
        {
            Cull Off
            Lighting Off
            ZWrite Off
            Fog{ Mode Off }
            Offset -1, -1
            ColorMask RGB
            AlphaTest Greater .01
            Blend SrcAlpha OneMinusSrcAlpha
            ColorMaterial AmbientAndDiffuse
    
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            #include "UnityCG.cginc"
    
            sampler2D _MainTex;
            float4 _MainTex_ST;
            sampler2D _RendTex;
    
            struct appdata_t
            {
                float4 vertex : POSITION;
                half4 color : COLOR;
                float2 texcoord : TEXCOORD0;
            };
    
            struct v2f
            {
                float4 vertex : POSITION;
                half4 color : COLOR;
                float2 texcoord : TEXCOORD0;
            };
    
            v2f vert(appdata_t v)
            {
                v2f o;
                o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
                o.color = v.color;
                o.texcoord = v.texcoord;
                return o;
            }
    
            half4 frag(v2f IN) : COLOR
            {
                // Sample the texture
                half4 col = tex2D(_MainTex, IN.texcoord) * IN.color;
                half4 rnd = tex2D(_RendTex, IN.texcoord) * IN.color;
                col.a = rnd.a;
                return col;
            }
            ENDCG
        }
    }
    

    }

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog