godot-fft
godot-fft copied to clipboard
Feature Suggestion: Use RenderingDevice compute shader API to do large FFTs on GPU for performance
Implementing the (I)FFT in a compute shader could significantly help to speed up the process time for larger FFTs.
As part of my ocean system addon, I have a Stockham IFFT implemented in a compute shader that is able to perform IFFT on multiple 2D 256x256 textures each frame at 100+FPS (if the vertex count of the water surface doesn't put too much load on the GPU). I could help in integrating that existing code into your project if you were interested.
This is all done with GDScript and GLSL shaders, so no C++, C#, or custom engine builds are needed.
These are the files which contain relevant code:
-
addons/tessarakkt.oceanfft/components/Ocean3D.gd
- See section titled by comment "Compile & Initialize FFT Shaders" in
_ready()
for initialization code - See section titled by comment "Execute Horizontal FFT Shader Cascades" in
_process()
for execution code
- See section titled by comment "Compile & Initialize FFT Shaders" in
-
addons/tessarakkt.oceanfft/shaders/OceanFFTHorizontal.glsl
-
addons/tessarakkt.oceanfft/shaders/OceanFFTVertical.glsl