I began the object oriented particle system example that we started with in class. I decided the easiest way to make a swarm of bees would be to construct a single bee using the gview open inventor editor and then to use the use that model for the particles of my particle system. I added code to which called a render to file function which had also been provided to the class and was able to produce the image on the right.
I found that I could create a cluster or swarm of bees very quickly and and was able to fine tune the shape of the swarm of bees by editting the parameters that were passed into my program. As I adjusted the parameters to increase the area which with swarm of bees covered I discovered that due to the way my particle system was set up, that the translations of the parent bees were being applied to the children, causeing the bees to stick together and follow each other in strings. While this sometimes produced very interesting swarms of bees, it was not consistent and not the effect I was looking for.
To correct the problem I had to change the way each child particle was attached to the scene graph, so that instead of being attached to the parent, it was instead attached to the root of the scene graph. This solved the problem of the bees flying in single file lines.
At this time, each of the bees just randomly appeared in different locations given the specified mean and variance values which I supplied my program. This type of animation looked very choppy. So I editted the function which updated the position of each bee so instead of just making random translations, the random value supplied was added to a float which was stored in each particle. I created an array of three floats in each particle to hold the x, y and z translations. Those three values were then used in the translation which was to be applied to the individual particle. Before the values are put into the translation of the particle, I first used the sin and cos trig functions to further control the translation. Now I could create a swarm of bees that flew in smooth, but random paths and at varying speeds. I made it so their rotation values only varied slightly which made it appear that the swarm was flying against the wind.
I was quite happy with this, and decided to spend some time playing with the camera position. The viewall function of the camera didn't suit my particle system very well, due to the random movements of the bees. When the camera also moved to follow the bees, it countered the nice effect of having the bees move around in the first place. So removed the viewall function call and created a float to hold z value of the camera's postion. Then as I ran through the for loop which generates each from I increased that z value. The amount which I added to the z value was the total number of frames minus the current frame number all times a constant. By doing this the camera initially moves away quickly and then slowed down as the animation progressed. I had to try different values for the constant which was multiplied with the difference between the number of frames and the current frame number. Initially the camera zoomed out too quickly. I ended up making this a value that the user could enter to give the user more control over the animation to be rendered. I also spent some time playing with the rgb color mean and varience values to get a range of yellows which matched natural bees.
Now that I had my camera zooming out at the rate I wanted, I ran into a new problem. In the beginning of my animation I started zoomed in very close to the bees, apparently too close. Bees that were too close to the camera ended up getting pieces cut off. So I had to adjust near clipping plane to make sure the bees remained intact.
I also attempted added the property of having particles in my particle system die. In the object oriented approach to the particle system that I had been using, it seemed as though it would be fairly straight forward to implement the death of child particles. First you had to assign all the children of the particle to be killed up to that particles parent. Then you had to remove that particle from the parent's list of childrena. And then finally delete the particle itself. In implementing this I ran into the problem created a child to bee killed has children to be assigned to its parent, but its parent already has reached its maximum number of children. One way to get around this problem would bee to just kill on the children. But I didn't wish to have large sections of bees just vanishing all at once. The other option was to make one of the children of the deceased bee into the parent of all of the other children and then update the parent and all the other children accordingly. Due to time constraints I chose not to implement this and instead let my bees live forever.