DEV Community

Cover image for Fourier Series visualization using Unity

Fourier Series visualization using Unity

Experimental coder, generative art, interactive media, creative applications, ex game/App/web developer. Find my works more:
・2 min read

"Coding Druid" series is my horizontal programming practice notes, each part around a topic like mathematical, physics, electronic, graphics, sound, etc., implemented in several programming languages.

Coding Druid
Part: Math
Chapter: Fourier Series
Section: Unity

In the previous Chapter, I visualized Trigonometric function (Sine and Unit Circle) separately using MaxMSP, JavaScript (React), Python, and Unity:


This chapter I implement Fourier Series curve visualization.
And Unity this section.
When it comes to Fourier transform or Fourier analysis, it is usually divided into two parts: Fourier series and Continuous Fourier transform. This chapter focuses on the Fourier series.

In mathematics, a Fourier series is a periodic function composed of harmonically related sinusoids, combined by a weighted summation.

For example, suppose there is a square wave, and it can be interpreted into sine waves.
The more sine waves you have, the preciser square wave you will get:

More graphic explanations and formula derivation, see the previous section: Fourier Series Visualization Using React Hooks .

The effect of the previous section:


Now let's try Unity.

Have written an note Sine function visualization using Unity3D. So on the basis of its code, the drawing formula can be modified from the trigonometric function to the lower Fourier series:



The full code can be seen later.

Final effect:



Talk is cheap. Show me the code!

This demo and the Coding Druid series is open source here:

You may buy me a coffee in my Patreon. There are many articles, patches, source code and some advanced Patron-only content there.

Also you can get some free patches/codes in Gumroad shop.

Your encouragement is my driving energy!



Discussion (0)

Forem Open with the Forem app