码迷,mamicode.com
首页 > 其他好文 > 详细

顶点纹理shader

时间:2014-06-03 16:40:44      阅读:262      评论:0      收藏:0      [点我收藏+]

标签:c   style   class   blog   code   java   

bubuko.com,布布扣
    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"
        }
bubuko.com,布布扣

 

顶点纹理shader,布布扣,bubuko.com

顶点纹理shader

标签:c   style   class   blog   code   java   

原文地址:http://www.cnblogs.com/softimagewht/p/3765099.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!