Performance impact of noise generation?
TL;DR: How big of an impact would it have on my game's performance if i were to write a script for each sprite of foliage in my game, and have it manually displace the sprite? I'm considering separating my foliage sprites (such as a sprite of grass into each strand of grass), setting their pivot to the bottom center, and having them be rotated around the pivot according to a generated noise. The noise would be generated only one time per frame in the game manager (rather than each sprite generate it), but be updated every frame and many game objects would be rotated per frame.
I'm making a 2D, top down game in Unity using the Universal Render Pipeline. I've spent a lot of time researching how to make my grass (2D sprites) bend randomly like it's being affected by wind, and the most common answer I've come across is using a shader that displaces the material based on a noise texture.
At first this worked fine, and i managed to implement a gradient to only have the top half of the grass be displaced. However, as soon as i start moving across the scene several strange things happen. Some of the bugs include: completely ignoring the gradient and displacing the entire sprite, and one of the sprites jumps to another world position if i get close to it.
If anyone is curious about the shader graph, i'll attach it. sorry it's messy, i had to put everything close together to get a high quality screenshot.
Edit: There's some useless nodes in there that don't do anything (such as subtract 0). I was experimenting with different nodes. Sorry about that.
Your answer
Follow this Question
Related Questions
Shaders & Shadows: How far can I use for my mobile game for good performance? 0 Answers
What is better: shader or light? 0 Answers
How should I set up lighting in my game so that it performs well? 0 Answers
Can I render billboards in forward render? 1 Answer
Solid color texture or adding a color property to shader? 1 Answer