EmiOnGit / warbler_grass

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

Generation on top of mesh #79

Open EmiOnGit opened 3 months ago

EmiOnGit commented 3 months ago

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

Currently, the grass placement is inspired by the pipeline used from Horizon dawn see https://gdcvault.com/play/1024120/GPU-Based-Run-Time-Procedural However, I found the approach of seperating xy Positions from the z of the blades rather cumbersome and not approachable. The biggest drawback of their approach is that sampling from a ground mesh is not easily implementable.

Describe the solution you'd like

I would like to have a ground mesh for the grass. The density map is further placed on the UV-texture of the ground mesh. The new pipeline would be: 1) Compute u,v coords of grass blades by dithering the density map 2) Compute (x,y,z) coords of the grass blades by sampling from the ground mesh 3) Store all (x,y,z) coords on the cpu 4) Load into grass pipeline

I believe that all those steps can be computed in a compute shader

Describe what is for debate

The exact structure of the ground mesh is not totally obvious to me currently. As I see it now, each chunk would need its own ground mesh. AFAIK Unity uses a single mesh which can be loaded in partially as needed. I'm not totally sure how they do it though

Additional context

I've seen that https://github.com/jadedbay/bevy_procedural_grass/ Also samples the grass from a mesh. Maybe look into their solution