Unity_Shader_コード
Shader "Unlit/NewUnlitShader"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_SubTex("Texture", 2D) = "white" {}
_Heightaaaa("Heighteeee",float) =0.5 //以下と紐づけられていない。。。が
//_Light ("Light",vector) =(1,1,1,1)
}
SubShader
{
Tags { "RenderType"="Transparent""Queue" = "Transparent" }
LOD 100
Pass
{
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float3 normal : NORMAL;
};
struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
float3 normal : NORMAL;
};
sampler2D _MainTex;
sampler2D _SubTex;
float4 _MainTex_ST;
float _Heightaaaa; //シェイダーラボが自動的にプロパティと関連付けてくれる
//float4 _Light;
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
o.normal = UnityObjectToWorldNormal(v.normal);
return o;
}
fixed4 frag(v2f i) : SV_Target
{
/*
float2 uv = i.uv;
if (uv.y < _Heightaaaa)
{
return float4(0, 0, 0, 1);
}
else
{
return float4(uv, 0, 1);
}
*/
float cosResult = dot(i.normal, normalize(_WorldSpaceLightPos0.xyz));
float4 col1 = tex2D(_MainTex, i.uv);
float4 col2 = tex2D(_SubTex, i.uv) ;
float4 result = lerp(col1 , col2 , cosResult);
result.a = 0.5;
return result;
}
ENDCG
}
}
}