Unity3d《Shader篇》变胖

变胖前

 

变胖后

 

 

//Shader

Shader "Custom/NormalExt"
{
	Properties
	{
		_MainTex("Base (RGB)", 2D ) = "white"{}
		_Dis("Distance", Range(0.0,0.8)) = 0.1
	}
	
	SubShader
	{
		Tags { "RenderType" = "Opaque" }
	
		CGPROGRAM
		
		
		#pragma surface surf Lambert vertex:vert
		
		sampler2D _MainTex;
		float _Dis;
		
		struct Input{
			float2 uv_MainTex;
		};
		
		
		
		void vert(inout appdata_full v)
		{
			v.vertex.xyz+=v.normal*_Dis;
		}
		
		void surf(Input IN, inout SurfaceOutput o)
		{
			o.Albedo = tex2D(_MainTex,IN.uv_MainTex);
		}
		
		ENDCG
	}
	FallBack "Diffuse"
}

  

posted @ 2015-06-30 11:15  MrBlue  阅读(831)  评论(0编辑  收藏  举报