I have limited knowledge on all the wonderful things Unity does in the background for me. This includes how it creates and project shadows.
Let’s say I have a 3d tree and I want it to project it’s shadow on the ground.
I personally see that 3d model as a complex object that Unity has to figure out before creating/projecting it’s shadow. This includes all the overlapping parts such as leaves and branches.
Is it normal to believe that using another 3d model (flat shaped) that grossly imitates the tree’s 3d general shape to project a fake shadow instead of the tree itself would have a difference performance wise since the flat shape is in my opinion much simpler to calculate than a tree and it’s overlapping objects?
See picture for what I mean. The white flat surface would be aligned to the center of the tree and marked as cast shadow only of course.
Maybe It’s not worth it and I’m complicating things too much and I should only mark cast shadow on the tree model itself.
What’s your take on that?
From the tests that I have done so far I don’t see much of a difference between the two but before going further I thought asking experts their opinion would be a good idea.
You can take your simplified mesh and, on the mesh renderer component, set the “cast shadows” setting to “shadows only”. On the complicated mesh, just set it to “off”.
To go into a bit more detail about your question, the way most game engines since, I dunno, 2003 and on render shadows is to use something called shadowmapping. This includes Unity. Effectively, for each light the scene is rendered from the point of view from that light and the results are written to a special texture called a depthmap. This can later be sampled for the normal camera rendering to determine if a particular area is in shadow or not relative to each light.
The overall takeaway from this is that geometric complexity really isn’t going to have an impact on the performance of your shadows. Yes, technically in order to render that shadowmap you need to transform all of the verts of the mesh but vertcount/polycount simply isn’t an issue on any modern non-VR, non-mobile platform these days. The quality of the shadowmap and the fillrate it requires is going to be the big factor.