Hi Guys,

I'm trying to make a very simple interactive foliage project, maybe the code I wrote is not perfect but I'm quite happy to be able to make it and I can use it in my next project.

I used a shader from 2D wind sway, with a slight modification by adding the code:

The skew variable is used to adjust the skew of the texture based on the player's speed when it hits the grass. You can see for yourself the project I made by downloading it

I share the source code of this game, please download it without any conditions. I will be happy if you give feedback below

Download

Download NowName your own price

Click download now to get access to the following files:

Source Code.zip 42 kB

Comments

Log in with itch.io to leave a comment.

Thank god for old forum posts, this saved me a headache, thank you. I adjusted it to make it work with Godot 4, and it works great!
If anyone is reading this looking to do the same:

  • Change "shader_param/..." to "shader_parameter/..."
  • Where it clams the skew parameter, change the body.movement to your player's speed value
  • Make sure to set "local to scene" to ON under the "resource" tab in the sprite's material, so it's unique for every sprite.

Now I'll figure out how to do this but for singular tiles in a tileset...

Just downloaded it to look at the code, because I implemented a similar shader myself recently.
Your implementation of just adding the velocity based skew on top of the foliage swaying shader behaves nicely and is easy to read :D

Mantap dah! Just into Godot and thinking of creating pixel game with this kind of interactive foliage shader.

(+1)(-1)

Great work! I think this can be useful for my game, I currently can't get it to apply to each grass blade individually as they all act in a unit, so any tips would be greatly appreciated <3

No spoilers 💀

Thanks a lot for this! been looking for a shader like this for a while. Fit perfectly to my game!

This is pretty good