I have an array that is 60 by 60 by 60 filled with Vector3 wind data. What I am trying to do is visualize how the wind is flowing with arrows that move around the scene. Right now there is too much processing going on and the game freezes.
Currenty I am working with a smaller array that way the game can load. I am wondering what actions I can I take to optimize this process. I was told to try and use a compute shader because every object is doing the exact same task, but the documentation on compute shaders seems pretty slim. I also don't know, can the GPU access an array of data to get wind information? Please share any tips that might help and just note how much difference you think it would make. I don't have much experience with Unity or shaders at all, but I have Google!
Thank you!
What the game does:
First 216,000 (60*60*60) objects are created and there positions are set to the index values of our wind array. ex: (1,1,1) (1,1,2) ... (60,60,60)
Every frame their positions are transformed by taking there current position + the value from the wind data array. Lets say a partial is at (5.3,2.0,6.9) the new position will be (5.3,2.0,6.9) + windData[5,2,6]
The rotation of the objects are also set to the windData to make sure the arrow is pointing the correct way.
If an object is out of the 60 by 60 by 60 cube then its position is set to its starting location
↧