Unity Shader Study09 : ABS

https://docs.unity3d.com/kr/current/Manual/SL-SurfaceShaderExamples.html

outline shader finished

Shader "Custom/OutLineShader" {
 Properties {
  _MainTex ("Albedo (RGB)", 2D) = "white" {}
     _OLColor ("Outline Color", Color ) = (1,1,1,1)
  _OLSize ("Outline Size", Range(0.001,0.1)) = 0.01

 }
 SubShader {
  Tags { "RenderType"="Opaque" }
 
  cull front
  //1st Pass
  CGPROGRAM
  #pragma surface surf Nolight vertex:vert noshadow noambient //no shadow
  sampler2D _MainTex;
   //struct appdata_full {
  // float4 vertex : POSITION;
  // float4 tangent : TANGENT;
  // float3 normal : NORMAL;
  // float4 texcoord : TEXCOORD0;
  // float4 texcoord1 : TEXCOORD1;
  // float4 texcoord2 : TEXCOORD2;
  // float4 texcoord3 : TEXCOORD3;
  // fixed4 color : COLOR;
  // UNITY_VERTEX_INPUT_INSTANCE_ID
  //};
  float _OLSize;
  float4 _OLColor;
     void vert(inout appdata_full v) {
   /*v.vertex.y = v.vertex.y + 1;*/
   float T = _Time*40;
   float S = _OLSize + abs(sin(T))*0.007;
   v.vertex.xyz = v.vertex.xyz + v.normal.xyz * S;
  }
  struct Input {
   //float2 uv_MainTex;
   //float4 color :COLOR;
   float4 _OLColor;
   //float4 color : _fixedColor;
   //float _OLSize;
  };
  void surf (Input IN, inout SurfaceOutput o) {
   //_fixedColor = _OLColor.rgb;
   //float4 A = _OLColor * ;
   //float4 A = sin(_Time);
   //float4 a = (_SinTime.x, _SinTime.x, _SinTime.x, _SinTime.x)*0.01;
   o.Emission = _OLColor.rgb;
  }
  float4 LightingNolight(SurfaceOutput s, float3 lightDir, float atten) {
   return float4(0, 0, 0, 1);
  }
  ENDCG

   cull back
   //2nd Pass
  CGPROGRAM
            #pragma surface surf Lambert
   sampler2D _MainTex;
  struct Input {
   float2 uv_MainTex;
  };
  void surf(Input IN, inout SurfaceOutput o) {
   // Albedo comes from a texture tinted by color
   fixed4 c = tex2D(_MainTex, IN.uv_MainTex);
   o.Albedo = c.rgb;
   o.Alpha = c.a;
  }
  ENDCG
 }
 FallBack "Diffuse"
}

댓글

이 블로그의 인기 게시물

About AActor!!! "UObject" has no member "BeginPlay"

UNREAL Android build information

Shader informations nice blog ~ ~