Browse Source

Removed the "directional light occluded shadowcaster" -optimization, as it may produce missing light at the far distance when shadow starts to fade.

Lasse Öörni 14 years ago
parent
commit
2f28445d94
2 changed files with 0 additions and 24 deletions
  1. 0 22
      Engine/Graphics/View.cpp
  2. 0 2
      Engine/Graphics/View.h

+ 0 - 22
Engine/Graphics/View.cpp

@@ -435,11 +435,6 @@ void View::GetBatches()
             for (unsigned j = 0; j < litGeometries_.Size(); ++j)
             for (unsigned j = 0; j < litGeometries_.Size(); ++j)
             {
             {
                 Drawable* drawable = litGeometries_[j];
                 Drawable* drawable = litGeometries_[j];
-                // In the occluded & shadowed directional light optimization, we null out pointers instead of removing entries
-                // from the lit geometry vector. Therefore must be prepared for a null pointer
-                if (!drawable)
-                    continue;
-                
                 drawable->AddLight(light);
                 drawable->AddLight(light);
                 
                 
                 // If drawable limits maximum lights, only record the light, and check maximum count / build batches later
                 // If drawable limits maximum lights, only record the light, and check maximum count / build batches later
@@ -763,7 +758,6 @@ unsigned View::ProcessLight(Light* light)
     switch (type)
     switch (type)
     {
     {
     case LIGHT_DIRECTIONAL:
     case LIGHT_DIRECTIONAL:
-        dirLightShadowCasters_.Clear();
         for (unsigned i = 0; i < geometries_.Size(); ++i)
         for (unsigned i = 0; i < geometries_.Size(); ++i)
         {
         {
             if (geometries_[i]->GetLightMask() & light->GetLightMask())
             if (geometries_[i]->GetLightMask() & light->GetLightMask())
@@ -867,10 +861,6 @@ unsigned View::ProcessLight(Light* light)
             OccludedFrustumOctreeQuery query(tempDrawables_, shadowCamera->GetFrustum(), buffer,
             OccludedFrustumOctreeQuery query(tempDrawables_, shadowCamera->GetFrustum(), buffer,
                 DRAWABLE_GEOMETRY, camera_->GetViewMask(), false, true);
                 DRAWABLE_GEOMETRY, camera_->GetViewMask(), false, true);
             octree_->GetDrawables(query);
             octree_->GetDrawables(query);
-            
-            // Store the raw list of possible shadow casters for a later optimization step
-            for (unsigned i = 0; i < tempDrawables_.Size(); ++i)
-                dirLightShadowCasters_.Insert(tempDrawables_[i]);
         }
         }
         
         
         // Check which shadow casters actually contribute to the shadowing
         // Check which shadow casters actually contribute to the shadowing
@@ -884,18 +874,6 @@ unsigned View::ProcessLight(Light* light)
     if (!hasShadowCasters)
     if (!hasShadowCasters)
         shadowSplits = 0;
         shadowSplits = 0;
     
     
-    // For a directional light queried with occlusion, can perform an optimization post-step: if a visible shadow caster has been
-    // rejected due to occlusion, the light does not need to be rendered on it either
-    if (shadowSplits && useOcclusion)
-    {
-        for (unsigned i = 0; i < litGeometries_.Size(); ++i)
-        {
-            Drawable* drawable = litGeometries_[i];
-            if (drawable->GetCastShadows() && !dirLightShadowCasters_.Contains(drawable))
-                litGeometries_[i] = 0;
-        }
-    }
-
     return shadowSplits;
     return shadowSplits;
 }
 }
 
 

+ 0 - 2
Engine/Graphics/View.h

@@ -204,8 +204,6 @@ private:
     PODVector<Light*> lights_;
     PODVector<Light*> lights_;
     /// Drawables that limit their maximum light count.
     /// Drawables that limit their maximum light count.
     HashSet<Drawable*> maxLightsDrawables_;
     HashSet<Drawable*> maxLightsDrawables_;
-    /// Directional light shadow caster drawables.
-    HashSet<Drawable*> dirLightShadowCasters_;
     /// Light queue indices of processed lights.
     /// Light queue indices of processed lights.
     Map<Light*, unsigned> lightQueueIndex_;
     Map<Light*, unsigned> lightQueueIndex_;
     /// View-global shader parameters.
     /// View-global shader parameters.