I recently noticed that enabling shadows (hard shadows only, low resolution, close fit, no cascades) increases the triangles/vertices count by 60-70%. Initially I have like 25k triangles on stage and upon enabling shadows they become 39k. Same applies to vertices, they increase too.
The only lights that are there is 1 directional light and also global illumination with gradient.
This is viewed in the “Stats” popup in the Unity editor.
As far as I know, shadows should create a shadow map that is applied onto the meshes that receive the shadows. I have no clue why it increases the tris/vertices count.
so that means from what you say that those triangles are first rendered normally and then on a second pass they are rendered with the shadow on them. Why is this redundant operation or the engine doesn’t have a way to know…
So you first render the object from the perspective of the light to determine the distance. (Or multiple times if you have cascaded shadow maps.) Then you use this information during the normal rendering.
Why are you asking about avoiding the extra triangles?
Is it possible you are experiencing some lag or frame drops?
If yes - consider optimizing in a different areas of the game. Increasing 20-30% polygon/vertices is very minimal with respect to your example provided, so there are some other areas where the game can be optimized to increase performance - if in fact this is why you are asking about extra triangles.
Thanks for your advice! I already optimized in lots of places, but given the triangles rise from 28k to 45k just due to shadows is concerning to me. That’s why I posted the thread. Cheers