Looking For Tips On Optimizing Camera Rendering To Increase Framerate
I am trying to get a better frame rate for my scene.
So a little background...
I have been working on this area for a bit now and I really haven't gotten this where I like it. I am trying to optimize this area to run at minimun 30 fps or above. So far its really just 22+. According to the profiler it looks like my lighting is killing me, no surprise there since I have a lot of lights in this scene.
When I try to lightmap my scene just the floors take like 15 minutes. Each wall I add after that adds an additional 5 minutes. So one tiny room would take me 2+ hours. That's crazy to me.
The other issue I have is cloth physics which tends to take up a lot of time.
Here are the things I have done to try and get a better frame rate.
Everything in my area is using LOD's
All of my lights are set to "baked" or "mixed" with light probe groups
Everything is using either the standard shader or specular shader with Rendering Mode set to "Opaque"
I have bake Occlusion Culling
Everything in my scene is set to static (Is there something else I need to do for static batching?)
Not sure what else I can actually do. Any suggestions of things I haven't done yet?
Here is a picture of my profiler window and a picture of the scene that I am trying to render.
I just came across this comment on reddit:
https://www.reddit.com/r/Unity3D/comments/6ymanz/is_the_lighting_system_in_unity_garbage_or_is_it/
Where he mentions a few tips on lighting. I did them and it reduced by currently 30+ $$anonymous$$ bake time to 3 $$anonymous$$utes. I will play around with it some more to get some hopefully better results.
A few things I did
Change Lightmap resolution from 40 (default) to 15
Turn off Realtime Global Illu$$anonymous$$ation
Change Indirect Samples from 500 (default) to 100
Also you are using real-time shadow (I know you cook shadow but it still use real-time anyway).
You can bake shadow inside shader and texture. And only use real-time shadow for player.
I didn't realize that. Is there a link or something helpful to $$anonymous$$ch me a little more about baking shadows into textures and shaders? I thought all that shadow information is baked when I click "Generate Lighting" in the lighting window.
https://docs.unity3d.com/$$anonymous$$anual/Light$$anonymous$$ode-$$anonymous$$ixed-Shadowmask.html
I think the problem with you is that you set up the scene wrong. It somehow make EveryObject cast shadow and receive shadow for both bake and real-time one. It might be Unity Bugs. You shouldn't have that much shadow compute(Check GPU profiler. It never show by default).
Like very big object like room should not cast shadow. Only receive. Small object should never receive shadow or cast(some surface shader can fake shadow based on light direction)
$$anonymous$$y wall and pillar prefabs mesh renderer was set to cast shadows as on. I will update that and start going through my scene and start tweaking these other items as well. That's very helpful I actually didn't think about that.
Thanks for the link. You have really helped me out here. So according to that link that is what I am actually already doing. I have gone to my lighting window and set it to "Shadowmask". Almost everything in my scene is set to static as well (saves me a bunch with batching as well, yay!).
So far with everything I am getting closer to 60 fps, some areas still 45 fps, many others are hovering around 55 fps.
$$anonymous$$aybe with a bit more lightmapping and removing these shadow casters (like you said) I can push it over the 60 mark! :D
I just barely started removing shadow casters and I am already seeing a significant improvement. $$anonymous$$y 45 fps area just got bumped to 50 - 52 fps.
Answer by wesleywh · Jul 20, 2018 at 03:34 AM
Thanks @NoDumbQuestion ! He pointed out that I had a ton of shadow casters. I didn't think about it until he pointed it out to me. I switched a few of my prefabs to not cast shadow but only receive and bam! Jumped right up for me. I will have to continue to go through my scene and remove un-needed shadow casters and do as much lightmapping as I can.
I was able to get my frame rate to be consistently 60 fps or above! In the end it had zero effect on how my scene looked it just performed a ton better.
With a bit more work on fixing cloth physics, baking, and removing shadow caster I can push this well above 60.