School of Fish - Which technique to use?


#1

Hello everyone,

I am going to start on simulating a big school of fish just like this one here:

http://www.magmafx.com/thelab/refs/882-11.mov

I am facing a big wall here as i don’t know wich technique to go for. The only things i know that could help with the simulation would be to use Particle Instancing with animated geometry, and there is also the technique used in the Johnny walker advert from Framestore : http://www.framestore-cfc.com/commercials/jwalker_fish/index.html

But this requires MEL Scripting techniques that so far i didn’t take time to develop.

Also this one is pretty cool: http://www.framestore-cfc.com/commercials/stivel/index.html

I am wondering if goals should be used or not, if the fish should be a big mass of particles moving around controlled by fields, which in this case makes the simulation not very controlable. Also if ever some Big fish should interact with the school of smaller fish just a radial field on the Big fish would probably not create a good looking simulation.

And there is also the randomness in the fish movement…the sudden change of direction.

It can get very complex and i am trying not to panic.

AT LEAST, i would like to get that kind of movement:

http://www.magmafx.com/thelab/refs/82-63.mov

This i think would be achievable by using Instanced Particles with animated geometry which motion would be inherited from some kind of fluid…errr

Any input will be greatly appreciated, please drop a line!

Thank you!

Xavier.


#2

I’m not an expert at this but for this kind of thing I believe “boids” tend to be used

http://www.red3d.com/cwr/boids/


#3

If your fish is not that complicated, go for CurveFlow.

Animate a fish in orgin position ( just wings, tail and body)

No need to move. Then make it infinity loops.

Remembet that the front of the fish should see the X-axis. If it is not possible make the whole animation into a group. Then this group will face the X-axis.

Create a curve flow.

Make the changes you want in curve, number of fishes and area covering.

Instance the fishGroup into the particles.

In ParticleShape node, goto instancer node, change the AimDirection to Velocity.

Now you can see all the fishes going in a good way.

Hope this help you.

regards,
-Baran.


#4

you could try BrainBugz plugin by Carsten Kolve

or

[b]AI.Implant

[/b]


#5

Hey everyone,

Thanks for the answers guys! I tried to go with something as simple as possible to see what i could obtain.

Here is my first test render.

LEt me know what you think about it please.

http://www.magmafx.com/wip.html

Obviously there are a few fish popping but i need to work more than that on it.

Cheers, and thanks for posting your feedback!

Xavier.


#6

That’s looking really good. How many different animations did you use for the fish movements? How did you end up doing it?

Stev


#7

Looking great! Please, tell us how you went about it, and post up more stuff as you make it!


#8

yes dude. tell us more about your approach. I would love to know it…

-S


#9

Hey guys,

so i was aiming at using the simplest technque possible as i don’t have the scripting experience, or the the time to learn it right now.

So i modelled a fish and did a “swim cycle” for it.

The particles are emitted from a sphere that is hidden. The sphere is a goal for these particles. I am using goalV goalU parent U parentV and goalOffset attributes. The goalOffset allows the particles to be born not directly on the sphere’s surface so that i don’t have that perfect sphere shape.

The particles are moving around the sphere’s surface with a runtime expression where at each frame the goalV is incremented of 0.01: goalV += 0.01

I also set the particles goal weight to .5 and the goal smoothness to 5 i think.

Then i applied a lattice to deform the sphere on which they are flowing along. That lattice is what is translating the school of fish. It’s also deforming the sphere’s geometry(i should accentuate that more i think).

The light is 2 spotlights one from the top with a fog effect in it. the second one is lighting under the fish with a light blue color.

I am doing a second render with a glow added to the fish so as to emphasize their specular and have that “mirror” glitter when the fish change direction.

I still need to remove that pop and probably change the lattice movement and the way it deforms.

Thanks for your interest guys!! If you have any suuggestions please drop a line your critiques, comments and suggestions are VERY WELCOME!!

Cheers!

Xavier.


#10

Hi Xavier. Very cool. I like your approach, simple and effective. You actually don’t move the sphere. Right? You only move the lattice. I don’t understand what you need the lattice for. I know it deforms the sphere…but why is that so important? Coulnd’t you just move the sphere with no deformation?

Thanks man…

-S


#11

Hey stucky,

I guess you are right there, i probably don’t need the lattice i could just animate the scale of the sphere…yeah.

So right now actually the lattice is animated, the whole lattice, which drives the sphere in space. As the lattice is tranlsating, so is the sphere.

you see?

Xavier.


#12

ok dude. Anyway, thinking again, I think you did right in creating the lattice. Because that way you avoid selecting all the vertices/CV’s of the sphere. With the lattice it is more easy to deform the sphere…

Another question. You deformed the sphere so that the particles would move as the goal moves too. Am I right?

Thanks for the explanations Xavier. Keep the good work and show us more stuff as you progress.

-S


#13

very nice simulation and approch.

simple is better!

nice job!


#14

Thank you for the comments guys!!

I didn’t tweak the movement yet, i ust added more fish and played with the glow in maya so as to get a more reflective fish. i need to adjust the blue light though it might a bit too much.

Version 2

http://www.magmafx.com/wip.html

I’ll keep posting updates!

Thanks!

Xavier.


#15

wow. That is very very good. How do you tell the fish to stay pointed to where the sphere moves?

Sorry for beeing a bit lame about this dynamic thing. But I want to start learning more. And I am very confortable with MEL. That will help me…

-S


#16

if you need the interaction between the school of fish and the shark (or other fish of prey) you might try the 3d fluid container… it has been a while since i have tried this but you can take your “swim cycle” particle fish and attatch them to the dynamic force grid of a 3d fluid container… then make a shark that colides with the fluid… this will cuase your fish to swim away form the shark some settings and tests might be needed of couse…
hope that helps… it sounds like a neat project :smiley:


#17

sp0rk3d: Yes! I thought about that it might be a good technique actually because of the dampening attributes of the fluid, the particles might interact smoothely to the “shark”, the shark would have some radial field to it, repulsing the fluid and the particles that are being driven by it. Thanks for suggesting that.

Stucky: the fish are actually moving relatively to the sphere, the sphere is the goal of the particles. These particles are emitted from the surface of the sphere. And the sphere is being moved around by the lattice that is deforming it.

Thanks for your interest guys!!

Cheers!

Xavier.


#18

After a few renders and a few tests this is a new version. It seems the renderer messed up a few frames so i don’t have the whole simulation here. But i have a preview if you want to have a peek.

Let me know what you think. I am trying to stay away from using the Maya ocean to actually cast real caustics. As i believe it would take more time to render. I just want to add to a bit more to the credibility of the school of fish.

The caustics on the floor of the sea are actually a 2D ocean texture from maya mapped in the light and animated with a oceantime = sin(time) expression.

Here is the latest version.

http://www.magmafx.com/wip/fish/School_Sim_v6.mov

Xavier.


#19

Hey Xavier. I like it a lot. Congratulations. :thumbsup: I only have to point one thing though. I think this time, the fish are a bit dark. I mean, I know undersea ilumination comes from above and you get things with less light, but I think it would be better if the fish where a bit more lit in the darken areas(Like the last test with glow that you showed us). I hope I made my self clear.

-S


#20

Simply SuperBBBBBB… The way its orientation is really nice…

regards,
-Baran