- Home /
Lerp() and compute shader
Hello,
I got a buffer full of vector data (=points) in Unity that I would like to increase in resolution by doing interpolation.
So say I would have a 2 by 2 point array, I would like it to become a 3 by 3 array with the new points being interpolated between the existing ones using lerp().
I got this working in C# already, yet this is running to slow for my realtime needs, as the point buffer can be quite big (200k of point entries).
I was thus looking at compute shader to let the (rather simple) work of lerping between the existing points be done on the GPU. I read up some examples on using compute shaders and compute buffers in Unity, yet can't get it to work.
Could someone show me a compute shader that takes a simple linear array of 2 by 2 Vector3 elements and compute this up to a 3 by 3 array on the GPU? That would be much appreciated.
The problems I am facing in my implementation are the use of the thread groups, what dimensions to choose in regards to the size of the buffer and how to deal with the size increase in the buffer due to the new interpolated points being inserted.
thanks in advance
Your answer
Follow this Question
Related Questions
How Make a Simple Altimeter? 1 Answer
How would I smooth out a Quaternion? 2 Answers
LERP gives final value way too early 2 Answers
Animate fanning cards almost works! 1 Answer
Cubemaps Lerp 0 Answers