- Home /
 
               Question by 
               leandropim · Feb 16, 2013 at 12:10 AM · 
                shaderpixelvertexdiffuse  
              
 
              Curved + Diffuse Shader???
hi... i dont know how to work with shader, i would like your help to Join this 2 shaders, please
CURVED (Vertex Shader)
 Shader "Curved" 
 {
     Properties 
     {
         _MainTex ("Base (RGB)", 2D) = "white" {}
         _QOffset ("Offset", Vector) = (0,0,0,0)
         _Dist ("Distance", Float) = 100.0
     }
     
     
     SubShader 
     {
         Tags { "RenderType"="Opaque" }
         
         Pass
         {
             CGPROGRAM
             #pragma vertex vert
             #pragma fragment frag
             #include "UnityCG.cginc"
 
                         sampler2D _MainTex;
             float4 _QOffset;
             float _Dist;
             
             struct v2f 
             {
                 float4 pos : SV_POSITION;
                 float4 uv : TEXCOORD0;
             };
 
             v2f vert (appdata_base v)
             {
                 v2f o;
                 float4 vPos = mul (UNITY_MATRIX_MV, v.vertex);
                 float zOff = vPos.z/_Dist;
                 vPos += _QOffset*zOff*zOff;
                 o.pos = mul (UNITY_MATRIX_P, vPos);
                 o.uv = v.texcoord;
                 return o;
             }
 
             half4 frag (v2f i) : COLOR
             {
                 half4 col = tex2D(_MainTex, i.uv.xy);
                 return col;
             }
             ENDCG
         }
     }
     FallBack "Diffuse"
 }
DIFFUSE (Pixel Shader)
 Shader "Diffuse" 
 {
     Properties 
     {
         _Color ("Main Color", Color) = (1,1,1,1)
         _MainTex ("Base (RGB)", 2D) = "white" {}
     }
     
     SubShader 
     {
         Tags { "RenderType"="Opaque" }
         LOD 200
     
         CGPROGRAM
         #pragma surface surf Lambert
         
         sampler2D _MainTex;
         fixed4 _Color;
         
         struct Input 
         {
             float2 uv_MainTex;
         };
         
         void surf (Input IN, inout SurfaceOutput o) 
         {
             fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
             o.Albedo = c.rgb;
             o.Alpha = c.a;
         }
         ENDCG
     }
     
     Fallback "VertexLit"
 }
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
Cubemap Diffuse / Heightmap Shader Issues. 1 Answer
How can I add the diffuse property to a vertex Shader? 1 Answer
Problem of color in custom vertex shader 0 Answers
Vertex Displacement Shader Graph With The Camera Moving Issue 1 Answer
Getting vertex data from lighting function in shaders. 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                