summaryrefslogtreecommitdiffstats
path: root/tooner_lighting.cginc
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2025-01-22 21:04:34 -0800
committeryum <yum.food.vr@gmail.com>2025-01-22 21:04:34 -0800
commit358c53eb9ffae8da890fdc7ff10952bf3958819d (patch)
tree1c018d628ebb1975957b831327736766272c61ed /tooner_lighting.cginc
parent4ec13bd7513f29e16ab22b7ffe7d06724c92a912 (diff)
Add some options to ds2_11 (terrain gimmick)
Also chase down the weird clearcoat bug.
Diffstat (limited to 'tooner_lighting.cginc')
-rw-r--r--tooner_lighting.cginc27
1 files changed, 23 insertions, 4 deletions
diff --git a/tooner_lighting.cginc b/tooner_lighting.cginc
index 0a2139c..f8c3b52 100644
--- a/tooner_lighting.cginc
+++ b/tooner_lighting.cginc
@@ -669,6 +669,7 @@ void applyDecalImpl(
float2 d0_uv =
((get_uv_by_channel(i, p.uv_select) - 0.5) - p.tex_st.zw) * p.tex_st.xy + 0.5;
+ [branch]
if (abs(p.angle) > 1E-6) {
float theta = p.angle * 2.0 * 3.14159265;
float2x2 rot = float2x2(
@@ -679,6 +680,7 @@ void applyDecalImpl(
d0_uv = (p.tiling_mode == 0) ? saturate(d0_uv) : d0_uv;
float d0_uv_fwidth = -1;
+ [branch]
if (p.domain_warping) {
p.domain_warping_octaves = min(p.domain_warping_octaves, 10);
for (uint ii = 0; ii < p.domain_warping_octaves; ii++) {
@@ -690,6 +692,7 @@ void applyDecalImpl(
}
float4 d0_c = 0;
+ [branch]
if (p.base_color_mode == 0) {
d0_c = p.tex.SampleBias(
linear_repeat_s,
@@ -2214,11 +2217,15 @@ float4 effect(inout v2f i, out float depth)
#endif
float3 diffuse_contrib = 0;
-#if defined(_GIMMICK_FOG_01)
- if (!round(_Gimmick_Fog_01_Overlay_Mode)) {
+ // TODO restore this
+ // For some dumb fucking dipshit reason, this is incompatible with clearcoat
+ // in worlds. Probably the compiler optimizer shitting the bed.
+#if 0 && defined(_GIMMICK_FOG_01)
+ [branch]
+ if (!_Gimmick_Fog_01_Overlay_Mode) {
Fog01PBR fog_01_pbr = getFog01(i, tdata);
albedo = fog_01_pbr.albedo;
- depth = fog_01_pbr.depth;
+ //depth = fog_01_pbr.depth;
#if defined(_RENDERING_TRANSPARENT) || defined(_RENDERING_TRANSCLIPPING)
albedo.rgb *= albedo.a;
#endif
@@ -2288,7 +2295,8 @@ float4 effect(inout v2f i, out float depth)
#endif
#if defined(_GIMMICK_FOG_01)
- if (round(_Gimmick_Fog_01_Overlay_Mode)) {
+ [branch]
+ if (_Gimmick_Fog_01_Overlay_Mode) {
float4 fog_color = apply_fog(
length(i.worldPos.xyz - getCenterCamPos()),
_Gimmick_Fog_01_Density,
@@ -2359,6 +2367,17 @@ float4 effect(inout v2f i, out float depth)
return result;
}
+fixed4 frag_debug(v2f i)
+{
+ float3 view_dir = normalize(_WorldSpaceCameraPos - i.worldPos);
+ float3 indirect_specular = getIndirectSpecular(i, view_dir, i.normal,
+ /*smoothness=*/1, /*metallic=*/0, i.worldPos);
+ const float3 l = reflect(-view_dir, i.normal);
+ const float3 h = normalize(l + view_dir);
+ const float NoH = dot(i.normal, h);
+ return float4(saturate(NoH) * indirect_specular, 1);
+}
+
fixed4 frag(v2f i
#if defined(EXPERIMENT__CUSTOM_DEPTH)
, out float depth: SV_DepthGreaterEqual