From 3cd04b74b730106e8ed29d737aa926b284dfe853 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Thu, 25 Jun 2026 08:33:52 +0200 Subject: [PATCH] Rename `BRDF` visibility functions prefix to `V_` from `Vis_` --- Source/Engine/Renderer/Config.h | 2 +- Source/Engine/Renderer/ReflectionsPass.cpp | 16 ++++++++-------- Source/Shaders/BRDF.hlsl | 8 ++++---- Source/Shaders/Lighting.hlsl | 2 +- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Source/Engine/Renderer/Config.h b/Source/Engine/Renderer/Config.h index f4885e366..60d95cd36 100644 --- a/Source/Engine/Renderer/Config.h +++ b/Source/Engine/Renderer/Config.h @@ -102,7 +102,7 @@ GPU_CB_STRUCT(ShaderEnvProbeData { Float4 Data2; }); -// Minimum roughness value used for shading (prevent 0 roughness which causes NaNs in Vis_SmithJointApprox) +// Minimum roughness value used for shading (prevent 0 roughness which causes NaNs in V_SmithJointApprox) #define MIN_ROUGHNESS 0.04f // Maximum amount of directional light cascades (using CSM technique) diff --git a/Source/Engine/Renderer/ReflectionsPass.cpp b/Source/Engine/Renderer/ReflectionsPass.cpp index cf2e516b1..c58f60053 100644 --- a/Source/Engine/Renderer/ReflectionsPass.cpp +++ b/Source/Engine/Renderer/ReflectionsPass.cpp @@ -61,12 +61,12 @@ namespace PreIntegratedGF return Float3(sinTheta * cosf(phi), sinTheta * sinf(phi), cosTheta); } - float Vis_SmithJointApprox(float roughness, float NoV, float NoL) + float V_SmithJointApprox(float roughness, float NoV, float NoL) { float a = roughness * roughness; - float Vis_SmithV = NoL * (NoV * (1 - a) + a); - float Vis_SmithL = NoV * (NoL * (1 - a) + a); - return 0.5f / (Vis_SmithV + Vis_SmithL); + float V_SmithV = NoL * (NoV * (1 - a) + a); + float V_SmithL = NoV * (NoL * (1 - a) + a); + return 0.5f / (V_SmithV + V_SmithL); } Float2 IntegrateBRDF(float roughness, float NoV) @@ -87,12 +87,12 @@ namespace PreIntegratedGF if (NoL > 0) { - float Vis = Vis_SmithJointApprox(roughness, NoV, NoL); - float NoL_Vis_PDF = NoL * Vis * (4 * VoH / NoH); + float Vis = V_SmithJointApprox(roughness, NoV, NoL); + float NoL_V_PDF = NoL * Vis * (4 * VoH / NoH); float Fc = powf(1 - VoH, 5); - a += NoL_Vis_PDF * (1 - Fc); - b += NoL_Vis_PDF * Fc; + a += NoL_V_PDF * (1 - Fc); + b += NoL_V_PDF * Fc; } } return Float2(a, b) / (float)NumSamples; diff --git a/Source/Shaders/BRDF.hlsl b/Source/Shaders/BRDF.hlsl index 37aa36e42..e637422c2 100644 --- a/Source/Shaders/BRDF.hlsl +++ b/Source/Shaders/BRDF.hlsl @@ -20,9 +20,9 @@ float D_GGX(float roughness, float NoH) return a2 / (PI * d * d); } -// Tuned to match behavior of Vis_Smith +// Tuned to match behavior of V_Smith // [Schlick 1994, "An Inexpensive BRDF Model for Physically-Based Rendering"] -float Vis_Schlick(float roughness, float NoV, float NoL) +float V_Schlick(float roughness, float NoV, float NoL) { float k = Square(roughness) * 0.5; float visSchlickV = NoV * (1 - k) + k; @@ -32,7 +32,7 @@ float Vis_Schlick(float roughness, float NoV, float NoL) // Smith term for GGX // [Smith 1967, "Geometrical shadowing of a random rough surface"] -float Vis_Smith(float roughness, float NoV, float NoL) +float V_Smith(float roughness, float NoV, float NoL) { float a = Square(roughness); float a2 = a * a; @@ -43,7 +43,7 @@ float Vis_Smith(float roughness, float NoV, float NoL) // Appoximation of joint Smith term for GGX // [Heitz 2014, "Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs"] -float Vis_SmithJointApprox(float roughness, float NoV, float NoL) +float V_SmithJointApprox(float roughness, float NoV, float NoL) { float a = Square(roughness); float visSmithV = NoL * (NoV * (1 - a) + a); diff --git a/Source/Shaders/Lighting.hlsl b/Source/Shaders/Lighting.hlsl index 656696a3e..7965a95e8 100644 --- a/Source/Shaders/Lighting.hlsl +++ b/Source/Shaders/Lighting.hlsl @@ -35,7 +35,7 @@ LightSample StandardShading(GBufferSample gBuffer, float energy, float3 L, float float3 specularColor = GetSpecularColor(gBuffer); float3 F = F_Schlick(specularColor, VoH); float D = D_GGX(gBuffer.Roughness, NoH) * energy; - float Vis = Vis_SmithJointApprox(gBuffer.Roughness, NoV, NoL); + float Vis = V_SmithJointApprox(gBuffer.Roughness, NoV, NoL); // TODO: apply energy compensation to specular (1.0 + specularColor * (1.0 / PreIntegratedGF.y - 1.0)) lighting.Specular = (D * Vis) * F; #endif