summaryrefslogtreecommitdiffstats
path: root/pbr.cginc
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2024-11-03 15:35:40 -0800
committeryum <yum.food.vr@gmail.com>2024-11-03 15:35:40 -0800
commit4adbc6dfbf2409f34e11e001db2b434feeeb435f (patch)
treece49b708f24bb0d3d6c76016393af5e7f0ec11a6 /pbr.cginc
parentb7d3cb5d759feab1e44f4cdb01a0c8922bf4f1cb (diff)
Add interleaved gradient noise cutout mode
Based on screen space uvs.
Diffstat (limited to 'pbr.cginc')
-rw-r--r--pbr.cginc19
1 files changed, 4 insertions, 15 deletions
diff --git a/pbr.cginc b/pbr.cginc
index ea15096..68e26e9 100644
--- a/pbr.cginc
+++ b/pbr.cginc
@@ -194,7 +194,8 @@ float4 getLitColor(
// hack while i figure out view-dependent flickering in outlines
bool enable_direct,
float3 diffuse_contrib,
- v2f i)
+ v2f i,
+ ToonerData tdata)
{
float3 specular_tint;
float one_minus_reflectivity;
@@ -387,21 +388,9 @@ float4 getLitColor(
indirect_light).xyz;
#endif
- // TODO optimize this and formalize with parameters
+ // TODO formalize with parameters
// Break up color banding by adding some dithering to shaded color.
- float screen_dither;
- {
- float2 screen_uv;
- {
- float3 full_vec_eye_to_geometry = i.worldPos - _WorldSpaceCameraPos;
- float3 world_dir = normalize(i.worldPos - _WorldSpaceCameraPos);
- float perspective_divide = 1.0 / i.pos.w;
- float perspective_factor = length(full_vec_eye_to_geometry * perspective_divide);
- screen_uv = i.screenPos.xy * perspective_divide;
- }
- uint2 screen_uv_round = floor(screen_uv * _ScreenParams.xy);
- screen_dither = ign(screen_uv_round) * 0.00390625;
- }
+ float screen_dither = ign(tdata.screen_uv_round) * .00390625;
pbr += screen_dither;
#if defined(_CLEARCOAT)