From 76c622b731e96f560733f31d327e702cd6b59c3e Mon Sep 17 00:00:00 2001
From: D-AIRY <admin@ds-servers.com>
Date: Thu, 9 Apr 2020 05:10:28 +0300
Subject: [PATCH] Bias fix for pointlights

---
 build/engine/shaders/ppgensm/ppgensm_point.ps | 1 +
 1 file changed, 1 insertion(+)

diff --git a/build/engine/shaders/ppgensm/ppgensm_point.ps b/build/engine/shaders/ppgensm/ppgensm_point.ps
index 9a5e602d8..c8ada90ef 100644
--- a/build/engine/shaders/ppgensm/ppgensm_point.ps
+++ b/build/engine/shaders/ppgensm/ppgensm_point.ps
@@ -102,6 +102,7 @@ float4 main(VSO_ResPos IN):COLOR0
 	float fBiasZ = (lf - fDepthLightZ * (lf - ln)) * (lf - fDepthLightZ * (lf - ln)) / (lf * ln * (lf - ln)) * lf * 0.0008f * fScaleFactor - fBias0;
 	
 	// float fD = g_vPixelSizeBias.x * 0.5f * fDistance / g_vLightColorPower.w;
+	fBias = sqrt(1.0f / (cosTheta * cosTheta) - 1.0f);
 	// fBias = fD * sqrt(1.0f / (cosTheta * cosTheta) - 1.0f);
 	// float fCompareTo = fDistance - fBias * 200.0f;
 	float fCompareTo = fDistance - fBias;
-- 
GitLab