From 79e95c1ced341d0b7db7c2fb3a5c6c2ce623a265 Mon Sep 17 00:00:00 2001 From: yum Date: Sun, 23 Jun 2024 13:50:19 -0700 Subject: Add gimmicks folder Catch-all bag for some nascent research. Zero cost if unused. Also organize all shader-side keywords into a single .cginc. --- tooner_lighting.cginc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tooner_lighting.cginc') diff --git a/tooner_lighting.cginc b/tooner_lighting.cginc index 2a8a75d..ab90525 100644 --- a/tooner_lighting.cginc +++ b/tooner_lighting.cginc @@ -885,9 +885,32 @@ float4 effect(inout v2f i) float ao = 1; #endif +#if defined(_GIMMICK_FLAT_COLOR) + if (round(_Gimmick_Flat_Color_Enable_Dynamic)) { + albedo = _Gimmick_Flat_Color_Color; + normal = i.normal; + } +#endif + float4 lit = getLitColor(vertex_light_color, albedo, i.worldPos, normal, metallic, 1.0 - roughness, i.uv, ao, i); +#if defined(_GIMMICK_FLAT_COLOR) + if (round(_Gimmick_Flat_Color_Enable_Dynamic)) { +#if defined(_RENDERING_CUTOUT) +#if defined(_RENDERING_CUTOUT_STOCHASTIC) + float ar = rand2(i.uv); + clip(albedo.a - ar); +#else + clip(albedo.a - _Alpha_Cutoff); +#endif + albedo.a = 1; +#endif + + return float4(lit.rgb + _Gimmick_Flat_Color_Emission, albedo.a); + } +#endif + float4 result = lit; #if defined(_MATCAP0) || defined(_MATCAP1) || defined(_RIM_LIGHTING0) || defined(_RIM_LIGHTING1) result.rgb += matcap_emission; -- cgit v1.2.3