Another way to make shadows

I use realtime shadows but it is costly with performance, about 14 fps I set it up so i can toggle it but on my system but it slows the fps whether it is in the scene or not. I am sure that is not true of all systems. I would like to make shadows a different way if possible but not that easy to do what i need. My objects are swimming so i need the shadows to move along an uneven ground and if there are rocks in the scene the shadows would have to crawl on rocks as well. Parenting a plane would not work, at least i don’t see how. is there another way?

digiman

I don’t know how you’re adding and removing the spotlight from the scene, but there is probably a better method that won’t reduce the fps when it’s not in the game.

As for other methods, spotlight is probably the most efficient way.

I am ading the spotlight by using an empty then when i don’t want ti in the scene I delete it and so on. I am using an exp so i can only add one light
I would like to see if someone has a different idea on creating a shadow that won’t slow fps

digiman

As I understand it the lights are compiled into the shader when You load a scene, so turning lights of or removing them later don’t help much. But i think that if You use libLoad to import the light to Your scene and only import the light casting shadows if the player have shadows on in Your games setting, and You import another light without shadows else - then You will get full performance benefit from turning shadows of.

If the player change the setting they probably have to restart the game for it to take effect (performance wise). Maybe end the scene and then reload it can work to.

Update: when importing a new light the BGE kind of have to recompile the shader… So if You remove the light with shadows and import a new one without shadows it might do… but then I don’t really know if You can dynamically load light…

In the worst case You need to make two completely different scenes for shadows and no shadows. But You should be able to use group instancing / libLoad to import the same content in to the different scenes.

I’ve never been able to use buffer shadows to any extent because I can’t seem to increase the resolution of the shadow. I’ve played around with the settings but nothing seems to increase the size of the shadow. Plus GLSL is incredibly slow. Sorry if I hijacked the topic.

To increase the resolution, increase the buffer size in increments of 2 (I think) - for example, 256, 512, 1024, and 2048 are valid shadow buffer sizes.
While the screenshot below is of 2.49, the settings still correspond to 2.5.


I have also heard You should always use power of 2, but funny enough the default is not a power of 2.

I believe the default also doesn’t work on my graphics card - I always have to change it to a power of two. 512 is poor quality, but it works - from there, 1024 (pretty good, I think), 2048, etc.

Something I noticed with spotlights is that if you reduce the bias the shadow quality improves but it becomes more resource intensive. So the opposite should be true and you may be able to find a balance between reasonable quality and decent performance.