summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--2ner.shader7
-rw-r--r--features.cginc3
-rw-r--r--filamented.cginc82
-rw-r--r--yum_lighting.cginc5
4 files changed, 0 insertions, 97 deletions
diff --git a/2ner.shader b/2ner.shader
index dbf4d2e..ace35f9 100644
--- a/2ner.shader
+++ b/2ner.shader
@@ -36,13 +36,6 @@ Shader "yum_food/2ner"
_OcclusionMap("Ambient occlusion", 2D) = "white" {}
_OcclusionStrength("Ambient occlusion", Range(0,1)) = 1
_Clip("Alpha Cuttoff", Range(0, 1.001)) = 0.5
- //ifex _Bump_Shadows_Enabled==0
- [HideInInspector] m_start_BumpShadows("Normal shadows", Float) = 0
- [ThryToggle(_BUMP_SHADOWS)]_Bump_Shadows_Enabled("Enable", Float) = 0
- _BumpShadowHeightScale("Height", Range(0, 1)) = 0.2
- _BumpShadowHardness("Hardness", Range(0, 100)) = 50
- [HideInInspector] m_end_BumpShadows("Metallics", Float) = 0
- //endex
[HideInInspector] m_reflectionOptions("Reflections", Float) = 0
[HideInInspector] m_start_Metallic("Metallics", Float) = 0
diff --git a/features.cginc b/features.cginc
index ab02784..5040db0 100644
--- a/features.cginc
+++ b/features.cginc
@@ -7,9 +7,6 @@
//ifex _Outline_Mask_Enabled==0
#pragma shader_feature_local _OUTLINE_MASK
//endex
-//ifex _Bump_Shadows_Enabled==0
-#pragma shader_feature_local _BUMP_SHADOWS
-//endex
#endif // __FEATURES_INC
diff --git a/filamented.cginc b/filamented.cginc
index b2f2ddb..9edfca5 100644
--- a/filamented.cginc
+++ b/filamented.cginc
@@ -396,87 +396,5 @@ float noiseR2(float2 pixel) {
return frac(a1 * float(pixel.x) + a2 * float(pixel.y));
}
-#if defined(_BUMP_SHADOWS)
-struct NormalMapShadowsParam
-{
- float4 uv;
- float2 dX;
- float2 dY;
-};
-
-NormalMapShadowsParam InitNormalMapShadowsParam(float4 uv)
-{
- NormalMapShadowsParam nms;
-
- nms.uv = uv;
- nms.dX = ddx(uv.xy);
- nms.dY = ddy(uv.xy);
-
- return nms;
-}
-
-// Ref: Normal Mapping Shadows by Boris Vorontsov
-// Please define a NormalMapShadowsParam parameter
-// and SampleNormalMap function to sample the normal map.
-float NormalMapShadows (float3 lightDirTangent, NormalMapShadowsParam nmsParam, float noise,
- float heightScale, float shadowHardness)
-{
- const float screenShadowSamples = 20;
- const float hardness = heightScale * shadowHardness;
- const float sampleStep = 1.0 / screenShadowSamples;
-
- float2 dir = lightDirTangent.xy * heightScale;
-
- // Redundancy can't be helped
- float3 normal = UnpackScaleNormal(tex2D(_BumpMap, nmsParam.uv), _BumpScale);
-
- lightDirTangent = normalize(lightDirTangent);
- float tangentNdotL = saturate(dot(lightDirTangent, normal));
-
- float currentSample = sampleStep - sampleStep * noise;
-
- // Skip on backfaces
- currentSample += (tangentNdotL <= 0.0);
-
- /*
- From the PDF:
- Trace from hit point to light direction and compute sum of dot products
- between normal map and light direction.
- If slope is bigger than 0, pixel is shadowed. If slope is also bigger
- than previous maximal value, increase hardness of shadow.
- */
-
- float result = 0;
- float slope = -tangentNdotL;
- float maxslope = 0.0;
- for (uint i = 0; i < 1; i++)
- {
- normal = UnpackScaleNormal(tex2D(_BumpMap, nmsParam.uv + dir * currentSample), _BumpScale);
- tangentNdotL = dot(lightDirTangent, normal);
- slope = slope - tangentNdotL;
- if (slope > maxslope)
- {
- result += hardness * (1.0-currentSample);
- }
- maxslope = max(maxslope, slope);
- currentSample += sampleStep;
- if (currentSample <= 1.0) {
- break;
- }
- }
-
- return result * sampleStep;
-}
-
-float NormalTangentShadow(float4 texcoords, half3 lightDirTS, float noise)
-{
- float _HeightScale = _BumpShadowHeightScale;
- float _ShadowHardness = _BumpShadowHardness;
- NormalMapShadowsParam nms = InitNormalMapShadowsParam(texcoords);
- nms.uv = texcoords;
- return NormalMapShadows(lightDirTS, nms, noise, _HeightScale, _ShadowHardness);
-}
-#endif // _BUMP_SHADOWS
-
#endif
diff --git a/yum_lighting.cginc b/yum_lighting.cginc
index 6cca5e2..4022764 100644
--- a/yum_lighting.cginc
+++ b/yum_lighting.cginc
@@ -132,11 +132,6 @@ YumLighting GetYumLighting(v2f i, YumPbr pbr) {
#endif
light.attenuation = getShadowAttenuation(i);
-#if defined(_BUMP_SHADOWS)
- float noise = noiseR2(i.pos.xy);
- float nm_shade = NormalTangentShadow(i.uv01, i.lightDirTS, noise);
- light.attenuation = min(light.attenuation, max(1-nm_shade, 0));
-#endif
return light;
}