summaryrefslogtreecommitdiffstats
path: root/filamented.cginc
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2025-06-15 21:25:07 -0700
committeryum <yum.food.vr@gmail.com>2025-06-15 21:25:07 -0700
commit43edeb7da548690b26ed9e73226e83eb073ff430 (patch)
tree284772aca5214462f5a7c74406338058af93f7e3 /filamented.cginc
parent478cb4e07622488915132c8de2f52dc5c19bb6c0 (diff)
brdf tweaks
Diffstat (limited to 'filamented.cginc')
-rw-r--r--filamented.cginc27
1 files changed, 27 insertions, 0 deletions
diff --git a/filamented.cginc b/filamented.cginc
index 1b53e2b..dda261d 100644
--- a/filamented.cginc
+++ b/filamented.cginc
@@ -877,6 +877,33 @@ float F_Schlick(float f0, float VoH) {
return f0 + (1.0 - f0) * pow5(1.0 - VoH);
}
+float F_Schlick(float f0, float f90, float VoH) {
+ // Schlick 1994, "An Inexpensive BRDF Model for Physically-Based Rendering"
+ return f0 + (f90 - f0) * pow5(1.0 - VoH);
+}
+
+float3 F_Schlick(const float3 f0, float VoH) {
+ float f = pow5(1.0 - VoH);
+ return f + f0 * (1.0 - f);
+}
+
+float3 F_Schlick(const float3 f0, float f90, float VoH) {
+ // Schlick 1994, "An Inexpensive BRDF Model for Physically-Based Rendering"
+ return f0 + (f90 - f0) * pow5(1.0 - VoH);
+}
+
+float Fd_Lambert() {
+ return 1.0 / PI;
+}
+
+float Fd_Burley(float roughness, float NoV, float NoL, float LoH) {
+ // Burley 2012, "Physically-Based Shading at Disney"
+ float f90 = 0.5 + 2.0 * roughness * LoH * LoH;
+ float lightScatter = F_Schlick(1.0, f90, NoL);
+ float viewScatter = F_Schlick(1.0, f90, NoV);
+ return lightScatter * viewScatter * (1.0 / PI);
+}
+
float V_SmithGGXCorrelated(float roughness, float NoV, float NoL) {
// Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"
float a2 = roughness * roughness;