瀏覽代碼

remove shadow bias for vsm

Xavier Maupeu 10 年之前
父節點
當前提交
0567cbeaf4
共有 1 個文件被更改,包括 5 次插入3 次删除
  1. 5 3
      Source/Urho3D/Graphics/View.cpp

+ 5 - 3
Source/Urho3D/Graphics/View.cpp

@@ -2950,6 +2950,9 @@ void View::RenderShadowMap(const LightBatchQueue& queue)
     graphics_->SetClipPlane(false);
     graphics_->SetClipPlane(false);
     graphics_->SetStencilTest(false);
     graphics_->SetStencilTest(false);
 
 
+    // Set shadow depth bias
+    BiasParameters parameters = queue.light_->GetShadowBias();
+
     // the shadow map is a depth stencil map
     // the shadow map is a depth stencil map
     if (shadowMap->GetUsage() == TEXTURE_DEPTHSTENCIL)
     if (shadowMap->GetUsage() == TEXTURE_DEPTHSTENCIL)
     {
     {
@@ -2966,15 +2969,14 @@ void View::RenderShadowMap(const LightBatchQueue& queue)
         graphics_->SetDepthStencil(shadowMap->GetRenderSurface()->GetLinkedDepthStencil());
         graphics_->SetDepthStencil(shadowMap->GetRenderSurface()->GetLinkedDepthStencil());
         graphics_->SetViewport(IntRect(0, 0, shadowMap->GetWidth(), shadowMap->GetHeight()));
         graphics_->SetViewport(IntRect(0, 0, shadowMap->GetWidth(), shadowMap->GetHeight()));
         graphics_->Clear(CLEAR_DEPTH | CLEAR_COLOR, Color::WHITE);
         graphics_->Clear(CLEAR_DEPTH | CLEAR_COLOR, Color::WHITE);
+
+        parameters = BiasParameters(0.0f, 0.0f);
     }
     }
 
 
     // disable other render targets
     // disable other render targets
     for (unsigned i = 1; i < MAX_RENDERTARGETS; ++i)
     for (unsigned i = 1; i < MAX_RENDERTARGETS; ++i)
         graphics_->SetRenderTarget(i, (RenderSurface*) 0);
         graphics_->SetRenderTarget(i, (RenderSurface*) 0);
 
 
-    // Set shadow depth bias
-    const BiasParameters& parameters = queue.light_->GetShadowBias();
-
     // Render each of the splits
     // Render each of the splits
     for (unsigned i = 0; i < queue.shadowSplits_.Size(); ++i)
     for (unsigned i = 0; i < queue.shadowSplits_.Size(); ++i)
     {
     {