- Home /
bake shadows in real time on mobile platforms
Is it possible to bake shadows in real time, in the small area , without lag spikes, all that on mobile platforms ?
Because currently I am creating an infinity runner game , and 60 fps is required. I am using 1 directional light , low shadow resolution and shadow distance of 20. Still i get only 25-45 fps on Samsung Galaxy S4, while without shadows I get solid 60 fps. I generate level in small portions or chunks of size 20x10 meters. At any given time there are 5 chunks loaded, and shadows are visible on 2 of them.
In the image you can see the size of the area I want to cover with shadows (2 chunks) and i want to bake those shadows at runtime , if it can increase perfomance.
Once again i'd want to do that at runtime , but I am not sure if it is even possible , if so , maybe it's possible to add ambient occlusion as well , I believe it would make game better as well.
By definition, anything "baked" is not calculated at runtime - the act of shadow baking means that a shadowmap of any static objects is calculated at compile time and saved so that shadows can be drawn by the shader based on a simple texture read. But, if you're creating your levels dynamically at runtime, this isn't an option.
Ok , I get the point , but maybe somehow i can calculate those shadows only once, since mostly everything is static, ins$$anonymous$$d of calculating dynamically every frame ? that was the idea , maybe not clearly defined :)