I’m struggling to understand whether light baking is even worth it.
If running my scene on a target platform such as a PC or console, I get up to 70 FPS on average.
This is with all realtime lights and realtime shadows.
Now, with mixed baking mode not currently supported in Unity, I could end up shooting myself in the foot if I start then start changing lights to baked, layers, culling masks, shadows, etc just to support lightbaking.
It is worth lightbaking in this scenario? Should it be left as realtime if I am currently getting good performance?
Not to mention that lightbaking then takes up additional size of the build and time to complete it.
can someone convince me I should still do baked lighting?
Depends on the type of scenes you are presenting. Light Baking only helps performance if it takes the load off from realtime calculations. Lights that never move can be baked to static lightmaps, dynamic lights should still work on top of that. What doesn’t work right now is to have a light cast a static lightmapshadow, while still interacting with dynamic objects.
For me, baked light is more about getting an indirect lighting pass with lightbouncing, ambient occlusion, and light-probe ambient levels to improve visual quality. If I were to make a Doom 3 style game with high-contrast, close-quarters lighting, I might skip lightbaking myself.
Got a screenshot of your game? Then it’s easier to see.
From the unite talk. Direct light pass on the top. Final image with light bouncing below (this might be the realtime enlighten solution, but the point is the same.) If the top image was the look I wanted, I’d just skip the lightbake. But to get the results from the final image, the indirect light has to be included, which you only get from a bake process. Not the best comparison, since this scene seems to be made with indirect light in mind, hence the final result will win on wow-factor. There’s nothing wrong with a dramatic, high contrast lighting however, or other lighting scenarios where only direct lights and maybe an ambient value do the trick.
OK, thanks for the info. It seems with the lightbaking you did, in your scene it is worth it.
here is a screen shot of my current scene, W/O lightbaking:
what I do notice now, is alot of shadow casters (2000) and batches (2500+). That might be problem now that I think about it.
Do you recommend a max amount of batches and shadow casters?
i think you are convincing me to do the light baking (which is what I was hoping someone would do).
The reason that scene improves so much, is because it has almost just one lightsource, shining into a dark big space. Light bouncing will create the whole look in such a scenario by scattering the powerful lightsource around the cave. Your scene seems to be directly lit all over, so indirect light will not have that big of an impact.
Seems like you have a scene with a lot of repeating geometry, have you turned on the static flag on any object that will not move in gameplay? That should reduce the shadowcaster and batches count.
Everything is using batching that can. The batches are reduced about 50% because of it.
I cant really increase performance anymore, unless I switch to quicker shaders (mobile) and do a lightbake (if I decide to do that). I thinking of just doing the light bake for shadow purposes now, then add a separate light for dynamic objects.
No, I suspect you can optimise much more but are choosing not to or do not want to. Atlasing textures, using deferred and reducing unique materials (pbr means one material can do 99% of your game) means that the entire level itself might only take up to 100 draw calls in common indoor scenarios, with dynamic objects taking as many more.
Are you really doing best practises? I don’t see any mention of a profiler so you don’t really have a clue what’s slowing it down do you?
2,500 batches is a lot of CPU time being burned and that’s more time the GPU is sat there idle. Using a mobile shader wouldn’t help, I suspect. But use the profiler and find out.
Some tips which are also available from searching or docs:
use deferred if you use >10 lights
not every object needs to be a shadow caster
atlas textures
use PBS (standard) shader
use static batching and occlusion culling
We have an open world title (worst case scenario) and sit at around 800 batches with a view to 1k being our absolute maximum for PS4 and desktop.
I am probably not doing all the best practices, I have only been doing this for a few months now.
I should have said I do not know how to improve performance anymore, rather than I cant.
But, WHOOPS: The screenshot i posted does not show the performance with Occlusion culling. Here it is with OC:
It is 895 with the OC.
I have done all that you mention except for the atlas texture. Ill have to look into that.
Using the deferred helps greatly with the batches, but the aliasing is horrible. Does the lightbaking help reduce aliasing?
I am using the Unity PBS shader for everything, but in another scene, I switched the fencing out for one of the Mobile bumped diffuse shaders and that reduced the batch count greatly.
I sounds like by what your saying is that even 900 batches for this camera view is too much.