CarmenSandiego/Assets/Shaders/Bicolour SDF.shader
Jamie Greunbaum 644f5f9671 - Added a brick overhang over the alleyway fence.
- Added the ACME Bugnet warning light to the alleyway.
- Added a sign for the phone in the alleyway.
- Added a bicolour SDF shader.
- Enabled mesh compression on many of the meshes in the world.
2026-05-22 15:38:48 -04:00

57 lines
1.3 KiB
Plaintext

Shader "Carmen/SDF/Bicolour"
{
Properties
{
_MainTex ("SDF", 2D) = "white" {}
_NormalTex ("Normal", 2D) = "bump" {}
_NegativeColour ("Negative Colour", Color) = (0.0, 0.0, 0.0, 1.0)
_PositiveColour ("Positive Colour", Color) = (1.0, 1.0, 1.0, 1.0)
_Border ("Border", Range(0.0, 1.0)) = 0.5
}
SubShader
{
Tags { "RenderType" = "Opaque" }
LOD 200
CGPROGRAM
#include "UnityCG.cginc"
#pragma target 4.5
#pragma surface surf Lambert
UNITY_DECLARE_TEX2D(_MainTex);
UNITY_DECLARE_TEX2D(_NormalTex);
half4 _NegativeColour;
half4 _PositiveColour;
half _Border;
struct Input
{
float2 uv_MainTex;
float2 uv_NormalTex;
};
void surf(Input IN, inout SurfaceOutput o)
{
half sdf_sample = UNITY_SAMPLE_TEX2D(_MainTex, IN.uv_MainTex).r;
half fill_halfchange = (abs(ddx(sdf_sample)) + abs(ddy(sdf_sample))) / 2.0;
half fill_loweredge = (1.0 - _Border) - fill_halfchange;
half fill_upperedge = (1.0 - _Border) + fill_halfchange;
half fill_mask = saturate((sdf_sample - fill_loweredge) / (fill_upperedge - fill_loweredge));
half3 blend_colour = lerp(_NegativeColour, _PositiveColour, fill_mask);
o.Albedo = fixed3(blend_colour);
o.Normal = UnpackNormal(UNITY_SAMPLE_TEX2D(_NormalTex, IN.uv_NormalTex));
}
ENDCG
}
Fallback "VRChat/Mobile/Standard Lite"
}