Joshua Ray
Boids Flocking
Project description: This project visualizes flow vector fields using LIC or line integral convolution with vectors created by the user and then uses these vector fields to to imitate a wind pattern.
Instructions:
-
Press and hold the right mouse click button to select the vector start point.
-
Release the mouse at desired extension to create a vector.
-
View animated flow field
-
Repeat as desired.
Adjusting Wind Power:
-
Press P to puase
-
Click and hold on the red bar
-
Slide Bar to your desires (Left = 0 ) (Right = Max)
-
Relase mouse, and press P again to unpuase
Control Scheme
-
KeyAction:
-
W: Switches to Whitenoise Image
-
S: Turns on Flow Field Arrows
-
A: Switches to Picture Image
-
P: Puases the screen allowing for wind adjustment
Boid Flocking Implementation:
I used the XNA C# libraries to create the boids in this program. They behave via 6 different rules.
Rule Scheme:
-
CenterFly: to center of group within view
-
Avoidance: Keep a certain minimum distance from other boids
-
Match: Match the velocity of boids within view
-
Rebellion: After a period of time randomly change direction and turn blue during rebellion phase
-
Music: If within Proximity to the Music Sphere slow down and change color
The Rebellion and Music Rules were added just to increase visual satisfaction and keep the boids from clustering into to large of a group. user has no control over the musical selection unless they are to go into the directory files and replace the .MP3 file with another .MP3 with the exact name and extension "song.mp3".
LIC Implementation
I used the C# XNA libraries as the base for this program and HLSL to visualize the Flow Fields. I Read the data in using the C# Textures Class and then created an Arrow class to display flow fields. This arrow class determines the angle the arrow is facing and changes the color based on the vector that is given to it. This way when the coordinate points are read in from the mouse, it can simply be sent to the arrow class for processing to alter the arrow properly. I then mapped the arrows to each pixel on the texture (I only draw a few of them, any more would clutter the screen) and then used Sheppard’s interpolation to determine how these points will be affected by user input when a user vector is created. I then took this arrow data and passed it into the HLSL shader. Using the vectors from the arrow data I passed in I was able to then use Euler Integration the grab the next pixel and display it. By increasing the step Size each frame I able to achieve an animated effect.