- Home /
Reduce number of shadowcasters
My racing game runs at 69/70 fps when shadows are turned off, but when turned on the stats shows that there are over 600 shadowcasters in the scene(mostly all of them in my car object) and the framerate drops from 70 to 35-42.
The car mesh has lots of child game objects/child meshes. I guess this is the reason why there are tons of shadow casters. So I guess I should combine the car object(ideally to one single mesh). However using the CombineChildren script makes one mesh per material and does'nt seem to affect this at all...
Thanks in advance
What's the question exactly, how do you combine models in Blender?
Thanks for the reply, well, the main question is: "how can I reduce the number of shadowcasters". Just disabling the "cast shadows" option does'nt seem to affect this number or the frame rate at all, so I guess I have to combine as many meshes as possible. I tried to join the car mesh in blender, by selecting all geometry and join it(ctrl+j) and then export to Fbx.
Answer by Sondre-S · May 04, 2015 at 05:44 PM
Okay, so I was able to get the bumber of shadow casters down to 143(now with a FPS of 100(!)) by joining the mesh in Blender.
Thanks:), howeverthe blender export got some strange artifacts but, I have created a new separate question for that. Just solved one problem and another one appears:)
Answer by haim96 · May 04, 2015 at 10:15 AM
i would try another approach, instead of combine meshes, create dummy mesh in shape of the car bottom side and make it the only shadow caster. make sure that the rest of the car don't receive\cast shadows so the shadows from that dummy mesh will fall on the track and not the car it self. hide the dummy inside the car, close to track.
if this for a mobile this should do the job...
and if using real time shadows is still heavy for your game there several solutions for faking shadows. i'm using one of these and it real performance booster.
Hi, thanks, I should have mentioned earlier it is a PC game.
I'm using the car physics pack UnityCar, and the test models that comes with that package runs smoothly at about 80 FPS with both real time shadows and real time reflections enabled, even tough they have a higher poly count than my models. The difference is they are only one big mesh with different materials.
That dummy thing was actually not a bad idea, I'll try that. The thing is it seems no matter how many mesh filters I uncheck "cast shadows" on, it does not affect the number of shadow casters...
And I should clarify this: I'm testing my car model in the exact same scene as the UnityCar model, so the only difference is my car model.
how many shadow caster do you see when running unity's scene with the original car?
the stats shows 135 shadow casters in the scene with the UnityCar test mesh, if I replace the test mesh with my own mesh, it shows 1400 shadow casters. If I add the CombineChildren.cs script to my car mesh it drops to 343 shadow casters.
Your answer
Follow this Question
Related Questions
Lightchanel's: Tell a light what objects it does effect in runtime 0 Answers
Need Help with Dynamically Building a Mesh 0 Answers
Framerate drops from 60 to 20 because of meshrenderer? 0 Answers
Real soft shadow vs "illusion" shadow 0 Answers
Unity Blob shadow projector massive tris amount, why? 1 Answer