diff options
| author | yum <yum.food.vr@gmail.com> | 2025-02-12 01:24:49 -0800 |
|---|---|---|
| committer | yum <yum.food.vr@gmail.com> | 2025-02-12 01:24:49 -0800 |
| commit | caf02458737f93b20978f41613ad5b56e074e154 (patch) | |
| tree | b7b3c0ab468d858d71f4fa96f2b420b7ad5ab98a /yum_lighting.cginc | |
| parent | 498ffebe9524871e9442e58eb0c3760a5463ffbc (diff) | |
Add a bunch of features
* stereo instancing
* outlines
* shadows (casting & receiving)
* unity fog
* blend modes
* wrapped lighting (generalized half lambertian)
* diffuse & specular have independent knobs
Also:
* fix bug where shadow caster wouldn't clip in cutout mode.
* remove a bunch of unused params
* use ifex to minimize size of locked materials (more to be done
probably)
* improve formatting
Diffstat (limited to 'yum_lighting.cginc')
| -rw-r--r-- | yum_lighting.cginc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/yum_lighting.cginc b/yum_lighting.cginc index d62b95e..ecbc2da 100644 --- a/yum_lighting.cginc +++ b/yum_lighting.cginc @@ -14,6 +14,11 @@ struct YumLighting { float3 diffuse;
float3 specular;
float NoL;
+#if defined(_WRAPPED_LIGHTING)
+ float NoL_wrapped_s; // specular
+ float NoL_wrapped_d; // diffuse
+#endif
+ float attenuation;
};
float getShadowAttenuation(v2f i)
@@ -45,7 +50,7 @@ float getShadowAttenuation(v2f i) float shadow = 1;
attenuation = 1;
#endif
- //attenuation *= lerp(1, shadow, _Shadow_Strength);
+ attenuation *= lerp(1, shadow, _Shadow_Strength);
return attenuation;
}
@@ -119,6 +124,12 @@ YumLighting GetYumLighting(v2f i, YumPbr pbr) { light.specular = getIndirectSpecular(i, pbr, light.view_dir);
light.NoL = saturate(dot(i.normal, light.dir));
+#if defined(_WRAPPED_LIGHTING)
+ light.NoL_wrapped_s = wrapNoL(light.NoL, _Wrap_NoL_Specular_Strength);
+ light.NoL_wrapped_d = wrapNoL(light.NoL, _Wrap_NoL_Diffuse_Strength);
+#endif
+
+ light.attenuation = getShadowAttenuation(i);
return light;
}
|
