Long story short aka TLDR:
2D Grass shader > vertex animated > can’t use batching afaik because objects loose their individual pivot > Trying gpu instancing > pivots are preserved yay! > Instance are all black boo
Can it be fixed? > Should I rethink the whole thing?
Long story, the details!:
I am making a shader to animate 2D grass, all features are implemented. Worked great until I implemented a render texture to make the grass fold when objects move through it.
Had to disable batching to get things to work (vertex animated using offsets afaik I need individual pivot points… is there a way around this?) …batching completely screwed my performance so I got GPU instancing working on my sprites with the code bellow and HURRAY! It works and it doesn’t mess with pivot points so my vertex animations work! BOoo! the instances are black.
What It looks like:
Honestly, I really dont care how I fix this. In the end, I need to cover my screen with vegetation. Right now I have about 3500 of those sprites covering the screen and with batching disabled a lot of preformance is lost just for grass. I hope gpu instancing can fix this but I am not even sure I am doing this whole grass thing the right way.
Features I want to keep working:
-Looks like actuall grass standing up, not tiles
-Can be displaced by objects moving through it
I need help fixing this and/or figuring if I should take another approach to create the grass.
Thank you for you assistance!