Shader "Custom/VertDisplace" {
            Properties {
                _MainTex ("Base (RGB)", 2D) = "white" {}
            }
            SubShader {
                Tags { "RenderType"="Opaque" }
                LOD 200
               
                CGPROGRAM
    // Upgrade NOTE: excluded shader from OpenGL ES 2.0 because it does not contain a surface program or both vertex and fragment programs.
                #pragma exclude_renderers gles
     
                #pragma target 3.0
                #pragma vertex vert
                #pragma surface surf BlinnPhong
               
                sampler2D _MainTex;
         
                struct Input {
                    float2 uv_MainTex;
                };
         
                void vert (inout appdata_full v) {
                    #if !defined(SHADER_API_OPENGL)
                    float4 tex = tex2Dlod (_MainTex, float4(v.texcoord.xy,0,0));
                    v.vertex.z += tex.r * 0.2;
                    #endif
                }  
               
                void surf (Input IN, inout SurfaceOutput o) {
                    half4 tex = tex2D(_MainTex, IN.uv_MainTex);
                    o.Albedo = tex.rgb;
                    o.Alpha = tex.a;
                }        
               
                ENDCG
            }
            FallBack "Diffuse"
        }

 

相关文章:

  • 2022-02-28
  • 2021-07-09
  • 2022-12-23
  • 2021-07-31
  • 2022-12-23
  • 2021-07-26
  • 2018-09-28
猜你喜欢
  • 2022-01-15
  • 2021-10-08
  • 2021-12-29
  • 2021-08-24
  • 2021-04-21
  • 2021-11-13
  • 2022-12-23
相关资源
相似解决方案