I need to make interactive grass for my top-down 2D game. I have no experience with shaders, but they seem to be the best choice for making what I need.

Does anyone here know of good tutorials for this use-case, or the ability to help me work out this feature?

Thanks!

What I think I need is this:

To define an area (Area2D with a CollisionShape2d?), and for this area to be filled in with individual pillars of pixels of random height and placement (within specific ranges). Then for these to wave, and to move away from/react to player character collision.

I made a rough example of what I want to achieve using hundreds of AnimatedSprite nodes and scaling that triggers when the player enters and exits their detection areas. This performs very badly, doesn't utilize physics, and crashes my game when I make areas much larger than shown, among other issues.

I think redoing this feature with shaders would be a drastic improvement. If anyone can help with this, I'd greatly appreciate it! In the meantime I'll be studying them to see if I can figure it out myself.

Example here.

How about having a grass sprite parented to the player that only shows up/is visible when you are walking over grass tiles? One singe node is bound to be less expensive than a whole bunch of them, I would think. Plus it can be an animated sprite then.

@Megalomaniak, thanks for your response.

Could you expand on this idea a bit? I'm not sure how to draw the large (larger than in my example) areas of grass without bogging down the performance.

Well, I'm thinking of a really simple set up here, where there is a single tile sized sprite of grass that is parented to the player such that it shows up in front of the player characters legs. But is hidden when the player is not standing on a grass tile.

The hard part then is checking if the player is on a grass tile or not. Assuming the grass/foliage has it's own tilemap it might perhaps be possible to make use of the navigation polygons perhaps, but I haven't actually tested that.

3 years later