- Added markers to show players where to stand during round 2.

- Added a brick material and lined the walls of the alleyway with it.
- Added a concrete walkway to the alleyway.
- Map dots, map borders, and The Chase title are all now anti-aliased.
- Improved the look of the concrete material.
- Wood textures no longer use a transparency render queue.
This commit is contained in:
2026-03-27 04:15:15 -04:00
parent 6491ab71ec
commit c11a39d065
70 changed files with 3696 additions and 1259 deletions
+48
View File
@@ -0,0 +1,48 @@
Shader "Carmen/Brick"
{
Properties
{
_MainTex ("Colour", 2D) = "white" {}
_NormalTex ("Normal", 2D) = "bump" {}
_AOTex ("Ambient Occlusion", 2D) = "white" {}
_DetailTex ("Detail Colour", 2D) = "gray" {}
_DetailNormal ("Detail Normal", 2D) = "bump" {}
_DetailIntensity ("Detail Intensity", Range(0.0, 1.0)) = 1.0
}
SubShader
{
Tags { "RenderType" = "Opaque" }
LOD 200
CGPROGRAM
#pragma surface surf Lambert
struct Input {
float2 uv_MainTex;
float2 uv_NormalTex;
float2 uv_AOTex;
float2 uv_DetailTex;
float2 uv_DetailNormal;
};
UNITY_DECLARE_TEX2D(_MainTex);
UNITY_DECLARE_TEX2D(_NormalTex);
UNITY_DECLARE_TEX2D(_AOTex);
UNITY_DECLARE_TEX2D(_DetailTex);
UNITY_DECLARE_TEX2D(_DetailNormal);
half _DetailIntensity;
void surf (Input IN, inout SurfaceOutput o) {
o.Albedo = UNITY_SAMPLE_TEX2D(_MainTex, IN.uv_MainTex).rgb;
o.Albedo *= UNITY_SAMPLE_TEX2D(_AOTex, IN.uv_MainTex).r;
o.Albedo *= saturate((UNITY_SAMPLE_TEX2D(_DetailTex, IN.uv_DetailTex).rgb * 2.0) * _DetailIntensity);
half3 normaltex = UnpackNormal(UNITY_SAMPLE_TEX2D(_NormalTex, IN.uv_NormalTex));
half3 normaldetail = UnpackNormal(UNITY_SAMPLE_TEX2D(_DetailNormal, IN.uv_DetailNormal));
o.Normal = normalize(half3(normaltex.xy + normaldetail.xy, normaltex.z));
}
ENDCG
}
Fallback "VRChat/Mobile/Standard Lite"
}
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 4a6a7578b4e624749b7e468421281b66
guid: 73221e691bb7f9d449fc6a0db165b958
ShaderImporter:
externalObjects: {}
defaultTextures: []
+82
View File
@@ -0,0 +1,82 @@
Shader "Carmen/SDF/Marker"
{
Properties
{
_MainTex ("SDF", 2D) = "white" {}
_BorderColour ("Border Colour", Color) = (1.0, 1.0, 1.0, 1.0)
_BorderSize ("Border Size", Range(0.05, 0.95)) = 0.95
_FillColour ("Fill Colour", Color) = (0.0, 0.0, 0.0, 1.0)
_FillSize ("Fill Size", Range(0.05, 0.95)) = 0.66666666666666
}
SubShader
{
Tags { "Queue"="Transparent" "RenderType" = "Transparent" }
LOD 200
Pass {
Cull Back
Lighting Off
Blend SrcAlpha OneMinusSrcAlpha
Offset -1, -1
CGPROGRAM
#include "UnityCG.cginc"
#pragma target 4.5
#pragma vertex vert
#pragma fragment frag
UNITY_DECLARE_TEX2D(_MainTex);
float4 _MainTex_ST;
half4 _BorderColour;
half _BorderSize;
half4 _FillColour;
half _FillSize;
struct Data
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct V2F
{
float4 position : SV_POSITION;
float2 uv : TEXCOORD0;
};
V2F vert(Data v)
{
V2F o;
o.position = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
return o;
}
fixed4 frag(V2F i) : SV_TARGET
{
half sdf_sample = UNITY_SAMPLE_TEX2D(_MainTex, i.uv).r;
half border_halfchange = (abs(ddx(sdf_sample)) + abs(ddy(sdf_sample))) / 2.0;
half border_loweredge = (1.0 - _BorderSize) - border_halfchange;
half border_upperedge = (1.0 - _BorderSize) + border_halfchange;
half border_mask = saturate((sdf_sample - border_loweredge) / (border_upperedge - border_loweredge));
half fill_halfchange = (abs(ddx(sdf_sample)) + abs(ddy(sdf_sample))) / 2.0;
half fill_loweredge = (1.0 - _FillSize) - fill_halfchange;
half fill_upperedge = (1.0 - _FillSize) + fill_halfchange;
half fill_mask = saturate((sdf_sample - fill_loweredge) / (fill_upperedge - fill_loweredge));
half3 blend_colour = lerp(_BorderColour, _FillColour, fill_mask);
return fixed4(blend_colour, border_mask);
}
ENDCG
}
}
Fallback "VRChat/Mobile/Standard Lite"
}
+9
View File
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 425fd677d4694b044973d26bd5f48af5
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
userData:
assetBundleName:
assetBundleVariant:
-1
View File
@@ -37,7 +37,6 @@ Shader "Carmen/Render Texture UI"
UNITY_DECLARE_TEX2D(_MainTex);
float4 _MainTex_ST;
half4 _Color;
half4 _Skew;
struct Data
{
+207 -202
View File
@@ -6,245 +6,250 @@
Shader "Carmen/Maps/SDF Map Borders"
{
Properties
{
_MainTex ("SDF", 2D) = "white" {}
_ColourTex ("Country Colours", 2D) = "white" {}
Properties
{
_MainTex ("SDF", 2D) = "white" {}
_ColourTex ("Country Colours", 2D) = "white" {}
_LineThickness ("Line Thickness", float) = 0.15
_VerticalLineCorrection ("Vertical Line Correction", float) = 0.0
}
_LineThickness ("Line Thickness", float) = 0.15
_VerticalLineCorrection ("Vertical Line Correction", float) = 0.0
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 200
CGPROGRAM
#include "UnityCG.cginc"
#include "UnityPBSLighting.cginc"
#include "UnityCG.cginc"
#include "UnityPBSLighting.cginc"
#define _SPECULARHIGHLIGHTS_OFF
#define _GLOSSYREFLECTIONS_OFF
#define _SPECULARHIGHLIGHTS_OFF
#define _GLOSSYREFLECTIONS_OFF
// Use our squeezed BRDF on mobile
// In general we want FLOAT_MIN to be the smallest value such that (1.0f + FLOAT_MIN) != FLOAT_MIN
#if defined(SHADER_API_MOBILE)
#define VRC_BRDF_PBS BRDF2_VRC_PBS
#define FLOAT_MIN 1e-4
#else
#define VRC_BRDF_PBS UNITY_BRDF_PBS
#define FLOAT_MIN 1e-6
#endif
// Use our squeezed BRDF on mobile
// In general we want FLOAT_MIN to be the smallest value such that (1.0f + FLOAT_MIN) != FLOAT_MIN
#if defined(SHADER_API_MOBILE)
#define VRC_BRDF_PBS BRDF2_VRC_PBS
#define FLOAT_MIN 1e-4
#else
#define VRC_BRDF_PBS UNITY_BRDF_PBS
#define FLOAT_MIN 1e-6
#endif
#pragma target 4.5
#pragma surface surf LambertVRC exclude_path:prepass exclude_path:deferred noforwardadd
#pragma target 4.5
#pragma surface surf LambertVRC exclude_path:prepass exclude_path:deferred noforwardadd
UNITY_DECLARE_TEX2D(_MainTex);
UNITY_DECLARE_TEX2D(_ColourTex);
UNITY_DECLARE_TEX2D(_MainTex);
UNITY_DECLARE_TEX2D(_ColourTex);
CBUFFER_START(UnityPerMaterial)
float _LineThickness;
float _VerticalLineCorrection;
CBUFFER_END
CBUFFER_START(UnityPerMaterial)
float _LineThickness;
float _VerticalLineCorrection;
CBUFFER_END
struct SurfaceOutputVRC
{
fixed3 Albedo;
fixed3 Normal;
fixed3 Emission;
half Specular;
fixed Gloss;
fixed Alpha;
};
struct SurfaceOutputVRC
{
fixed3 Albedo;
fixed3 Normal;
fixed3 Emission;
half Specular;
fixed Gloss;
fixed Alpha;
};
struct Input
{
float2 uv_MainTex;
half4 colour : COLOR;
};
struct Input
{
float2 uv_MainTex;
half4 colour : COLOR;
};
void surf (Input IN, inout SurfaceOutputVRC o)
{
half linestep = step(UNITY_SAMPLE_TEX2D(_MainTex, IN.uv_MainTex), _LineThickness + (_VerticalLineCorrection * IN.uv_MainTex.y));
o.Albedo = lerp(UNITY_SAMPLE_TEX2D(_ColourTex, IN.uv_MainTex), half4(0.0, 0.0, 0.0, 1.0), linestep);
o.Alpha = 1.0f;
}
void surf (Input IN, inout SurfaceOutputVRC o)
{
half linestep_sample = UNITY_SAMPLE_TEX2D(_MainTex, IN.uv_MainTex).r;
half linestep_halfchange = (abs(ddx(linestep_sample)) + abs(ddy(linestep_sample))) / 2.0;
half linestep_loweredge = (1.0 - _LineThickness) - linestep_halfchange;
half linestep_upperedge = (1.0 - _LineThickness) + linestep_halfchange;
half linestep_mask = saturate((linestep_sample - linestep_loweredge) / (linestep_upperedge - linestep_loweredge));
o.Albedo = lerp(UNITY_SAMPLE_TEX2D(_ColourTex, IN.uv_MainTex), half4(0.0, 0.0, 0.0, 1.0), linestep_mask);
o.Alpha = 1.0f;
}
inline half3 VRC_SafeNormalize(half3 value)
{
float lenSqr = max((float)dot(value, value), FLOAT_MIN);
return value * (half) rsqrt(lenSqr);
}
inline half3 VRC_SafeNormalize(half3 value)
{
float lenSqr = max((float)dot(value, value), FLOAT_MIN);
return value * (half) rsqrt(lenSqr);
}
inline half shEvaluateDiffuseL1Geomerics(half L0, half3 L1, half3 n)
{
// avg direction of incoming light
half3 R1 = 0.5f * L1;
inline half shEvaluateDiffuseL1Geomerics(half L0, half3 L1, half3 n)
{
// avg direction of incoming light
half3 R1 = 0.5f * L1;
// directional brightness
half lenR1 = length(R1);
// directional brightness
half lenR1 = length(R1);
// linear angle between normal and direction 0-1, saturate fix from filamented
half q = dot(VRC_SafeNormalize(R1), n) * 0.5 + 0.5;
q = isnan(q) ? 1 : q;
q = saturate(q);
// linear angle between normal and direction 0-1, saturate fix from filamented
half q = dot(VRC_SafeNormalize(R1), n) * 0.5 + 0.5;
q = isnan(q) ? 1 : q;
q = saturate(q);
// power for q
// lerps from 1 (linear) to 3 (cubic) based on directionality
//half p = 1.0f + 2.0f * lenR1 / L0;
// power for q
// lerps from 1 (linear) to 3 (cubic) based on directionality
//half p = 1.0f + 2.0f * lenR1 / L0;
// dynamic range constant
// should vary between 4 (highly directional) and 0 (ambient)
//half a = (1.0f - lenR1 / L0) / (1.0f + lenR1 / L0);
// dynamic range constant
// should vary between 4 (highly directional) and 0 (ambient)
//half a = (1.0f - lenR1 / L0) / (1.0f + lenR1 / L0);
// negative ambient fix, if L0 <= 0, return 0
//return (L0 <= 0.f) ? 0.f : (L0 * (a + (1.0f - a) * (p + 1.0f) * pow(q, p)));
// negative ambient fix, if L0 <= 0, return 0
//return (L0 <= 0.f) ? 0.f : (L0 * (a + (1.0f - a) * (p + 1.0f) * pow(q, p)));
// optimized reordering. thanks wolfram
return (L0 <= 0.f) ? 0.f : ( 4. * lenR1 * pow(q, (2 * lenR1) / L0 + 1) + ( L0 * (L0 - lenR1) )/(L0 + lenR1));
}
// optimized reordering. thanks wolfram
return (L0 <= 0.f) ? 0.f : ( 4. * lenR1 * pow(q, (2 * lenR1) / L0 + 1) + ( L0 * (L0 - lenR1) )/(L0 + lenR1));
}
inline UnityGI UnityGI_BaseVRC(UnityGIInput data, half occlusion, half3 normalWorld, half3 eyeVec, half smoothness, half hasReflProbe)
{
UnityGI o_gi;
inline UnityGI UnityGI_BaseVRC(UnityGIInput data, half occlusion, half3 normalWorld, half3 eyeVec, half smoothness, half hasReflProbe)
{
UnityGI o_gi;
// Base pass with Lightmap support is responsible for handling ShadowMask / blending here for performance reason
#if defined(HANDLE_SHADOWS_BLENDING_IN_GI)
half bakedAtten = UnitySampleBakedOcclusion(data.lightmapUV.xy, data.worldPos);
float zDist = dot(_WorldSpaceCameraPos - data.worldPos, UNITY_MATRIX_V[2].xyz);
float fadeDist = UnityComputeShadowFadeDistance(data.worldPos, zDist);
data.atten = UnityMixRealtimeAndBakedShadows(data.atten, bakedAtten, UnityComputeShadowFade(fadeDist));
#endif
// Base pass with Lightmap support is responsible for handling ShadowMask / blending here for performance reason
#if defined(HANDLE_SHADOWS_BLENDING_IN_GI)
half bakedAtten = UnitySampleBakedOcclusion(data.lightmapUV.xy, data.worldPos);
float zDist = dot(_WorldSpaceCameraPos - data.worldPos, UNITY_MATRIX_V[2].xyz);
float fadeDist = UnityComputeShadowFadeDistance(data.worldPos, zDist);
data.atten = UnityMixRealtimeAndBakedShadows(data.atten, bakedAtten, UnityComputeShadowFade(fadeDist));
#endif
o_gi.light = data.light;
o_gi.light.color *= data.atten;
o_gi.light = data.light;
o_gi.light.color *= data.atten;
#if defined(LIGHTMAP_ON)
#if defined(_MONOSH)
BakeryMonoSH(o_gi.indirect.diffuse, o_gi.indirect.specular, data.lightmapUV.xy, normalWorld, eyeVec, smoothness, occlusion);
#else
// Baked lightmaps
#if defined(LIGHTMAP_ON)
#if defined(_MONOSH)
BakeryMonoSH(o_gi.indirect.diffuse, o_gi.indirect.specular, data.lightmapUV.xy, normalWorld, eyeVec, smoothness, occlusion);
#else
// Baked lightmaps
half3 bakedColor = half3(1.0, 1.0, 1.0);
half4 bakedColorTex = UNITY_SAMPLE_TEX2D(unity_Lightmap, data.lightmapUV.xy);
#if defined(FORCE_UNITY_DLDR_LIGHTMAP_ENCODING)
bakedColor = DecodeLightmapDoubleLDR(bakedColorTex, unity_Lightmap_HDR);
#elif defined(FORCE_UNITY_RGBM_LIGHTMAP_ENCODING)
bakedColor = DecodeLightmapRGBM(bakedColorTex, unity_Lightmap_HDR);
#elif defined(FORCE_UNITY_LIGHTMAP_FULL_HDR_ENCODING)
bakedColor = bakedColorTex;
#else
bakedColor = DecodeLightmap(bakedColorTex);
#endif
half3 bakedColor = half3(1.0, 1.0, 1.0);
half4 bakedColorTex = UNITY_SAMPLE_TEX2D(unity_Lightmap, data.lightmapUV.xy);
#if defined(FORCE_UNITY_DLDR_LIGHTMAP_ENCODING)
bakedColor = DecodeLightmapDoubleLDR(bakedColorTex, unity_Lightmap_HDR);
#elif defined(FORCE_UNITY_RGBM_LIGHTMAP_ENCODING)
bakedColor = DecodeLightmapRGBM(bakedColorTex, unity_Lightmap_HDR);
#elif defined(FORCE_UNITY_LIGHTMAP_FULL_HDR_ENCODING)
bakedColor = bakedColorTex;
#else
bakedColor = DecodeLightmap(bakedColorTex);
#endif
// Can be set if the renderer has a valid lightmap but the shader doesn't use it
#if !defined(UNITY_LIGHTMAP_NONE)
#if defined(DIRLIGHTMAP_COMBINED)
fixed4 bakedDirTex = UNITY_SAMPLE_TEX2D_SAMPLER(unity_LightmapInd, unity_Lightmap, data.lightmapUV.xy);
o_gi.indirect.diffuse = DecodeDirectionalLightmap(bakedColor, bakedDirTex, normalWorld);
#else // not directional lightmap
o_gi.indirect.diffuse = bakedColor;
#endif
#else
o_gi.indirect.diffuse = 1;
#endif
// Can be set if the renderer has a valid lightmap but the shader doesn't use it
#if !defined(UNITY_LIGHTMAP_NONE)
#if defined(DIRLIGHTMAP_COMBINED)
fixed4 bakedDirTex = UNITY_SAMPLE_TEX2D_SAMPLER(unity_LightmapInd, unity_Lightmap, data.lightmapUV.xy);
o_gi.indirect.diffuse = DecodeDirectionalLightmap(bakedColor, bakedDirTex, normalWorld);
#else // not directional lightmap
o_gi.indirect.diffuse = bakedColor;
#endif
#else
o_gi.indirect.diffuse = 1;
#endif
o_gi.indirect.specular = 0;
#endif
o_gi.indirect.diffuse *= occlusion;
#elif defined(UNITY_SHOULD_SAMPLE_SH)
o_gi.indirect.diffuse.r = shEvaluateDiffuseL1Geomerics(unity_SHAr.w, unity_SHAr.xyz, normalWorld);
o_gi.indirect.diffuse.g = shEvaluateDiffuseL1Geomerics(unity_SHAg.w, unity_SHAg.xyz, normalWorld);
o_gi.indirect.diffuse.b = shEvaluateDiffuseL1Geomerics(unity_SHAb.w, unity_SHAb.xyz, normalWorld);
o_gi.indirect.specular = 0;
#endif
o_gi.indirect.diffuse *= occlusion;
#elif defined(UNITY_SHOULD_SAMPLE_SH)
o_gi.indirect.diffuse.r = shEvaluateDiffuseL1Geomerics(unity_SHAr.w, unity_SHAr.xyz, normalWorld);
o_gi.indirect.diffuse.g = shEvaluateDiffuseL1Geomerics(unity_SHAg.w, unity_SHAg.xyz, normalWorld);
o_gi.indirect.diffuse.b = shEvaluateDiffuseL1Geomerics(unity_SHAb.w, unity_SHAb.xyz, normalWorld);
#if !defined(_SPECULARHIGHLIGHTS_OFF)
UNITY_BRANCH
#if !defined(_GLOSSYREFLECTIONS_OFF)
if(!any(o_gi.light.color) && !hasReflProbe)
#else
if(!any(o_gi.light.color))
#endif
{
half3 L0rgb = half3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w);
half3x3 L1rgb = half3x3(unity_SHAr.x, unity_SHAg.x, unity_SHAb.x,
unity_SHAr.y, unity_SHAg.y, unity_SHAb.y,
unity_SHAr.z, unity_SHAg.z, unity_SHAb.z);
half3 L1 = unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz;
#if !defined(_SPECULARHIGHLIGHTS_OFF)
UNITY_BRANCH
#if !defined(_GLOSSYREFLECTIONS_OFF)
if(!any(o_gi.light.color) && !hasReflProbe)
#else
if(!any(o_gi.light.color))
#endif
{
half3 L0rgb = half3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w);
half3x3 L1rgb = half3x3(unity_SHAr.x, unity_SHAg.x, unity_SHAb.x,
unity_SHAr.y, unity_SHAg.y, unity_SHAb.y,
unity_SHAr.z, unity_SHAg.z, unity_SHAb.z);
half3 L1 = unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz;
half3 dominantDir = VRC_SafeNormalize(L1);
half3 dominantDir = VRC_SafeNormalize(L1);
// Light can be anywhere from 'fully sparse' to 'completely focused' based on how much of it is L0 or L1rgb.
half L1len = length(L1);
half focus = L1len / (length(L0rgb) + L1len);
half specularTerm = ComputeSpecularGGX(dominantDir, eyeVec, normalWorld, smoothness * focus);
// L0 + L1, the total light energy expected, is the same over the whole mesh. This is a problem with specular highlights
// as they have a second peak in the negative direction - normally hidden by the fact that light energy there is normally zero.
// Multiplying by non-linear diffuse gives satisfactory results, though isn't particularly physically accurate.
// The brightness vs ground truth (a reflection probe) is too low though... closest we can get appears to be
// a dimensionless version, shEvaluateDiffuseL1Geometrics but applied to just the ratio.
half energyFactor = shEvaluateDiffuseL1Normalized(dot(L0rgb, 1), L1, normalWorld);
half3 sh = (L0rgb + mul(dominantDir, L1rgb)) * energyFactor;
o_gi.indirect.specular = max(specularTerm * sh, 0.0);
// Light can be anywhere from 'fully sparse' to 'completely focused' based on how much of it is L0 or L1rgb.
half L1len = length(L1);
half focus = L1len / (length(L0rgb) + L1len);
half specularTerm = ComputeSpecularGGX(dominantDir, eyeVec, normalWorld, smoothness * focus);
// L0 + L1, the total light energy expected, is the same over the whole mesh. This is a problem with specular highlights
// as they have a second peak in the negative direction - normally hidden by the fact that light energy there is normally zero.
// Multiplying by non-linear diffuse gives satisfactory results, though isn't particularly physically accurate.
// The brightness vs ground truth (a reflection probe) is too low though... closest we can get appears to be
// a dimensionless version, shEvaluateDiffuseL1Geometrics but applied to just the ratio.
half energyFactor = shEvaluateDiffuseL1Normalized(dot(L0rgb, 1), L1, normalWorld);
half3 sh = (L0rgb + mul(dominantDir, L1rgb)) * energyFactor;
o_gi.indirect.specular = max(specularTerm * sh, 0.0);
// Reflection Probes use occlusion, direct lights don't. MonoSH and Specular Hack are both somewhere in between,
// so we use focus to split the difference - 1.0 is direct, 0.0 is reflection probe, so we invert.
o_gi.indirect.specular *= LerpOneTo(occlusion, 1 - focus);
}
else
{
o_gi.indirect.specular = 0;
}
#else
o_gi.indirect.specular = 0;
#endif
o_gi.indirect.diffuse += data.ambient;
o_gi.indirect.diffuse *= occlusion;
#else
o_gi.indirect.specular = 0;
o_gi.indirect.diffuse = 0;
#endif
// Reflection Probes use occlusion, direct lights don't. MonoSH and Specular Hack are both somewhere in between,
// so we use focus to split the difference - 1.0 is direct, 0.0 is reflection probe, so we invert.
o_gi.indirect.specular *= LerpOneTo(occlusion, 1 - focus);
}
else
{
o_gi.indirect.specular = 0;
}
#else
o_gi.indirect.specular = 0;
#endif
o_gi.indirect.diffuse += data.ambient;
o_gi.indirect.diffuse *= occlusion;
#else
o_gi.indirect.specular = 0;
o_gi.indirect.diffuse = 0;
#endif
return o_gi;
}
return o_gi;
}
inline fixed4 UnityLambertVRCLight (SurfaceOutputVRC s, UnityLight light)
{
fixed diff = max (0, dot (s.Normal, light.dir));
inline fixed4 UnityLambertVRCLight (SurfaceOutputVRC s, UnityLight light)
{
fixed diff = max (0, dot (s.Normal, light.dir));
fixed4 c;
c.rgb = s.Albedo * light.color * diff;
c.a = s.Alpha;
return c;
}
fixed4 c;
c.rgb = s.Albedo * light.color * diff;
c.a = s.Alpha;
return c;
}
inline fixed4 LightingLambertVRC (SurfaceOutputVRC s, UnityGI gi)
{
fixed4 c;
c = UnityLambertVRCLight (s, gi.light);
inline fixed4 LightingLambertVRC (SurfaceOutputVRC s, UnityGI gi)
{
fixed4 c;
c = UnityLambertVRCLight (s, gi.light);
#if defined(UNITY_LIGHT_FUNCTION_APPLY_INDIRECT)
c.rgb += s.Albedo * gi.indirect.diffuse;
#endif
#if defined(UNITY_LIGHT_FUNCTION_APPLY_INDIRECT)
c.rgb += s.Albedo * gi.indirect.diffuse;
#endif
return c;
}
return c;
}
inline void LightingLambertVRC_GI (
SurfaceOutputVRC s,
UnityGIInput data,
inout UnityGI gi)
{
gi = UnityGI_BaseVRC(data, 1.0, s.Normal, half3(0, 0, 0), half(0), 0);
}
inline void LightingLambertVRC_GI (
SurfaceOutputVRC s,
UnityGIInput data,
inout UnityGI gi)
{
gi = UnityGI_BaseVRC(data, 1.0, s.Normal, half3(0, 0, 0), half(0), 0);
}
ENDCG
}
ENDCG
}
FallBack "Diffuse"
FallBack "Diffuse"
}
-247
View File
@@ -1,247 +0,0 @@
// Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
// Simplified Diffuse shader. Differences from regular Diffuse one:
// - no Main Color
// - fully supports only 1 directional light. Other lights can affect it, but it will be per-vertex/SH.
Shader "Carmen/Maps/SDF Map Dot"
{
Properties
{
_MainTex ("SDF", 2D) = "white" {}
}
SubShader
{
Tags { "Queue"="AlphaTest" "IgnoreProjector"="True" "RenderType"="TransparentCutout" }
LOD 200
CGPROGRAM
#include "UnityCG.cginc"
#include "UnityPBSLighting.cginc"
#define _SPECULARHIGHLIGHTS_OFF
#define _GLOSSYREFLECTIONS_OFF
// Use our squeezed BRDF on mobile
// In general we want FLOAT_MIN to be the smallest value such that (1.0f + FLOAT_MIN) != FLOAT_MIN
#if defined(SHADER_API_MOBILE)
#define VRC_BRDF_PBS BRDF2_VRC_PBS
#define FLOAT_MIN 1e-4
#else
#define VRC_BRDF_PBS UNITY_BRDF_PBS
#define FLOAT_MIN 1e-6
#endif
#pragma target 4.5
#pragma surface surf LambertVRC alphatest:_Cutoff exclude_path:prepass exclude_path:deferred noforwardadd
UNITY_DECLARE_TEX2D(_MainTex);
UNITY_DECLARE_TEX2D(_ColourTex);
struct SurfaceOutputVRC
{
fixed3 Albedo;
fixed3 Normal;
fixed3 Emission;
half Specular;
fixed Gloss;
fixed Alpha;
};
struct Input
{
float2 uv_MainTex;
half4 colour : COLOR;
};
void surf (Input IN, inout SurfaceOutputVRC o)
{
half alphastep = step(UNITY_SAMPLE_TEX2D(_MainTex, IN.uv_MainTex), 0.99);
if (alphastep < 0.5) discard;
half dotstep = step(UNITY_SAMPLE_TEX2D(_MainTex, IN.uv_MainTex), 0.4);
o.Albedo = lerp(half4(1.0, 1.0, 1.0, 1.0), half4(0.8, 0.0, 0.0, 1.0), dotstep);
o.Alpha = alphastep;
o.Gloss = 0.0;
o.Normal = fixed3(0.0, 0.0, 1.0);
}
inline half3 VRC_SafeNormalize(half3 value)
{
float lenSqr = max((float)dot(value, value), FLOAT_MIN);
return value * (half) rsqrt(lenSqr);
}
inline half shEvaluateDiffuseL1Geomerics(half L0, half3 L1, half3 n)
{
// avg direction of incoming light
half3 R1 = 0.5f * L1;
// directional brightness
half lenR1 = length(R1);
// linear angle between normal and direction 0-1, saturate fix from filamented
half q = dot(VRC_SafeNormalize(R1), n) * 0.5 + 0.5;
q = isnan(q) ? 1 : q;
q = saturate(q);
// power for q
// lerps from 1 (linear) to 3 (cubic) based on directionality
//half p = 1.0f + 2.0f * lenR1 / L0;
// dynamic range constant
// should vary between 4 (highly directional) and 0 (ambient)
//half a = (1.0f - lenR1 / L0) / (1.0f + lenR1 / L0);
// negative ambient fix, if L0 <= 0, return 0
//return (L0 <= 0.f) ? 0.f : (L0 * (a + (1.0f - a) * (p + 1.0f) * pow(q, p)));
// optimized reordering. thanks wolfram
return (L0 <= 0.f) ? 0.f : ( 4. * lenR1 * pow(q, (2 * lenR1) / L0 + 1) + ( L0 * (L0 - lenR1) )/(L0 + lenR1));
}
inline UnityGI UnityGI_BaseVRC(UnityGIInput data, half occlusion, half3 normalWorld, half3 eyeVec, half smoothness, half hasReflProbe)
{
UnityGI o_gi;
// Base pass with Lightmap support is responsible for handling ShadowMask / blending here for performance reason
#if defined(HANDLE_SHADOWS_BLENDING_IN_GI)
half bakedAtten = UnitySampleBakedOcclusion(data.lightmapUV.xy, data.worldPos);
float zDist = dot(_WorldSpaceCameraPos - data.worldPos, UNITY_MATRIX_V[2].xyz);
float fadeDist = UnityComputeShadowFadeDistance(data.worldPos, zDist);
data.atten = UnityMixRealtimeAndBakedShadows(data.atten, bakedAtten, UnityComputeShadowFade(fadeDist));
#endif
o_gi.light = data.light;
o_gi.light.color *= data.atten;
#if defined(LIGHTMAP_ON)
#if defined(_MONOSH)
BakeryMonoSH(o_gi.indirect.diffuse, o_gi.indirect.specular, data.lightmapUV.xy, normalWorld, eyeVec, smoothness, occlusion);
#else
// Baked lightmaps
half3 bakedColor = half3(1.0, 1.0, 1.0);
half4 bakedColorTex = UNITY_SAMPLE_TEX2D(unity_Lightmap, data.lightmapUV.xy);
#if defined(FORCE_UNITY_DLDR_LIGHTMAP_ENCODING)
bakedColor = DecodeLightmapDoubleLDR(bakedColorTex, unity_Lightmap_HDR);
#elif defined(FORCE_UNITY_RGBM_LIGHTMAP_ENCODING)
bakedColor = DecodeLightmapRGBM(bakedColorTex, unity_Lightmap_HDR);
#elif defined(FORCE_UNITY_LIGHTMAP_FULL_HDR_ENCODING)
bakedColor = bakedColorTex;
#else
bakedColor = DecodeLightmap(bakedColorTex);
#endif
// Can be set if the renderer has a valid lightmap but the shader doesn't use it
#if !defined(UNITY_LIGHTMAP_NONE)
#if defined(DIRLIGHTMAP_COMBINED)
fixed4 bakedDirTex = UNITY_SAMPLE_TEX2D_SAMPLER(unity_LightmapInd, unity_Lightmap, data.lightmapUV.xy);
o_gi.indirect.diffuse = DecodeDirectionalLightmap(bakedColor, bakedDirTex, normalWorld);
#else // not directional lightmap
o_gi.indirect.diffuse = bakedColor;
#endif
#else
o_gi.indirect.diffuse = 1;
#endif
o_gi.indirect.specular = 0;
#endif
o_gi.indirect.diffuse *= occlusion;
#elif defined(UNITY_SHOULD_SAMPLE_SH)
o_gi.indirect.diffuse.r = shEvaluateDiffuseL1Geomerics(unity_SHAr.w, unity_SHAr.xyz, normalWorld);
o_gi.indirect.diffuse.g = shEvaluateDiffuseL1Geomerics(unity_SHAg.w, unity_SHAg.xyz, normalWorld);
o_gi.indirect.diffuse.b = shEvaluateDiffuseL1Geomerics(unity_SHAb.w, unity_SHAb.xyz, normalWorld);
#if !defined(_SPECULARHIGHLIGHTS_OFF)
UNITY_BRANCH
#if !defined(_GLOSSYREFLECTIONS_OFF)
if(!any(o_gi.light.color) && !hasReflProbe)
#else
if(!any(o_gi.light.color))
#endif
{
half3 L0rgb = half3(unity_SHAr.w, unity_SHAg.w, unity_SHAb.w);
half3x3 L1rgb = half3x3(unity_SHAr.x, unity_SHAg.x, unity_SHAb.x,
unity_SHAr.y, unity_SHAg.y, unity_SHAb.y,
unity_SHAr.z, unity_SHAg.z, unity_SHAb.z);
half3 L1 = unity_SHAr.xyz + unity_SHAg.xyz + unity_SHAb.xyz;
half3 dominantDir = VRC_SafeNormalize(L1);
// Light can be anywhere from 'fully sparse' to 'completely focused' based on how much of it is L0 or L1rgb.
half L1len = length(L1);
half focus = L1len / (length(L0rgb) + L1len);
half specularTerm = ComputeSpecularGGX(dominantDir, eyeVec, normalWorld, smoothness * focus);
// L0 + L1, the total light energy expected, is the same over the whole mesh. This is a problem with specular highlights
// as they have a second peak in the negative direction - normally hidden by the fact that light energy there is normally zero.
// Multiplying by non-linear diffuse gives satisfactory results, though isn't particularly physically accurate.
// The brightness vs ground truth (a reflection probe) is too low though... closest we can get appears to be
// a dimensionless version, shEvaluateDiffuseL1Geometrics but applied to just the ratio.
half energyFactor = shEvaluateDiffuseL1Normalized(dot(L0rgb, 1), L1, normalWorld);
half3 sh = (L0rgb + mul(dominantDir, L1rgb)) * energyFactor;
o_gi.indirect.specular = max(specularTerm * sh, 0.0);
// Reflection Probes use occlusion, direct lights don't. MonoSH and Specular Hack are both somewhere in between,
// so we use focus to split the difference - 1.0 is direct, 0.0 is reflection probe, so we invert.
o_gi.indirect.specular *= LerpOneTo(occlusion, 1 - focus);
}
else
{
o_gi.indirect.specular = 0;
}
#else
o_gi.indirect.specular = 0;
#endif
o_gi.indirect.diffuse += data.ambient;
o_gi.indirect.diffuse *= occlusion;
#else
o_gi.indirect.specular = 0;
o_gi.indirect.diffuse = 0;
#endif
return o_gi;
}
inline fixed4 UnityLambertVRCLight (SurfaceOutputVRC s, UnityLight light)
{
fixed diff = max (0, dot (s.Normal, light.dir));
fixed4 c;
c.rgb = s.Albedo * light.color * diff;
c.a = s.Alpha;
return c;
}
inline fixed4 LightingLambertVRC (SurfaceOutputVRC s, UnityGI gi)
{
fixed4 c;
c = UnityLambertVRCLight (s, gi.light);
#if defined(UNITY_LIGHT_FUNCTION_APPLY_INDIRECT)
c.rgb += s.Albedo * gi.indirect.diffuse;
#endif
return c;
}
inline void LightingLambertVRC_GI (
SurfaceOutputVRC s,
UnityGIInput data,
inout UnityGI gi)
{
gi = UnityGI_BaseVRC(data, 1.0, s.Normal, half3(0, 0, 0), half(0), 0);
}
ENDCG
}
FallBack "Diffuse"
}
+90 -71
View File
@@ -11,101 +11,120 @@
Shader "Carmen/SDF/The Chase"
{
Properties
{
Properties
{
_MainTex ("SDF", 2D) = "white" {}
[ShowAsVector2] _Skew ("Skew", Vector) = (0.0, 0.0, 0.0, 0.0)
[ShowAsVector2] _Skew ("Skew", Vector) = (0.0, 0.0, 0.0, 0.0)
_LeftColour ("Left Colour", Color) = (1.0, 0.0, 0.0, 1.0)
_RightColour ("Right Colour", Color) = (0.0, 0.0, 1.0, 1.0)
_LeftLineColour ("Left Line Colour", Color) = (0.0, 0.0, 0.0, 1.0)
_RightLineColour ("Right Line Colour", Color) = (0.0, 0.0, 0.0, 1.0)
_LeftLineColour ("Left Line Colour", Color) = (0.0, 0.0, 0.0, 1.0)
_RightLineColour ("Right Line Colour", Color) = (0.0, 0.0, 0.0, 1.0)
_LineThickness ("Line Thickness", float) = 0.25
}
SubShader
{
Tags { "Queue"="Overlay" "RenderType"="Opaque" "CanUseSpriteAtlas"="True" }
LOD 200
_TextThickness ("Text Thickness", float) = 0.1
}
SubShader
{
Tags { "Queue"="Overlay" "RenderType"="Transparent" "CanUseSpriteAtlas"="True" }
LOD 200
Pass {
Cull Back
Lighting Off
//ZWrite Off
//ZTest Always
Pass {
Cull Back
Lighting Off
Blend SrcAlpha OneMinusSrcAlpha
ZWrite Off
//ZTest Always
CGPROGRAM
#include "UnityCG.cginc"
CGPROGRAM
#include "UnityCG.cginc"
#pragma target 4.5
#pragma vertex vert
#pragma fragment frag
#pragma vertex vert
#pragma fragment frag
UNITY_DECLARE_TEX2D(_MainTex);
float4 _MainTex_ST;
float4 _MainTex_ST;
half4 _Skew;
half4 _Skew;
half4 _LeftColour;
half4 _RightColour;
half4 _LeftLineColour;
half4 _RightLineColour;
float _LineThickness;
half4 _LeftLineColour;
half4 _RightLineColour;
half _LineThickness;
half _TextThickness;
struct Data
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct Data
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct V2F
{
float4 position : SV_POSITION;
float2 uv : TEXCOORD0;
};
struct V2F
{
float4 position : SV_POSITION;
float2 uv : TEXCOORD0;
};
V2F vert(Data v)
{
V2F o;
V2F vert(Data v)
{
V2F o;
// Skew and scale as needed
float4x4 skewmatrix = float4x4(
1.0, _Skew.x, 0.0, 0.0,
_Skew.y, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0
);
o.position = mul(skewmatrix, v.vertex);
o.position = mul(UNITY_MATRIX_P,
mul(UNITY_MATRIX_MV, float4(0.0, 0.0, 0.0, 1.0))
+ float4(o.position.x, o.position.y, 0.0, 0.0)
* float4(
length(unity_ObjectToWorld._m00_m10_m20),
length(unity_ObjectToWorld._m01_m11_m21),
1.0, 1.0));
// Skew and scale as needed
float4x4 skewmatrix = float4x4(
1.0, _Skew.x, 0.0, 0.0,
_Skew.y, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0
);
o.position = mul(skewmatrix, v.vertex);
o.position = mul(UNITY_MATRIX_P,
mul(UNITY_MATRIX_MV, float4(0.0, 0.0, 0.0, 1.0))
+ float4(o.position.x, o.position.y, 0.0, 0.0)
* float4(
length(unity_ObjectToWorld._m00_m10_m20),
length(unity_ObjectToWorld._m01_m11_m21),
1.0, 1.0));
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
return o;
}
return o;
}
fixed4 frag(V2F i) : SV_TARGET
{
half texsample = UNITY_SAMPLE_TEX2D(_MainTex, i.uv).r;
fixed4 frag(V2F i) : SV_TARGET
{
half sdf_sample = UNITY_SAMPLE_TEX2D(_MainTex, i.uv).r;
half sdf_halfchange = (abs(ddx(sdf_sample)) + abs(ddy(sdf_sample))) / 2.0;
half alphastep = step(texsample, _LineThickness);
if (alphastep < 0.5) discard;
half alphastep_loweredge = (1.0 - _LineThickness) - sdf_halfchange;
half alphastep_upperedge = (1.0 - _LineThickness) + sdf_halfchange;
half alphastep = saturate((sdf_sample - alphastep_loweredge) / (alphastep_upperedge - alphastep_loweredge));
half linestep = step(texsample, 0.1);
half uvrange = i.uv.x % 1.0;
return lerp(
lerp(_LeftLineColour, _RightLineColour, uvrange),
lerp(_LeftColour, _RightColour, uvrange),
linestep);
}
ENDCG
}
}
FallBack "Diffuse"
half textstep_loweredge = (1.0 - _TextThickness) - sdf_halfchange;
half textstep_upperedge = (1.0 - _TextThickness) + sdf_halfchange;
half textstep = saturate((sdf_sample - textstep_loweredge) / (textstep_upperedge - textstep_loweredge));
half uvrange = i.uv.x % 1.0;
half3 outline = lerp(_LeftLineColour.rgb, _RightLineColour.rgb, uvrange);
half3 fill = lerp(_LeftColour.rgb, _RightColour.rgb, uvrange);
return fixed4(lerp(outline, fill, textstep).rgb, alphastep);
//half alphastep = step(texsample, _LineThickness);
//if (alphastep < 0.5) discard;
// half linestep = step(texsample, 0.1);
// half uvrange = i.uv.x % 1.0;
// return lerp(
// lerp(_LeftLineColour, _RightLineColour, uvrange),
// lerp(_LeftColour, _RightColour, uvrange),
// linestep);
}
ENDCG
}
}
FallBack "Diffuse"
}
+1 -1
View File
@@ -1,4 +1,4 @@
Shader "Custom/ScreenNoise"
Shader "Custom/Screen Noise"
{
Properties
{