webaverse / app

Web metaverse client
https://app.webaverse.com
MIT License
344 stars 207 forks source link

Grass shader walk displacement #2191

Open avaer opened 2 years ago

avaer commented 2 years ago

We should use a displacement/normal map to bend the blades of infinigrass (tm) as you walk through it.

Basically just a massive looped texture which you draw on with your feet.

Note that this texture would need to be a 2D ring/torus, and we should condition the displacement on close distance from the character center to prevent tile bleed. We should also decrease/diffuse the displacement normals over time (grass restitution), and rather than doing this in CPU we should do all of the writing and displacement in a shader. Otherwise, we would basically be doing CPU based antialiasing and constant texture uploads w/ the DataTexture.

avaer commented 2 years ago

Grass implementation: https://github.com/webaverse/grass-anime