EmiOnGit / warbler_grass

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

Improve dithering speed #86

Closed EmiOnGit closed 1 week ago

EmiOnGit commented 1 month ago

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

Currently, the dithering of the density map is fine for smaller projects but quickly reaches its limits if the density maps are large enough or many changes to the density map occur. Also since the dithering currently is used in a normal system, the whole frame waits till the dither is complete, leading to noticeable stutters.

Describe the solution you'd like

Dithering should be loaded asynchronous in the background to allow loading over multiple frames. The dithering of a large density map could also be split into a multithreading task without to many problems.

Describe alternatives you've considered

The dithering itself could also be computed in a compute shader. This would by far the fastest method if implemented correctly. I'd like to test if it could be sufficiently fast on the cpu first. This is mainly because dithering on a compute shader opens up a couple of new problems such as precomputing buffer size for the blade positions and would make swapping out the dither algorithm rather troublesome later.

Other

The implementation of the dithering itself can also be improved for sure. This alone would also help drastically and be more favorable than just throwing more cpu cores on the problem