summaryrefslogtreecommitdiffstats
path: root/tooner_lighting.cginc
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2024-05-22 15:51:37 -0700
committeryum <yum.food.vr@gmail.com>2024-05-22 15:51:37 -0700
commit72a4f411ff04375caffebc557592b98bcf700ae1 (patch)
tree9fee16abe57a0722cdeaae810fa6d27bd1020331 /tooner_lighting.cginc
parente8fd83bb9d9fb42d122229a9fd1a04514908e146 (diff)
Add stochastic cutout rendering mode
Use a randomized threshold instead of a static one when rendering transparency in cutout mode. This lets us render things like fabrics. Requires UVs to work properly.
Diffstat (limited to 'tooner_lighting.cginc')
-rw-r--r--tooner_lighting.cginc7
1 files changed, 3 insertions, 4 deletions
diff --git a/tooner_lighting.cginc b/tooner_lighting.cginc
index 0b054f2..787b911 100644
--- a/tooner_lighting.cginc
+++ b/tooner_lighting.cginc
@@ -412,10 +412,9 @@ float4 effect(inout v2f i)
#endif
#if defined(_RENDERING_CUTOUT)
-#if 0
- if (albedo.a < _Alpha_Cutoff) {
- discard;
- }
+#if defined(_RENDERING_CUTOUT_STOCHASTIC)
+ float ar = rand2(i.uv);
+ clip(albedo.a - ar);
#else
clip(albedo.a - _Alpha_Cutoff);
#endif