Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

uutee

Computing derivative with FFT

This topic is 5689 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I was reading an article on gamasutra (a Game development community), which said that more accurate normals to a periodic heightfield can be computed using FFT. This is based on computing derivative with FFT, so I started coding this on a one-dimensional problem. I read these formulas: (1.) h(t) ==> H(f) // the Fourier transformation Now, to compute h''(t), we need to compute: (2.) G(f) = i*f*H(f) // derivative in fourier space (i is sqrt(-1) and f is the frequency) (3.) G(f) ==> h''(t) // back to time domain Do I have some fault in these formulas or why don''t they work? I use the following to compute (2.): for( i=0; i n goes from -N/2 to -N/2-1 // so here we do some linear transformations int n = i-N/2; float f = (float)n/(samplingRate*(float)N); dst[i] = dst[i] * Complex(0,f); } I learned FFT best (so far) from the book Numerical Recipes in C. Does anyone know a better book (I''ve tried DSPGuide)? Does anyone know how to implement this derivative thing in practice? - Mikko Kauppila

Share this post


Link to post
Share on other sites
Advertisement
I don''t think step 2 is correct. If you''re using frequency (Hz), and not angular frequency (radians/sec), it should be

G(f) = j*2*pi*f*H(f)

Besides that, is the function for calculating the fourier transform and inverse fourier transform correct?

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!