EmiOnGit / warbler_grass

A bevy plugin for creating 3d grass in your game
Apache License 2.0
120 stars 11 forks source link

Optimize pipeline by real time rendering #54

Closed EmiOnGit closed 1 year ago

EmiOnGit commented 1 year ago

What problem does this solve or what need does it fill?

Currently all information needed for rendering of a grass chunk is locally cached to avoid unneeded work. This is needed for some parts of the pipeline, it is to expensive to calculate the dithering every frame without access to compute shaders.

The caching strategy has it's flaws however. It gives the pipeline a large surface for potential bugs. When is the cache supposed to be updated? Can we assume that our change detection works always? What if the user decides to change the data outside of the ecs? Have we checked every possible combination which requires a update of the cache? How fine grained do we update the buffers? Can we update every buffer on it's own? If yes, do the buffers depend on each other?

So to summarize, the standard today is to render in realtime whenever possible.

Describe the solution you'd like

A simplification of the current render pipeline where only the needed buffers are cached. This would be specially the DitherBuffer and ExplicitPositionsBuffer. The rest can and should be calculated every frame.

Additional context

Benchmarks have to be made to make sure that the changes have no to little impact on the total performance. Also the memory usage should be profiled