EmiOnGit / warbler_grass

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

Setting grass blade rotation using normal map #70

Closed fazil47 closed 8 months ago

fazil47 commented 9 months ago

Attempt at implementing #60. Check this comment for current status.

EmiOnGit commented 9 months ago

Thanks again for sharing your solution, this is already great! :) I noticed that when not defining the normal_map, therefore using the default fallback image (which is a 1x1-white texture), the grass is not pointing up.

To fix that I'm thinking about:

fazil47 commented 9 months ago

I've added a green fallback texture, let me know if you prefer a different solution. I've also replaced grass_normal_map.png with grass_normal_map_alt.png because it's effect wasn't noticeable enough.

fazil47 commented 9 months ago

Current state:

Without rotation:

without_rotation

Example 1 Normal map: ![grass_normal_map](https://github.com/EmiOnGit/warbler_grass/assets/18116695/49396626-7159-41bb-955e-85972d615535) With rotation: ![with_rotation_1](https://github.com/EmiOnGit/warbler_grass/assets/18116695/752db077-cd7d-4b8f-b28b-1a52c4bf62ac) Bake settings: ![bake_settings](https://github.com/EmiOnGit/warbler_grass/assets/18116695/bc05f40d-a5a4-4b62-8ada-b96e7009fdef)
Example 2 Normal map: ![grass_normal_map_alt](https://github.com/EmiOnGit/warbler_grass/assets/18116695/f8a4fe4f-b9ab-4e8a-b5b4-c830bcbd3626) With rotation: ![with_rotation_2](https://github.com/EmiOnGit/warbler_grass/assets/18116695/9affc5c2-e1e4-4d4a-be51-34f1309cfec4)
fazil47 commented 9 months ago

I haven't tested WASM builds yet, what is the recommended way to do that?

EmiOnGit commented 9 months ago

Somehow my new comments are at my last review and not at the bottom.. Well, I think with this should be the last changes to fix all bugs.

Test I've been using ![normal_tex](https://github.com/EmiOnGit/warbler_grass/assets/95967983/eb4ef232-dfb9-42ac-8ec5-0b2476bd7921) which I generated using the same method as you from a hill with a platform above: ![20231001_17h43m46s_grim](https://github.com/EmiOnGit/warbler_grass/assets/95967983/fbc14079-73be-44e5-9fd7-026290314f31) result (also used a white density, y-map for better view): ![20231001_17h49m16s_grim](https://github.com/EmiOnGit/warbler_grass/assets/95967983/1a0332c7-8e46-417a-9e01-0043d43c9c20)

I also like the changes in the example camera system. You can choose if you want to keep them or remove them, though I suggest to also note the keybindings in the examples like the others. I also think I'd like space and shift a bit more because it makes using the camera possible with only one hand (you can ignore this point if you don't agree)

fazil47 commented 9 months ago

I've remapped the camera movement up to space and down to left shift. With that, should be ready to review.

fazil47 commented 9 months ago

Also feel free to replace/delete the normal maps I've added.