URCHN Arkipelago Difference between revisions of "Roach Walk Sim"

Difference between revisions of "Roach Walk Sim"

From URCHN Arkipelago
 
(8 intermediate revisions by the same user not shown)
Line 21: Line 21:
 
== What you need to start a Autowalking ==
 
== What you need to start a Autowalking ==
  
You need to start from either one of the shots that has had Game Engine crowd sim in it, or from the test file tubeSVN/scenes/dev/autowalk_test.blend, or from a file where you have created the following elements by hand:
+
You need to start from either one of the shots that has had Game Engine crowd sim in it, or from the test file '''tubeSVN/scenes/dev/autowalk_test.blend''', or from a file where you have created the following elements by hand:
* A Ground mesh that the roaches walk on, with the custom property __floor on the object. This can be created by making a dense mesh, parallel and over the ground, Turning on face/projection snapping, and moving it slightly in the top view. Meshlab (an external program) can then be used to simplify the dense mesh. You need to create this: see the section "Creating a Ground Plane" to see more details how. Note this *may not exist* in the game engine sim file.
+
* A Ground mesh that the roaches walk on, with the custom property __floor on the object. This can be created by making a dense mesh, parallel and over the ground, Turning on face/projection snapping, and moving it slightly in the top view. Meshlab (an external program) can then be used to simplify the dense mesh. You need to create this: see the section [[Roach Walk Sim#Create the Ground Mesh|"Creating the Ground Mesh"]] to see more details how. Note this *may not exist* in the game engine sim file.
  
 
* Players! These are animated objects with the name Player.### (where ### represents numbers, e.g. Player.001) The capitalisation is significant. These objects should have animation representing the overall motion of the cockroach over the ground. Please note you do not need to use the Game Engine simulation: hand animated objects are also O.K. Making objects as mesh cubes roughly the same size as the cockroaches is a good idea, since they will give you an idea of scale.
 
* Players! These are animated objects with the name Player.### (where ### represents numbers, e.g. Player.001) The capitalisation is significant. These objects should have animation representing the overall motion of the cockroach over the ground. Please note you do not need to use the Game Engine simulation: hand animated objects are also O.K. Making objects as mesh cubes roughly the same size as the cockroaches is a good idea, since they will give you an idea of scale.
  
* Working reference desk (so you need certain filepaths set up) In a scene file, you should have the property 'library' with the value '../../library.json' as a custom property on your scene. In addition, you need the reference desk addon enabled (this can be found in tubeSVN/lib/python/addons/refdesk.py) and installed.
+
* Working [[Reference_desk]] (so you need certain filepaths set up) In a scene file, you should have the property 'library' with the value '../../library.json' as a custom property on your scene. In addition, you need the reference desk addon enabled (this can be found in tubeSVN/lib/python/addons/refdesk.py) and installed. '''tubeSVN/scenes/dev/autowalk_test.blend''' already has everything setup so you can just start from the [[Roach Walk Sim#Steps|steps]] below.
  
 
== Steps ==
 
== Steps ==
  
=== Create the ground mesh ===
+
==== Create the Ground Mesh ====
 
As seen above, simply create the collision plane, typically done before any sim, and add the __floor property to it.  
 
As seen above, simply create the collision plane, typically done before any sim, and add the __floor property to it.  
  
=== Create the Player objects ===
+
==== Create the Player objects ====
 
This can be done by hand animating empties or cubes, or by using the GE way.
 
This can be done by hand animating empties or cubes, or by using the GE way.
  
=== Import the autowalker ===
+
==== Import the autowalker ====
 
If you have refdesk setup, you should be able to go to the 3D View Tools, find Reference Desk, and import Roach Crowd. You'll get an Autowalk_ui section in the Tools area.
 
If you have refdesk setup, you should be able to go to the 3D View Tools, find Reference Desk, and import Roach Crowd. You'll get an Autowalk_ui section in the Tools area.
  
=== Generate the roaches ===
+
==== Generate the roaches ====
 
Click generate in the autowalk UI and it should make cockroaches where the Player objects are.
 
Click generate in the autowalk UI and it should make cockroaches where the Player objects are.
  
=== tweak settings, observe, retweak ===
+
==== tweak settings, observe, retweak ====
 
Use the UI to tweak parameters, and use the Live or Anim Update buttons to view the results, and retweak to satisfaction.
 
Use the UI to tweak parameters, and use the Live or Anim Update buttons to view the results, and retweak to satisfaction.
  
=== Bake to Curves ===
+
==== Bake to Curves ====
 
When satisfied, bake the animation into curves.
 
When satisfied, bake the animation into curves.
  

Latest revision as of 18:55, 16 December 2011

Intro

This is the documentation for the current crowd sim setup for cockroaches in act I. This is the second try at simming the cockroaches, the first 'bitrotted' due to changes in the Blender api. This uses much the same method, but a different implementation. The original script was split into boids crowds simming and walking, both done in Python. The new one uses the Game Engine for the crowd, but Python for the walk.

Game Engine Boids

insert text here (from Tal's presentation?)

Python Walk Engine

Stepsofsteps.png

The python walk engine uses a simple method based on the 2.49 ant rig by MCHammond. This method starts off at a rest position in frame 1 of the simulation, and walks based on distance traveled- that is the walk is driven by the motion, based on a basic parameter of stride length: when a foot has moved back (relative to the body) by one half of a stride, it steps forward (the step taking it the other half of the stride). So the walk works as follows:

  • Initially, the root of the object is at a position 1. there are two targets, one parented to the root (the circle) and the other to the world (cross). Their locations are the same.
  • The root moves, leaving the X behind. the foot stays with the cross, until the distance is half the stride, then it will take a step to reach the circle.
  • Once the X and the Circle are a stride appart, the X is moved to the same spot as the Circle, and the cycle just repeats.

The shape of the motion is taken from a reference Action (foot ref) so you can actually edit the curves in the action to change nuances of the stop. TODO: document how to find which curve corresponds to which motion. The curve motions are multiplied by parameters that are exposed in the UI. In addition, other animations (body anims for instance) can be driven off the stride, and this is further exposed in the UI. Thus a foot will execute one step during a motion of one stride of the body. Since left and right feet are symmetrical, and have to step in opposition to each other, one of them is selected as a primary and stepped as shown above. The other alternates based on the primary's position. Since the cockroach has 3 sets of legs, the script can pick a pattern of primary and secondary legs. For each set, one side is primary and the other is secondary. The primary steps based on the stride, and the secondary (essentially) steps while the primary is static and vice-versa.


What you need to start a Autowalking

You need to start from either one of the shots that has had Game Engine crowd sim in it, or from the test file tubeSVN/scenes/dev/autowalk_test.blend, or from a file where you have created the following elements by hand:

  • A Ground mesh that the roaches walk on, with the custom property __floor on the object. This can be created by making a dense mesh, parallel and over the ground, Turning on face/projection snapping, and moving it slightly in the top view. Meshlab (an external program) can then be used to simplify the dense mesh. You need to create this: see the section "Creating the Ground Mesh" to see more details how. Note this *may not exist* in the game engine sim file.
  • Players! These are animated objects with the name Player.### (where ### represents numbers, e.g. Player.001) The capitalisation is significant. These objects should have animation representing the overall motion of the cockroach over the ground. Please note you do not need to use the Game Engine simulation: hand animated objects are also O.K. Making objects as mesh cubes roughly the same size as the cockroaches is a good idea, since they will give you an idea of scale.
  • Working Reference_desk (so you need certain filepaths set up) In a scene file, you should have the property 'library' with the value '../../library.json' as a custom property on your scene. In addition, you need the reference desk addon enabled (this can be found in tubeSVN/lib/python/addons/refdesk.py) and installed. tubeSVN/scenes/dev/autowalk_test.blend already has everything setup so you can just start from the steps below.

Steps

Create the Ground Mesh

As seen above, simply create the collision plane, typically done before any sim, and add the __floor property to it.

Create the Player objects

This can be done by hand animating empties or cubes, or by using the GE way.

Import the autowalker

If you have refdesk setup, you should be able to go to the 3D View Tools, find Reference Desk, and import Roach Crowd. You'll get an Autowalk_ui section in the Tools area.

Generate the roaches

Click generate in the autowalk UI and it should make cockroaches where the Player objects are.

tweak settings, observe, retweak

Use the UI to tweak parameters, and use the Live or Anim Update buttons to view the results, and retweak to satisfaction.

Bake to Curves

When satisfied, bake the animation into curves.

Autowalk UI parameters

Autowalkui.png

This UI appears in the 3D View when the autowalker has successfully been loaded.

  • Generate: Use this button only once, to create the rigged roaches where the Player objects exist.
  • restrict: This button hides all but the selected cockroach for speed. TODO: this does not actually speed up the file :/. It is a toggle, press again to reveal the other cockroaches.
  • sim all: when checked, the below buttons apply to all roaches in the scene, when unchecked, only to selected roaches.
  • start and end: this is the scene preview start and end frames, used by the Bake To Curves function to define the start and end of your sim.
  • stride length: the distance moved to take a single step.
  • step height: the height of a step.
  • leg knee: the amount of rotation of the knee during a step. goes from 0.0 (no motion) to 1.0 (default motion) to higher (more than default motion.
  • leg hip: the amount of motion of the hip joint during a step, similar to leg knee.
  • foot reach: spreads the feet out or in along the length of the roaches body.
  • foot spread: spreads the feet out or in along the width of the roaches body.
  • body bounce: amount of up and down motion of the body during a step.
  • body yaw: amount of left to right yaw rotation of the body during a step.
  • body height: offsets the body up or down.
  • body tilt: tilts the body forward or backward (head down or head up)
  • body offset: offsets the body forward or backward relative to where the feet are.
  • thorax curl: counter motion of the thorax during a step
  • abdomen curl: counter motion of the abdomen during a step
  • foot1/foot2/foot3: defines the pattern of the walk: on/off/on or off/on/off gives standard "alternating tripod" insect pattern. on/on/on or off/off/off gives the "bipedal run" that cockroaches do at high speed. Other gaits also possible, but don't match known (to me) insect walk patterns.
  • Live Update: toggles live updating, i.e. the roaches will walk as you move their root bone around the screen, or the Player object- not terribly useful.
  • Anim Update: toggles animation updating: the roaches walk as the frame changes. This allows previewing the tweaks, there are some caveats: Use frame dropping in the timeline, and don't skip frames- also, the updating happens after the frame, so the mesh is lagging a bit.
  • Bake to Curves: when reasonably satisfied, bakes the animation to function curves in an action. This will look better than the live update.
  • Free Bake: deletes the baked curves so you can re-sim.
  • Pop Limit: a foot will not be updated if it moves more than this limit; this can cause skipping steps if it is too low.
  • pop Upper: a foot will move if it exceeds this multiple of the stride length, and it was previously limited by the poplimiter; lower it to get less pops.
  • frame step: for the baker: amount of frames to set keys on. Only raise this nubmer if you intend on scaling the action down, by the amount you intend to scale (i.e. if you're going to scale down by 2, use 2, etc.)