Adding the flag in the Geometry File (.fbx)
Creating and baking the nCloth simulation
Adding the flag to your Asset Manager (.cam) file
Creating the Geometry Behavior
In the previous blog post, we saw how to quickly populate a stadium.
However, there are as many stadium setup as project, and the explained method may not be suitable for all projects. Today let's see some alternative methods for placement. The method to be chosen mainly depends on the input geometry, distance from the camera, behaviors to implement...
This is the method we already exposed.
Select faces in your geometry and choose the "Selected object or component" mode in the Population Tool Creator Tool Panel. See here for more details.
Placement Using Seats Pivots
For stadiums which seats are individual meshes, you can select theses meshes and place people relatively to the mesh pivot.
Just select all these meshes in object mode (the default selection mode)
Then click on the Golaem Crowd Population Tool Creator , and select the "Selected object or component" mode in the Tool Settings panel.
As usual, you can change the population tool parameters to populate only some of the seats, add a bit of noise...
Usually the pivot of your seat object is centered on the seat, but it is not always what you want. For example if you generate standing supporters, they will be standing inside the seats, which depending on your camera angle can be a very big problem.
In those cases, do not forget that you can either change the pivot of your object before populating the stadium, or move the whole population tool using the usual Maya Translation tool. See an example below where we moved the population tool forward so that the characters are generated in front of the seats.
Using Navmesh For Complex Placement
When it is not possible to use the component or object mode, you can compute a navmesh for your stands and place your characters using a regular population tool (most likely a point shape one if you want to be able to set a number of rows and columns). This placement mode also offers the advantage of being able to use noise without characters overlapping each others.
The first step is to select the stand mesh and to compute a navmesh (for this case I prefer to use the "Exact subdivision mode", you just need to uncheck the "Keep Only Greatest Connex Zone" in the Advanced Parameters tab).
Then you can place a point shape population tool and adjust its number of row/columns, move it and adjust the distance between characters, to match your stands. Do not forget to adjust the particle radius as well so that they can fit into the stands.
Notice that although we requested 12 columns, given the distance parameters, only 9 could be generated. The advantage of using a navmesh is that the extra particles are not generated outside the stand. They are not generated at all.
Placement With Multiple Terrains
For example when using the navmesh method to place your characters, it can be useful to create more than one terrain. In the example below, we created only one terrain with all stands and try to generate people on the top stand. Unfortunately, depending on the parameters used, some characters may get generated on other stands.
A clever solution for this case is to use a different terrain per particle tool.
In the picture below, we included only the top-left stand in a terrain and generated particles on it. The terrain a population tool should use can be selected in the Terrain Attributes:
Here is the result when placing 4 particle tools, using one terrain per stand. A different Entity color has been used per particle, to show that there is no character generated outside of its relative stand.
One important thing to note is that although it is possible to use multiple terrains for placement, only one terrain will be used during simulation. This terrain is used to correctly adapt the characters feet to the ground.
In our example, if the terrain used during simulation include only one stand, the characters on this stand will be generated correctly, but all other characters, not located on the covered zone, will be adapted incorrectly.
To avoid this, you should create a specific terrain for simulation, and map all stands into its Maya Geometry attribute
Note that if you are not using the Navigation or Goto Behaviors, you do not even need to provide a navmesh file for this terrain.
The terrain to be used during simulation is the one selected in the "In Terrain Mesh" attribute of the CrowdManager node.
Filling a stadium with Golaem Crowd is very easy and can be done in a few minutes. In this blog post series, we will go through the basics of stadium filling and learn a few tips & tricks along the way.
We'll start with an empty stadium stand, subdivided so that a face is more a less the size of a character.
It is only one of the multiple ways to create your stadium so that you can populate it with Golaem Crowd, we'll give a few examples of alternative setup in later posts.
Creating A Default Terrain
First, set the "Select faces component" selection mode.
Select the stand once, and then select the faces on which you want to place some characters. Note that your selection does not have to be contiguous, you can just select any set of faces you want.
In the following example we want the right-hand side of the stand to be empty in order to create a stair.
Then click on the Golaem Crowd population tool creator , and select the "Selected object or component" mode in the Tool Settings panel.
A population tool is created, with one character per face. Notice that no character has been placed on the faces we did not select.
Obviously you can customize the number of particles, the number of characters per face, or even their orientation. E.g in the following picture, we removed a few characters and mapped a locator in the LookAt attribute of the Population Tool Locator. This is very useful to make all people in the stadium look at same point of interest (optionally with a bit of noise).
Click on the "Emit Particles" button at the bottom of the Population Tool attributes editor panel.
Select the generated particle system, and click on the CrowdField button .
Hit play to see your characters appear.
It is possible to get a better character preview by importing a preview mesh in Maya, and mapping some geometry in the EntityTypeSurface associated to your EntityTypes.
Note that this preview uses a simplfiied skinning which may not be perfect. Do not worry, it is just a previz, and not what will be rendered at the end.
Creating Ambiance In The Stadium
It is simple to create an ambiance in a stadium using a few looping motions started randomly.
Open the behavior editor, and double click on your first EntityType. A tab appear, corresponding to the behavior of the characters from this EntityType.
Drag and drop a MotionBehavior on the Behavior Life arrow.
Select it and check your attribute editor. The main attribute is a list of motions that should be played. Just click on the "+" and add a looping motion.
This motion list typically contains only one motion, which is the motion you would like the characters to play. However if you add multiple motions to this list, one motion will be randomly chosen each time the behavior start. It can help you to easily add animation diversity to your stadium.
Repeat the same operation with the second EntityType and run the simulation.
As we used only one motion and the characters all start at the same time, there is no animation diversity at all. Just go back to the MotionBehavior attributes and check the "Start percent random".
Creating A Wave In The Stadium
The way to render depends on your renderer. Check out video tutorials to learn how to configure rendering.
In this previous blog post, we detailed how to create a suck-up effect. All the characters were sucked up insided the UFO so we did not have to care about computing collisions with the ground or the environment.
Today we are going to experiment with a simple explosion and a terrain, to see how we can get characters to interact with the environment. Something similar to what we did in the fortress demo:
The initial setup consists in a few character placed on a plan with a few obstacle.
You can have a look at the Quickstart Tutorial to create such a scene.
Creating a physical world
As for the UFO scene, we need to create a Physic Locator, but here we are going to create a physical world instead of using the default plane.
We'll detail the procedure for Maya 2013 and 2014, for previous versions, you see here.
Load the bullet plugin from the plugin manager
The Bullet plugin loaded in Maya ( > 2013)
Select the meshes you want to include in the physical world (here the plane, the sphere and the cube. Others, if any, will be ignored by physics computation). Notice that the .bullet export (hence Golaem Crowd) can only take into account Static meshes. The selected meshes should not be keyframed
Set its Body Type to "Static body" in the attribute editor
Go to file/export and select the .bullet file type
Enabling Physics on the Entities
Do not forget to check the "Enable Physics" of your Entity Types advanced attributes.
Adding a Ragdoll Behavior
Simply open the behavior editor and drag'n drop a Ragdoll Behavior. Of course, it is possible to have your characters walking with a motion or locomotion behavior before switching to the ragdoll behavior, but let's keep this example simple.
Create a locator that will enable you to choose the direction of the initial impulse, and map it to the ragdoll behavior impulse locator attribute
Finally, you can customize the impulse intensity if needed:
You can now hit play and see your characters explode and collide with the obstacles. Move the impulse direction locator to experiment with various configurations. The funniest thing is to move it up and down to send them lower/higer.
Stopping characters when they reach the ground
You will notice that when the characters reach the ground, physics simulation keeps updating and parasite motions appear. It can be avoided very easily by using a stop trigger, and the "Locked posture" stop mode of the Ragdoll Behavior:
When characters reach the ground, their velocity is close to 0. You can use this to stop them when needed. For more information about how to setup a trigger based on velocity and why you need to protect your trigger with "current frame > 5", see how to select a motion based on character speed. As usual, do not forget to uncheck the FALSE trigger.
The locked posture mode forces the characters to keep the same posture even if the ragdoll behavior is stopped. Otherwise, they will immediately go to their neutral posture (which is a standing character).
You can obviously use other features of the ragdoll beahvior, like the Impulsion Mask (to simulate headshots or sliding characters...), or the Animation Mask (to ensure their arms stay close to the body). These features have already been detailed in the Ragdoll Behavior How-To.
You can also use a keyframed zone trigger for starting the ragdoll behavior, in order to simulate a collision with a moving object.
Today we'll talk about our last Siggraph Demo. You may already have seen part of it in the Golaem Crowd 2.5 video: it features the creation of flying ships, animated thanks to Maya fields, and live actors integration within a virtual crowd.
Our visitors on the Siggraph Booth particularly appreciated the fact that it was very easy to get the live actors avoided by the virtual extras.
Axel Domenger, the freelance artist who created this demo, did a nice breakdown of the shot, showing how Golaem Crowd was used to reach this result.
One of our customers, Fullframe Filmes from Brazil, just created this commercial for Brahma, a famous brazilian beer brand.
They made an unusual usage of the ragdoll behavior by creating people sucked up by UFOs.
This is a nice occasion to give more details about how to use the ragdoll behavior. We will study a simplified setup of the commercial.
The initial setup is very similar to a classical stadium, some people playing a loop sit motion at random, and a keyframed UFO flying over. When the UFO reaches the center of the character group, it starts spinning (still keyframe) and will suck up characters.
We created two EntityTypes:
- Green people will not be influenced by the UFO
- Blue people will be sucked up
You can have a look at our brand new online documentation if you want to know how to create the initial setup
Each EntityType has a distinct behavior which is just playing a simple motion.
Creating a Physics Locator
To be able to compute physics simulation, Golaem Crowd needs a Physics Locator. This locator describes the physical word (which objects are colliders) and provides global parameters like gravity.
As our world is very simple and we do not need any collision with the physical world, we'll just use the "Default plane mode" which is an infinite plane located at the center of the scene.
You can have a look at the User's Guide if you want to learn how to descibe a more complex world, but we will cover this in a next blog post anyway.
Enabling Physics on your EntityType
As physics computation impacts performances, it is turned off by default. It should be activated for each EntityType which should be affected by physics.
Adding a Ragdoll Behavior
Let's add a parallel operator and a RagDoll Behavior on top of the MotionBehavior
When it starts, the ragdoll behavior turn your motion controlled character (or parts of it) into a ragdoll (a physics controlled character). It can also apply an impulse force so that your character are thrown at a certain direction.
There are several way to describe this direction, we'll use a locator at the center of the UFO, so that it is computed automatically based on the character position. You can add a bit of noise, so that they do not ALL exactly reach the center of the UFO, but not too much, or they'll miss the UFO...
Then you can also control the intensity of the impulse (how fast they will reach the UFO). A positive intensity sends the characters away from the locator (explosion), so we will use a negative intensity here.
Starting the Ragdoll Behavior
Last but not least, we need to tell Golaem Crowd when to start the ragdoll behavior. We litterally want it to start when the UFO start spinning, so we will use a driven attribute trigger (honestly we could just have used a current frame trigger but we wanted to demonstrate the power of driven attributes!).
Each Trigger node has a drivenAttribute Attribute which can be connected to any floating point value of any Maya object. This way you can control your Golaem Crowd simulation with any Maya input. Here we'll use the rotation angle of the UFO (aka pSphere1).
First you need to connect the two attributes together using the Connection Editor (Window/General Editors/Connection Editor). Watch out about which object you select (you need to select the Shape of the Trigger, not its transform) and the way you are connecting them (from the sphere to the trigger)
When the attribute is connected, you can see its name and current value in the attributes editor of the Trigger node. Enable the Driven Attribute Trigger, and set a starting angle value and an operator (here greater than 150).
Also activate the Random Trigger so that they do not start exactly ALL at the same time.
Last but not least, uncheck the True trigger.
Hit play, and here you are!
Wait a minute! They fly, but they do not stop in the UFO! Sure, we did not specify the stopping trigger yet
Stopping the Ragdoll Behavior
We need a 3D Zone stop trigger so when they enter the UFO geometry, the ragdoll behavior stops and they stay in place.
Select the UFO (pSphere1) and map it in the Zone Trigger of the RagdollBehavior Stop Trigger (tips: after selecting it, open the behavior editor, and while holding SHIFT, select the stop trigger on the Ragdoll Behavior, click map in the attribute editor).
Activate the Zone Trigger, and check the 3D checkbox.
Do not forget to uncheck the False trigger, or it won't work at all (yeah I know I were about to forget, I always do!)
Finally, if you want the character to stay still when the ragdoll behavior stops, you have to select the "Locked Posture" stop mode in the Ragdoll Behavior (or else they will just fall back on the floor and sit down again, it's fun but not what you want)
If you want to enhance the effect even more, you can play with the Impulsion Mask and the Animation Mask (see above attribute editor picture).
The impulsion mask enables to apply the impulsion on only some body parts. For example, if you apply the impulsion only on the left part of the body, they will twist while flying.
The Animation Mask enables to define which part of the body will be controlled by physics or not. If you uncheck arms and legs, and play a Motion Behavior in parallel, you can control the global character position thanks to physics and play a panicked behavior on the arms and legs.
Well I do not have a "panick" motion at hand and anyway you would not see the difference on a screenshot, but remember that at the beginning of the scene we put the Sit Motion Behavior in parrallel with the Ragdoll Behavior. Let see what happens if we uncheck some checkboxes in the Animation Mask
You can see that they keep their legs folded and the arms close to their body. You can then get the best of both worlds!
See you soon for another blog post about how to make your character collides with their environment
If you really think about it, crowds are everywhere: cars in the streets, birds in the sky or bugs in your closet… Even a forest could be considered as a crowd: it’s basically trees with different positions, animations, shapes and colors. Such a diversity of characters and behaviors requires to have a crowd system which is flexible enough to handle it, but still controllable and pipeline friendly.
In this post, we’ll describe how you can simulate any animated geometry with Golaem Crowd, even if it hasn’t a skeleton or a complex rig. If the animation engine will not be usable in such cases, we’ll still be able to use the Asset Manager, some avoidance behaviors and, of course, the procedural rendering techniques.
Setting up your Asset
Here’s my buddy for today: a little nutcracker soldier. No skeleton here, it’s just a bunch of keyframed meshes to make it cyclely walk on-the-spot during 24frames. The only requirement to input this character into Golaem Crowd is to create a root joint on the floor and to parent the character geometry to it (middle click drag’n’drop). This joint will be used by the system to place and orient the characters in world space.
With this root joint, you can create an entry in the Asset Manager for the nutcracker character. Pretty straightforward: select the root joint, create a new asset (Asset_NutCracker), select the character meshes and create a new asset group (Body). Don’t forget to export it in FBX (Tools / Export Selection as FBX), to set up the bounding box and you’re done! For more information about the Asset Manager, take a look at this tutorial.
Setting up the Simulation
The simulation part is the same piece of cake than the asset part:
- Create a new EntityType Nutcracker . As the character will not be animated with the Golaem Crowd animation engine, there is no need to specify a skeleton file.
- Create a Terrain . If no Maya geometry is selected, it’ll create a default plane terrain.
- Create a bunch of particles, either with the Population Tool or some Maya emitters.
- Connect a CrowdField to the particles and run the simulation. As no skeleton has been loaded, the default display will be a bunch of oriented cylinders: pretty rough… Let’s change this.
- Import your animated Nutcracker in the scene and place its root joint at the scene origin.
- Golaem Crowd provides a GPU-based way to efficiently preview animated geometries on top of particles. Go in the entityTypeSurface1 Attribute Editor, switch the Display Mode to “Skinned Mesh” and map the imported nutcracker meshes in the “Skinned Geometry” field. You can even play with the "Hue Variation Factor" to randomize their preview color. It is important to notice that this display is for PREVIEW ONLY: it does not take into acount your shading graph and your asset repartitions (yet)
Setting up the Behaviors
OK, now you’re ready to add some behaviors to your characters, depending on what you’d like them to achieve: reaching a target, avoiding each other, playing a baked animation… Let’s say I want all my soldiers to reach a target and avoid each other.
- Create a Navigation Mesh from your Maya geometry to compute obstacles and environment limits.
- Add a Crowd Target Locator in your scene. You can keyframe its position if wanted.
- Open the Behavior Editor for your EntityType and add a CrowdBeGoto and a CrowdBeNavigation in a CrowdOpParrallel operator. Change the Goto parameters to make your characters reach the Target Locator we just created. Change the Navigation parameters (speed, acceleration…) if needed.
- Play the simulation and enjoy the result.
- Ok! You may notice that the characters are still not animated: this is normal as we did not add any behavior to deal with animation yet. As the characters do not have a skeleton, we can’t use neither the CrowdBeMotion nor the CrowdBeLocomotion behaviors. So how do we play the baked animation stored in the FBX file then? Let’s have a look to the CrowdBeGeometry behavior:
As you can see, it takes a FBX file to play, a start and a stop frame in this FBX, some speed replay parameters and some start frame parameters. Isn’t it exactly what we need?
- To assign a FBX file to this behavior, go in the Asset Manager, select the FBX file you’d like to play (in this scene, there’s only one) and click on the Assign button on the bottom right corner.
- Change the CrowdBeGeometry parameters to fit the animation: start frame, stop frame, randomize the start percent random. As we do not have skeleton animation to blend, uncheck the "Blend Behavior" option as well (you may need to Refresh the Entity Surface Shape node to take this new configuration into account at the GPU level).
Setting up the Rendering
Nothing special to do here, characters with or without skeleton are rendered the same: just export the cache and add a Crowd Render proxy in your scene and you're done.
You can even add some shader attributes in the Asset Manager to deal with texture / shading variation (without relaunching the cache export). Shading variation will be the topic of a coming blog post. Stay tuned!
Ok, I guess it makes sense for you to use a crowd simulation software to animate moving characters but you're still wondering why you'll use it for static objects such as trees, parked cars? Why not using the Maya instancer instead? Let me try to convince you with few properties relative to my soldier scene:
- maya scene: 900kb
- cache per frame for 800 characters: 19kb
- render time with VRay (full-HD image): 52seconds
- geometry loaded on demand only
- shading variation / geometry variation for free
- thanks to the GPU based preview, the viewport keeps being interactive even when instancing a large number of objects
And few more examples made in a couple of hours:
Cars controlled with an uniform field and animated with a geometry behavior for the tires.
Trees placed and oriented with the Population Tool. Same model but with different scales and geometry variations.
Birds controlled with a flock behavior, animated with a geometry behavior for the wings and with shading variation.
Any other idea or question? As always, feel free to ask!
We know many Golaem Crowd users like the Rocketbox characters, reknown for their quality and large diversity of models and animations. We used them to create a facial animation demo (to be detailed in a second post) and thought it would be a nice occasion to give some details about the workflow.
Rockebox characters are usually provided for Max and/or Maya. If you already have a Maya character, you can skip the first part.
Exporting from 3DSMax
We will use a FBX file to transfer the character from Max to Maya. As usual, a FBX transfer is not as straigtforward as it should be and some precautions should be taken.
1. The character meshes are stored in their own layers, which are given the same name as the mesh. Maya will artificially rename the mesh when loading the FBX which will be complicating the asset management step. The best way to avoid it, is to put each mesh in the default layer, and delete the source layers.
- Open the Layers Manager (Tools/Manage Layers menu)
- Expand mesh layer.
- Right click on the mesh and choose "select"
- Right-click on the default layer, and choose "Add selected object"
- Delete the source mesh layer
The final layers arrangement
2. Optionally, you may want to load an animation and export it as well. Just select the root of the character and load a .bip file
Loading a Bip animation file
3. Export the character as a FBX file. If you need to keep animation, do not forget to check "Bake Animation" in the final export dialog.
4. Open Maya and import your .fbx file
Loading the rig
1. Select the root of the character (most likely bip01)
2. Open the Skeleton Motion Converter
3. Depending on how you imported the character, there is no bind pose. The best way to load the rig is to select the "current values" detection mode.
The dectected skeleton in current values mode
4. Check the preview and make sure you get a valid detection, then export the skeleton file
5. Go to the "Skeleton Mapping" tab. The mapping should have been detected automatically, just export it
Automatically detected mapping
Creating assets file
1. Open the Asset Manager and select the character root in the ouliner (bip01)
2. Click on the "+" button and create a character (e.g. policeman)
3. Select the created character in the asset manager, and the mesh you would like to use in the outliner (most likely the "hiPoly" one, but you may want to create different level of details as described in this blog post). Click on the "+" button, and create an asset group (e.g. fullbody)
4. In the asset manager, check "Show selection in Maya" and select the created character (e.g. policeman). Click on the "Export FBX" button and save your .fbx file.
5. Select the bounding box and set correct bounds in the attribute editor
6. Go to the rendering tab, and click on the "+" button to create a new rendering type (e.g. policeman)
7. Select the created rendering type, and click on the "+" button again to add the "fullbody" asset group
8. Save the .cam file
Using the created character
You can check our tutorials and use the created characters as you would use a character from the samples or the character pack.
However as Rocketbox characters are built using meters (instead of centimeters, which is the default Golaem Crowd scale), you will probably need to scale them.
The best way to do that is to use the CrowdField scale parameters, and dividing the default value by 100 (meter to cm conversion)
The CrowdField attributes
One More Production is a full-service visual effects company based in the center of Paris. They populated the Stade Toulousain with tens of thousands of supporters for this Peugeot commercial.
The Golaem Crowd Character Pack made it possible to deliver several shots from mid-distance to full stadium view while keeping costs competitive.
Fullframe Filmes, an innovative VFX studio from Rio de Janeiro, transformed a residential area into a crowded stadium for Brahma. Fullframe artists took advantage of the Golaem Crowd Character Pack to minimize asset preparation and get the job done in no time!
Watch the full commercial featuring soccer stars Diego Forlan and Thiago Silva: