47 lines
1.5 KiB
Plaintext
47 lines
1.5 KiB
Plaintext
Shader "BigShipTycoon/Bridge Glazing"
|
|
{
|
|
Properties
|
|
{
|
|
_Color ("Glass tint", Color) = (.52,.74,.79,1)
|
|
}
|
|
SubShader
|
|
{
|
|
Tags { "Queue" = "Transparent" "RenderType" = "Transparent" }
|
|
Blend SrcAlpha OneMinusSrcAlpha
|
|
Cull Off
|
|
ZWrite Off
|
|
|
|
Pass
|
|
{
|
|
CGPROGRAM
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
#include "UnityCG.cginc"
|
|
|
|
fixed4 _Color;
|
|
struct Input { float4 vertex : POSITION; float3 normal : NORMAL; };
|
|
struct Output { float4 clip : SV_POSITION; float3 world : TEXCOORD0; float3 normal : TEXCOORD1; };
|
|
|
|
Output vert(Input input)
|
|
{
|
|
Output output;
|
|
output.clip = UnityObjectToClipPos(input.vertex);
|
|
output.world = mul(unity_ObjectToWorld, input.vertex).xyz;
|
|
output.normal = UnityObjectToWorldNormal(input.normal);
|
|
return output;
|
|
}
|
|
|
|
fixed4 frag(Output input) : SV_Target
|
|
{
|
|
float3 eye = normalize(_WorldSpaceCameraPos.xyz - input.world);
|
|
float3 normal = normalize(input.normal);
|
|
float edge = pow(1 - abs(dot(eye, normal)), 2);
|
|
float reflection = pow(saturate(reflect(-eye, normal).y), 4);
|
|
float3 tint = lerp(_Color.rgb * .64, float3(.89,.82,.66), reflection * .36);
|
|
return fixed4(tint, .041 + edge * .21 + reflection * .058);
|
|
}
|
|
ENDCG
|
|
}
|
|
}
|
|
}
|