Browse Source

better shadow bias and radius

Kajetan Johannes Hammerle 3 years ago
parent
commit
633048e3cd
2 changed files with 3 additions and 3 deletions
  1. 1 1
      client/rendering/RenderSettings.cpp
  2. 2 2
      resources/shader/worldFragment.fs

+ 1 - 1
client/rendering/RenderSettings.cpp

@@ -1,5 +1,5 @@
 #include "client/rendering/RenderSettings.h"
 
-RenderSettings::RenderSettings() : ssao(true), shadows(false), testRadius(0.004f), testBias(0.003f), bump(0.5f),
+RenderSettings::RenderSettings() : ssao(true), shadows(true), testRadius(0.01f), testBias(0.0002f), bump(0.5f),
 factor(1), dirtyFactor(false) {
 }

+ 2 - 2
resources/shader/worldFragment.fs

@@ -53,10 +53,10 @@ void main(void) {
 
     if(shadows) {
         vec3 pos = varShadow.xyz / varShadow.w;
-        float fbias = zbias * (1.0 - max(dot(normal, -light), 0.0)); 
+        //float fbias = zbias * (1.0 - max(dot(worldNormal, -light), 0.0)); 
         float shadow = 0.0;
         for(int i = 0; i < sampleAmount; i++) {
-            shadow += float(texture(shadowSamp, pos.xy + samples[i] * radius).r + fbias > pos.z);
+            shadow += float(texture(shadowSamp, pos.xy + samples[i] * radius).r + zbias > pos.z);
         }
         shadow /= sampleAmount;
         worldShadow = shadow;