About Store Forum Documentation Contact
Donations:
309$/mo



Post Reply 
[Solved] Shadow Frustum Bug
Author Message
Pherael Offline
Silver Supporter

Post: #1
[Solved] Shadow Frustum Bug
When I create a lot of Game.Static object in code, I have big performance loss.
I wanted to test it, so I made simple class:

Code:
class StaticTest : Game.Static
{  
   void drawShadow()
   {
     if(mesh)if(Frustum(mesh->box, _matrix_scaled))
      {
      MaterialLock=material(); mesh->drawShadow(_matrix_scaled);
      help++; // !!!! counting number of drawn shadow
      MaterialLock=NULL      ;
      }
   }
  
}

This is result:
[Image: 6vxh.png]

As you see ther is only several bush on screen, but engine call mesh->drawShadow for about 9000 object.

When I do the same for drawPrepare(), number of drawn object was correct.
(This post was last modified: 10-19-2013 04:12 PM by Pherael.)
10-19-2013 11:23 AM
Find all posts by this user Quote this message in a reply
Zervox Offline
Silver Supporter

Post: #2
RE: Shadow Frustum Bug
I've mentioned this before,Working as intended is what I was told on that occasion, look at your screenshot and see the direction shadows are facing affects this, you will always draw shadows no matter how small they are as long as you are in the sun's shadow cast direction. Also the frustum check is commented in the second code, meaning it won't cull any shadows under any circumstances so the code isn't at all the same to the first snippet in that regard.

if you move towards your sun and are looking down you will see shadow counts will decrease and in most cases while moving away from it, it will increase the more objects you pass by.
(This post was last modified: 10-19-2013 03:39 PM by Zervox.)
10-19-2013 03:38 PM
Find all posts by this user Quote this message in a reply
Pherael Offline
Silver Supporter

Post: #3
RE: [Solved] Shadow Frustum Bug
Ok, thank you Zervox, still the number of drawn shadow scary me, I think I'll found other method than Frustrum for shadows.
10-19-2013 04:14 PM
Find all posts by this user Quote this message in a reply
dylantan Offline
Member

Post: #4
RE: [Solved] Shadow Frustum Bug
What did you find Pherael? Mind sharing your solution?
10-20-2013 11:18 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Pherael Offline
Silver Supporter

Post: #5
RE: [Solved] Shadow Frustum Bug
Yeah, I have workaround solution, but I don't think it would be usefull for others games much. Since my game is almost topview, I just crop drawn shadows to large box(little larger than viewed area) centered on my team. Mayby I will end with something diferent in future, but now I have more important priorities.
10-20-2013 12:29 PM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #6
RE: [Solved] Shadow Frustum Bug
If you want you could send me the project I'll double check this scene if everything is working as it should.
10-20-2013 06:24 PM
Find all posts by this user Quote this message in a reply
Pherael Offline
Silver Supporter

Post: #7
RE: [Solved] Shadow Frustum Bug
Sorry for late response,
thank you Esenthel for your offer, but I combine my method and frustum and got pretty good performance, so it's ok.
10-21-2013 06:46 PM
Find all posts by this user Quote this message in a reply
Post Reply