CarmenSandiego/Assets/Shaders/SDF Map Marker Spokes.shader
Jamie Greunbaum 4fad27ce19 - Map markers have a lit texture when they are on the correct location.
- Markers now expire when they end up finding no collisions for long enough.
2025-06-25 16:41:24 -04:00

129 lines
4.1 KiB
GLSL

Shader "Carmen/SDF/Map Marker Spokes"
{
Properties
{
_MainTex("Albedo(RGB)", 2D) = "white" {}
_Color("Color", Color) = (1.0, 1.0, 1.0, 1.0)
_SDFCutoff("SDF Cutoff", Range(0.0, 1.0)) = 1.0
[ToggleOff] _SpecularHighlights("Specular Highlights", Float) = 0.0
[ToggleOff] _GlossyReflections("Glossy Reflections", Float) = 0.0
[Toggle(_ENABLE_GEOMETRIC_SPECULAR_AA)] _EnableGeometricSpecularAA("EnableGeometricSpecularAA", Float) = 1.0
_SpecularAAScreenSpaceVariance("SpecularAAScreenSpaceVariance", Range(0.0, 1.0)) = 0.1
_SpecularAAThreshold("SpecularAAThreshold", Range(0.0, 1.0)) = 0.2
[Enum(Default,0,MonoSH,1,MonoSH (no highlights),2)] _LightmapType ("Lightmap Type", Float) = 0.0
// TODO: This has questionable performance impact on Mobile but very little discernable impact on PC. Should
// make a toggle once we have properly branched compilation between those platforms, that's PC-only
[Toggle(_BICUBIC)] _Bicubic ("Enable Bicubic Sampling", Float) = 0.0
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
//#define _DEBUG_VRC
#ifdef _DEBUG_VRC
#define DEBUG_COL(rgb) debugCol = half4(rgb, 1)
#define DEBUG_VAL(val) debugCol = half4(val, val, val, 1)
half4 debugCol = half4(0,0,0,1);
#else
#define DEBUG_COL(rgb)
#define DEBUG_VAL(val)
#endif
#pragma target 3.0
#pragma multi_compile_fragment _ _EMISSION
#pragma multi_compile _ _DETAIL
#pragma multi_compile_fragment _ _SPECULARHIGHLIGHTS_OFF
#pragma multi_compile_fragment _ _GLOSSYREFLECTIONS_OFF
#pragma multi_compile_fragment _ _MONOSH_SPECULAR _MONOSH_NOSPECULAR
#pragma multi_compile_fragment _ _ENABLE_GEOMETRIC_SPECULAR_AA
#pragma dynamic_branch_local_fragment _ DISABLE_VERTEX_COLORING
//SDK-SYNC-IGNORE-LINE - unused variants in SDK projects - #pragma multi_compile_fragment _ FORCE_UNITY_DLDR_LIGHTMAP_ENCODING FORCE_UNITY_RGBM_LIGHTMAP_ENCODING FORCE_UNITY_LIGHTMAP_FULL_HDR_ENCODING UNITY_LIGHTMAP_NONE
//#pragma multi_compile _ _BICUBIC
#if defined(LIGHTMAP_ON)
#if defined(_MONOSH_SPECULAR) || defined(_MONOSH_NOSPECULAR)
#define _MONOSH
#if defined(_MONOSH_SPECULAR)
#define _LMSPEC
#endif
#endif
#endif
#include "/Packages/com.vrchat.base/Runtime/VRCSDK/Sample Assets/Shaders/Mobile/VRChat.cginc"
#pragma surface surf StandardVRC vertex:vert exclude_path:prepass exclude_path:deferred noforwardadd noshadow nodynlightmap nolppv noshadowmask
#pragma skip_variants LIGHTMAP_SHADOW_MIXING
// -------------------------------------
struct Input
{
float2 texcoord0;
#ifdef _DETAIL
float2 texcoord1;
#endif
fixed4 color : COLOR;
};
UNITY_DECLARE_TEX2D(_MainTex);
float4 _MainTex_ST;
half4 _Color;
uniform half _SDFCutoff;
uniform half _SpecularAAScreenSpaceVariance;
uniform half _SpecularAAThreshold;
#ifdef _EMISSION
UNITY_DECLARE_TEX2D(_EmissionMap);
half4 _EmissionColor;
#endif
#ifdef _DETAIL
uniform half _UVSec;
float4 _DetailAlbedoMap_ST;
UNITY_DECLARE_TEX2D(_DetailMask);
UNITY_DECLARE_TEX2D(_DetailAlbedoMap);
UNITY_DECLARE_TEX2D(_DetailNormalMap);
uniform half _DetailNormalMapScale;
#endif
// Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
// See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
// #pragma instancing_options assumeuniformscaling
UNITY_INSTANCING_BUFFER_START(Props)
// put more per-instance properties here
UNITY_INSTANCING_BUFFER_END(Props)
// -------------------------------------
void vert(inout appdata_full v, out Input o)
{
UNITY_INITIALIZE_OUTPUT(Input,o);
o.texcoord0 = TRANSFORM_TEX(v.texcoord.xy, _MainTex); // Always source from uv0
}
void surf(Input IN, inout SurfaceOutputStandardVRC o)
{
half alphastep = step(UNITY_SAMPLE_TEX2D(_MainTex, IN.texcoord0), 0.002f);
if (alphastep < 0.5f) discard;
o.Albedo = _Color;
o.Alpha = alphastep;
o.Metallic = 0.0f;
o.Smoothness = 1.0f;
o.Normal = half3(0, 0, 1);
}
ENDCG
}
FallBack "VRChat/Mobile/Diffuse"
CustomEditor "StandardLiteShaderGUI"
}