Closed LiamGallagher737 closed 5 months ago
Seems like a good solution. Should behave like the rotation field of the Transform
component.
I'm travelling for the next days. If someone wants to implement this, feel free to do so, else I'll do it once I'm back
I've fiddled with the implementation a bit and recognized that it is to much work for me as I'm focusing on my thesis.
Again, if someone wants to give it a try, I'll gladly assist but currently this is out of scope
How would the rotation be set? can it be set using a normal map texture with the individual channels sent to the vertex shader? I'm not very good at shaders but I could give this a try.
Hey @duncesparce , feel free to implement it :)
My thoughts:
Sending a normal map should be a solid solution for the problem described.
You don't have to send the channels one by one, you can send the texture completely. You can take a look at the YMap
to see how this works.
For extra information's, I removed the WarblersExplicitBundle
on main. Therefore only WarblersBundle
has to be supported :)
You can ask for any questions you might still have
I've also tried to implement this with a normal map, but the grass blades are becoming really thin when I rotate them.
Without rotation:
I made this normal map in Blender by making a displacement mesh using grass_y_map.png
by following this tutorial.
Normal map:
![grass_normal_map](https://github.com/EmiOnGit/warbler_grass/assets/18116695/2169e11e-77d9-41b9-ab6a-7eadf3a0eb74)
Bake settings:
![bake_settings](https://github.com/EmiOnGit/warbler_grass/assets/18116695/0c36623c-c3d1-4369-94e7-3f8276ba7a3b)
Result:
![result_1](https://github.com/EmiOnGit/warbler_grass/assets/18116695/d3060251-c0b8-479d-a2ca-661682473a42)
Normals:
![normals_1](https://github.com/EmiOnGit/warbler_grass/assets/18116695/cfe0aa39-dbd2-4513-a612-c6e3990c3ef7)
Normal map: ![grass_normal_map_alt](https://github.com/EmiOnGit/warbler_grass/assets/18116695/3155b283-d7f2-4f70-bb81-6a33a90e9175) Result: ![result_2](https://github.com/EmiOnGit/warbler_grass/assets/18116695/a7e2a0f6-2fb0-44e8-89b7-d6b205eb7a18) Normals: ![normals_2](https://github.com/EmiOnGit/warbler_grass/assets/18116695/c6cf8afd-0490-43ea-abbc-f6ae4ba4a201)
grass_shader.wgsl
I could open a draft PR if you want.
That's some great research you did @fazil47!
Opening a draft PR is a good idea. In the first picture it seems like the face which was pointing to the camera was not rendered, which is a bit weird.
I'm also not sure why the grass blades get so thin but I think if we have access to your code, we can figure that out :)
Added in #70
What problem does this solve or what need does it fill?
I would like to be able to put grass on a spherical planet like the following image.![image](https://github.com/EmiOnGit/warbler_grass/assets/86995276/794573e4-55c7-4e6a-8bc3-1e9fd720d250)
Describe the solution you'd like
One possible solution would be to have the Grass struct also take a list of rotations for use in the WarblersExplicitBundle.