summaryrefslogtreecommitdiffstats
path: root/filamented.cginc
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2025-08-08 19:28:27 -0700
committeryum <yum.food.vr@gmail.com>2025-08-08 19:28:30 -0700
commit42dbd067eb455d4b67d6ae8c57f1cbe4ec7dccfa (patch)
tree7f1ae4fe3b2c921bf38c7f2f6689cbc05180f3f3 /filamented.cginc
parent7cdf39f51b47553af89c3de5b86d33ded4b5cdd2 (diff)
Optimize sh9 implementation
Saves ~20 instructions (572 -> 552).
Diffstat (limited to 'filamented.cginc')
-rw-r--r--filamented.cginc24
1 files changed, 0 insertions, 24 deletions
diff --git a/filamented.cginc b/filamented.cginc
index fb019cb..f6bd67a 100644
--- a/filamented.cginc
+++ b/filamented.cginc
@@ -213,30 +213,6 @@
#include "UnityCG.cginc"
#include "UnityImageBasedLightingMinimal.cginc"
-float normalFiltering(float perceptualRoughness, const float3 worldNormal) {
- // Kaplanyan 2016, "Stable specular highlights"
- // Tokuyoshi 2017, "Error Reduction and Simplification for Shading Anti-Aliasing"
- // Tokuyoshi and Kaplanyan 2019, "Improved Geometric Specular Antialiasing"
-
- // This implementation is meant for deferred rendering in the original paper but
- // we use it in forward rendering as well (as discussed in Tokuyoshi and Kaplanyan
- // 2019). The main reason is that the forward version requires an expensive transform
- // of the half vector by the tangent frame for every light. This is therefore an
- // approximation but it works well enough for our needs and provides an improvement
- // over our original implementation based on Vlachos 2015, "Advanced VR Rendering".
-
- float3 du = ddx(worldNormal);
- float3 dv = ddy(worldNormal);
-
- float variance = _Specular_AA_Variance * (dot(du, du) + dot(dv, dv));
-
- float roughness = perceptualRoughnessToRoughness(perceptualRoughness);
- float kernelRoughness = min(2.0 * variance, _Specular_AA_Threshold);
- float squareRoughness = saturate(roughness * roughness + kernelRoughness);
-
- return roughnessToPerceptualRoughness(sqrt(squareRoughness));
-}
-
half3 Unity_GlossyEnvironment_local (UNITY_ARGS_TEXCUBE(tex), half4 hdr, Unity_GlossyEnvironmentData glossIn)
{
half perceptualRoughness = glossIn.roughness /* perceptualRoughness */ ;