Open past-due opened 3 years ago
One piece of code I was playing around with was: https://github.com/sp4cerat/Fast-Quadric-Mesh-Simplification/blob/master/src.cmd/Simplify.h
However it would benefit from being integrated into a tool like WMIT so the parameters could be adjusted live to determine how much of a reduction is acceptable (to the artist).
A while back I played with MIT-licensed meshoptimizer tool on a branch. It worked, except our models are quite low-poly and internal WMIT optimizer is good enough so that results were basically same.
I rebased that branch and pushed into my repo. It's only setup with .pro file, if you want to try it and it still need to be updated to support some newer parts, but it should do actual optimization of a mesh even in current state.
Notably for this issue they have a "Simplification" algo that can produce a new set of indices into an existing vertex array which will be a new low-poly mesh. So, in theory, you don't need a shadow mesh inside a PIE and could instead generate one on a fly (in a background thread maybe, with primary index array being used until a low-poly index is ready). This would be the least amount of work for everyone.
@inodlite Thank you very much for the link - that's a very nice library, and I've opened a PR to experiment with using it: https://github.com/Warzone2100/warzone2100/pull/1680
I've tested its simplification algorithms a bit, and they may provide a decent default (automatic) reduction. However, we can only do so much with them automatically without an increasing likelihood of introducing overt artifacts. (They are unlikely to be as minimal or accurate as a hand-tuned simplified shadow mesh, given those constraints.)
I think the ability for WMIT to load / save shadow meshes (or at least to preserve one that exists in a .PIE file, even if it isn't displayed anywhere yet) is still a useful direction.
Reference: https://github.com/Warzone2100/warzone2100/pull/1630
It may be possible to generate a simplified shadow mesh on export, with various adjustable parameters. Alternatively, offering the ability to explicitly specify a mesh as a shadow mesh is something the Blender plugin is planning to support.
At a minimum, preserving the shadow mesh data from .PIE files is important (from import -> re-export).