You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
88 lines
1.9 KiB
88 lines
1.9 KiB
3 years ago
|
// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
|
||
|
|
||
|
// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
|
||
|
|
||
|
// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
|
||
|
|
||
|
// Upgrade NOTE: replaced '_World2Object' with 'unity_WorldToObject'
|
||
|
|
||
|
Shader "Unlit/ShaderTest_1"
|
||
|
{
|
||
|
Properties
|
||
|
{
|
||
|
_MainTex ("Texture", 2D) = "white" {}
|
||
|
_Color ("Main Color", Color) = (1,1,1,1)
|
||
|
_Int("Int_1",Int) = 2
|
||
|
_Cube("TextCube",Cube) = "black"{}
|
||
|
_Specular("Specular",Color) = (1,1,1,1)
|
||
|
_Gloss("Gloss",Range(8,256)) = 20
|
||
|
}
|
||
|
SubShader
|
||
|
{
|
||
|
Tags { "RenderType"="Opaque"
|
||
|
"LightMode"="ForwardBase"}
|
||
|
LOD 100
|
||
|
|
||
|
Pass
|
||
|
{
|
||
|
CGPROGRAM
|
||
|
#pragma vertex vert
|
||
|
#pragma fragment frag
|
||
|
// make fog work
|
||
|
#pragma multi_compile_fog
|
||
|
|
||
|
#include "UnityCG.cginc"
|
||
|
#include "Lighting.cginc"
|
||
|
#include "UnityLightingCommon.cginc"
|
||
|
|
||
|
struct appdata
|
||
|
{
|
||
|
float4 vertex : POSITION;
|
||
|
float2 uv : TEXCOORD0;
|
||
|
float3 normal : NORMAL;
|
||
|
};
|
||
|
|
||
|
struct v2f
|
||
|
{
|
||
|
float2 uv : TEXCOORD0;
|
||
|
UNITY_FOG_COORDS(1)
|
||
|
float4 vertex : SV_POSITION;
|
||
|
fixed4 diff : COLOR;
|
||
|
};
|
||
|
|
||
|
sampler2D _MainTex;
|
||
|
float4 _MainTex_ST;
|
||
|
fixed4 _Color;
|
||
|
fixed4 _Specular;
|
||
|
float _Gloss;
|
||
|
|
||
|
v2f vert (appdata v)
|
||
|
{
|
||
|
v2f o;
|
||
|
o.vertex = UnityObjectToClipPos(v.vertex);
|
||
|
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
|
||
|
half3 worldNormal = UnityObjectToWorldNormal(v.normal);
|
||
|
half3 worldLight = _WorldSpaceLightPos0.xyz;
|
||
|
half nl = max(0, dot(worldNormal, _WorldSpaceLightPos0.xyz)*0.5+0.5);
|
||
|
o.diff = _LightColor0 * _Color * nl;
|
||
|
//o.diff.rgb += ShadeSH9(half4(worldNormal,1));
|
||
|
|
||
|
UNITY_TRANSFER_FOG(o,o.vertex);
|
||
|
return o;
|
||
|
}
|
||
|
|
||
|
fixed4 frag (v2f i) : SV_Target
|
||
|
{
|
||
|
// sample the texture
|
||
|
fixed4 col = tex2D(_MainTex, i.uv);
|
||
|
col = col*i.diff;
|
||
|
// apply fog
|
||
|
UNITY_APPLY_FOG(i.fogCoord, col);
|
||
|
return col;
|
||
|
}
|
||
|
ENDCG
|
||
|
}
|
||
|
}
|
||
|
FallBack "Diffuse"
|
||
|
}
|