-
-
Couldn't load subscription status.
- Fork 101
Description
bugsquad edit: Transferred from Godot repository: proposal can be found at #2600 (comment)
Godot version:
Godot 4.x
commit b4b7c97d3839170180e4f3f7c2bd3179b374057a
OS/device including version:
Win 10 64x
Issue description:
After testing the new ShadowMeshes in Godot 4.x and comparing the new feature with manual ShadowMeshes created for Godot 3.x I couldn't help but feel very disappointed by the performance (~80% less than Godot 3.x).
So I looked at the shadowmesh source code and I consider this an implementation bug and not a missing feature for a proposal.
Autogenerated shadowmeshes in Godot 4.x are matched to the same source mesh LoD level while they should be matched 1-3 LoD levels lower. A shadow imposter mesh created manual by an artist always starts at least 1-2 LoD levels below the visible LoD mesh but never at the same level. A typical example would be a characters hair mesh, starting at 150.000 vertex. The shadow looks the same with a LOD3 mesh that has only 5.000 vertex cause the outside mesh shape stays the same and this is enough for shadow casting on solid objects. In the current implementation the shadow casting mesh has a 145.000 vertex overhead that does nothing for the endresult and just consumes performance.
Due to this as mentioned in godotengine/godot#45452 pull request there is currently only a little performance gain with shadow imposters while it should be a considerable one.
I suggest that the autogenerated shadow imposters should be generated and matched with LOD2 or LOD3 meshes by default to fix this issue and give the expected performance boost from shadow imposters.
There is no reason to ever use the same mesh geometry detail for a shadow-only casting object except for edgecases like meshes mixed with semi-transparent surfaces and very lowpoly meshes (that don't need shadow imposters to begin with). A Shadowmesh LoD selection option in the new ResourceImporter would be welcome to solve those edgecases.
Steps to reproduce:
Minimal reproduction project: