Project: Flow Field Obstacle Avoidance
Date: 05/15/2019
Inspiration and Idea:
My initial idea for my final project was to build a 3D flow field. The example that I referred to is Mark Oosting’s 3d Flow Field Playground. Then teamLab’s water particle projects inspired me to simulate obstacle avoidance in flow fields. A project on flow field patterns also inspired me to explore different flow field patterns. My idea is to combine these elements to create beautiful visual effects.
Project Content:
1> 2D Flow Field
I implemented 6 functions of flow field patterns in the 2D flow field. The users can press the mouse to create obstacles in the flow field and place the mouse in the flow field to let the particles rotate around the mouse.
2> 3D Flow Field
I built a 3D flow field with music visualization function. There is a spherical obstacle in the flow field that influences the flow.
Process:
1> Obstacle Avoidance
I first created a 2D flow field to experiment with method to simulate obstacle avoidance. I manipulated angles to try to achieve the effect of particles flowing along the obstacle, but it was not an ideal simulation. Professor Moon suggested me to use repelling force and autonomous agent to simulate the effect with physics concepts. In order to let the particles turn gradually and move along the obstacle rather than turning immediately and creating a big circle, I calculated the repelling force with the reciprocal of the distance between the particles and the obstacle. I also increased the maximum steering force to achieve the best effect.
2> Flow Field Patterns
I explored several flow field patterns in the 2D flow field by combining math functions. But the particles only moved in a very small area because the number of particles was limited and it takes time for particles to move out of the frame to reappear. To solve this problem, I splice 10 particles and add 10 new ones in random positions in every frame count to fill the window. The mapping range of the angle value also needs to be adjusted to create various patterns.
3> 3D Flow Field
I learned three.js to build a 3D flow field for my project. Mark Oosting’s example directly added angle to acceleration, but this method can not be used to simulate obstacle avoidance. Therefore, I used the same physics concepts in the 2D version to build the 3D flow field. The difficulties were to understand the calculations in a 3D space and to understand the calculation of angles which is more complicated than in 2D space.
I also added music visualization in the 3D flow field. I obtained the average amplitude of the music with the audio library in three.js and added the amplitude to the fluctuation of every particle so that they oscillate to the rhythm. However, adding the average amplitude alone was not obvious enough. To improve the music visualization, I need to look for a stronger audio analyzer and combine maximum, minimum and average amplitude as well as the frequency.
Credits:
Perlin Noise by Joseph Gentle