376

MiarmyManualForV2.0

Embed Size (px)

DESCRIPTION

Miarmy Manual

Citation preview

Page 1: MiarmyManualForV2.0
Page 2: MiarmyManualForV2.0

Miarmy 2.0 Manual

2 ©2011-2013 Basefount

Page 3: MiarmyManualForV2.0

Miarmy 2.0 Manual

3 ©2011-2013 Basefount

Miarmy Manual

Version 2.0

Basefount Software

BASEFOUNT TECHNOLOGY (HONG KONG) LIMITED

Page 4: MiarmyManualForV2.0

Miarmy 2.0 Manual

4 ©2011-2013 Basefount

Table of Contents Brief ......................................................................................................................................................................... 14

Structure .................................................................................................................................................................. 14

Part 1 Main Concept ................................................................................................................................................ 15

Miarmy Human Logic Engine Concept ................................................................................................................ 15

Decision Node ...................................................................................................................................................... 16

Defuzz Process ..................................................................................................................................................... 16

Solving Decisions Active .................................................................................................................................. 17

Make Priority for Decision Nodes .................................................................................................................... 17

Agent Brain Instantiate ........................................................................................................................................ 18

Assets Management ............................................................................................................................................ 19

Miarmy Contents ............................................................................................................................................. 19

Agent Groups ................................................................................................................................................... 19

Perception_Set Group ..................................................................................................................................... 22

Placement_Set Group ...................................................................................................................................... 22

Naming Conventions ........................................................................................................................................... 22

Animation Rig .................................................................................................................................................. 22

Original Agent, Action, Action Shell, State and Decision ................................................................................. 22

Bounding Box and Action Proxy ...................................................................................................................... 23

Geometry ......................................................................................................................................................... 23

General Pipeline .................................................................................................................................................. 23

Plan .................................................................................................................................................................. 23

Prepare ............................................................................................................................................................ 24

Create Agent Infrastructure ............................................................................................................................ 24

For Logic and behavior .................................................................................................................................... 26

Rendering and output ..................................................................................................................................... 26

Solver ................................................................................................................................................................... 27

Solver Contents ............................................................................................................................................... 27

Simulation Pipeline .......................................................................................................................................... 27

Reset, Update, Pause and Break Mechanism .................................................................................................. 28

Non-Connection Sequential Node Communication ........................................................................................ 28

Part 2: Menu Items .................................................................................................................................................. 30

Page 5: MiarmyManualForV2.0

Miarmy 2.0 Manual

5 ©2011-2013 Basefount

Menus .................................................................................................................................................................. 30

New Icons GUIs and ......................................................................................................................................... 57

Part 3: Agent Infrastructure .................................................................................................................................... 61

Rig ........................................................................................................................................................................ 61

Bone structure ................................................................................................................................................. 62

About binding .................................................................................................................................................. 64

Original Agent ...................................................................................................................................................... 64

What is Original Agent? And why we need it? ................................................................................................ 64

Creating Original Agent ................................................................................................................................... 65

Agent Group Node and Agent Type ................................................................................................................ 65

Render Geometry Binding ............................................................................................................................... 67

Render Geometry Management ..................................................................................................................... 67

Render Geometry Shader ................................................................................................................................ 68

Bone Shape for Display & Physical Simulation ................................................................................................ 68

Bone Attribute & Flags .................................................................................................................................... 69

Physical Joint Type ........................................................................................................................................... 70

Physical Joint Direction .................................................................................................................................... 71

Physical Joint Limits ......................................................................................................................................... 71

Referencing & Namespace Pipeline ................................................................................................................ 74

Select-able root bone for creating original agent ........................................................................................... 78

Placement ............................................................................................................................................................ 80

Point & Formation Placement ......................................................................................................................... 80

For “formation” placement: ............................................................................................................................ 84

Randomize Row/Column for curve and formation placement ....................................................................... 85

Populate Agents from Pace Node ................................................................................................................... 88

Curve placement.............................................................................................................................................. 88

Terrain Attachment + Point placement ........................................................................................................... 88

Polygon Based placement ............................................................................................................................... 89

Selection Placement (only place agents from selection) ................................................................................ 90

Proportion in Place Node ................................................................................................................................ 91

Hierarchical placement .................................................................................................................................... 92

Solver Space ..................................................................................................................................................... 93

Page 6: MiarmyManualForV2.0

Miarmy 2.0 Manual

6 ©2011-2013 Basefount

Inverse Placement ........................................................................................................................................... 93

Place Node Data Structure .............................................................................................................................. 95

Visualize placement ......................................................................................................................................... 97

Skip flag can used to bypass individual instance ............................................................................................. 98

Animation and Action .......................................................................................................................................... 99

Animation to Action Pipeline Suggestion ...................................................................................................... 100

Create Action Node ....................................................................................................................................... 100

Transition Map Building .................................................................................................................................... 103

Concept .......................................................................................................................................................... 103

Main Features of Transition Map .................................................................................................................. 105

How to Build Transition Map ......................................................................................................................... 107

Easy control transition Map Move Tool ........................................................................................................ 111

Decision ............................................................................................................................................................. 112

Create Decision node .................................................................................................................................... 112

Agent ................................................................................................................................................................. 112

Agent attributes ............................................................................................................................................. 113

Agent Mode ................................................................................................................................................... 115

Agent Memory Data ...................................................................................................................................... 116

Part 4 Logic in-depth ............................................................................................................................................. 117

Fuzzy Logic ......................................................................................................................................................... 117

Pipeline .............................................................................................................................................................. 118

Terminology ................................................................................................................................................... 118

General Pipeline ............................................................................................................................................ 119

Engine Process Breakdown ............................................................................................................................ 119

Implementation ................................................................................................................................................. 122

Step 1: Get Channel Results .......................................................................................................................... 122

Step 2: Fuzzy Logic for a Single Sentence Calculation ................................................................................... 122

Step 3: Fuzzy Logic between Sentences Calculation ..................................................................................... 125

Step 4: Fuzzy Logic for Priority Ranking and Interfere to Node Active ......................................................... 126

Step 5 & 6: Output Mechanism - Node Active, Default Decision and Normal Decision ............................... 128

Part 5 Logic & Simulation ...................................................................................................................................... 131

Logic Presets ...................................................................................................................................................... 131

Page 7: MiarmyManualForV2.0

Miarmy 2.0 Manual

7 ©2011-2013 Basefount

Channel Presets ............................................................................................................................................. 131

Decision Presets............................................................................................................................................. 132

Interactive with Agent ....................................................................................................................................... 132

Sound ............................................................................................................................................................. 132

Vision ............................................................................................................................................................. 136

Agent Exclusion Feature ................................................................................................................................ 139

Dynamically Decrease Intelligence Mechanism (DDIM 1.0) .......................................................................... 140

Collision Detection ......................................................................................................................................... 140

Interactive with Environment ............................................................................................................................ 141

Ground ........................................................................................................................................................... 141

Bound ............................................................................................................................................................ 143

Indexing Technique ....................................................................................................................................... 144

Zone ............................................................................................................................................................... 145

Repel/Forbidden Zone ................................................................................................................................... 149

Spot ................................................................................................................................................................ 150

Road ............................................................................................................................................................... 152

Maya Field ..................................................................................................................................................... 161

Composition of Forces ................................................................................................................................... 162

Maya Fluid ..................................................................................................................................................... 163

Formation Control ......................................................................................................................................... 163

HP & MP ........................................................................................................................................................ 168

Lean ............................................................................................................................................................... 170

Parent channel, transform space .................................................................................................................. 171

Some Transform Channels............................................................................................................................. 173

Scene Info ...................................................................................................................................................... 173

Randomize ..................................................................................................................................................... 174

Sine Channels................................................................................................................................................. 175

Timer Channels .............................................................................................................................................. 176

Agent Bone & terrain Channels ..................................................................................................................... 178

IK Offset Channels ......................................................................................................................................... 178

MEL/Python source in Logic Channels........................................................................................................... 179

Simulation Space ............................................................................................................................................... 180

Page 8: MiarmyManualForV2.0

Miarmy 2.0 Manual

8 ©2011-2013 Basefount

World Transformation for physical simulation ............................................................................................. 180

Local Transformation for non-physical simulation ........................................................................................ 180

Solver Space Node ......................................................................................................................................... 181

Output Behavior Channels ................................................................................................................................ 182

Transform Speed ........................................................................................................................................... 182

Bone Offset .................................................................................................................................................... 182

Sound ............................................................................................................................................................. 183

Vision ............................................................................................................................................................. 183

Aim Constrain ................................................................................................................................................ 183

Arbitrary Aim Axis and Up Vector .................................................................................................................. 188

Action ............................................................................................................................................................. 189

Ragdoll ........................................................................................................................................................... 189

Traffic System ................................................................................................................................................ 190

Watch Logic Results ........................................................................................................................................... 195

Brain Viewer .................................................................................................................................................. 195

Feedback in Essential ..................................................................................................................................... 197

Simulation Extra Tools ....................................................................................................................................... 197

Feet Map Generator ...................................................................................................................................... 197

Visualization ...................................................................................................................................................... 201

Visualize HP, MP Data .................................................................................................................................... 201

Visualize Action Transition ............................................................................................................................ 203

Visualize Agent ID .......................................................................................................................................... 203

Bounding box display Mode and Inverse Placement .................................................................................... 203

Part 6 Action .......................................................................................................................................................... 205

Action Infrastructure ......................................................................................................................................... 205

Action Node Data .......................................................................................................................................... 205

Action Node Attributes for Playback and Transition ..................................................................................... 206

Action Features.................................................................................................................................................. 211

Action Trigger ................................................................................................................................................ 211

Action Group Trigger ..................................................................................................................................... 211

Action Blending.............................................................................................................................................. 212

Action Playback Rate ..................................................................................................................................... 213

Page 9: MiarmyManualForV2.0

Miarmy 2.0 Manual

9 ©2011-2013 Basefount

Action Channel for Input ............................................................................................................................... 214

Randomize Entry Points ................................................................................................................................. 214

Subjective Objective Action Synchronization ................................................................................................ 215

Hook up Custom Attributes ........................................................................................................................... 218

Single Character Cache .................................................................................................................................. 221

Skip Animation Calculation for Some Bones ................................................................................................. 224

Action Drive Agent ............................................................................................................................................. 225

Pipeline .......................................................................................................................................................... 225

Getting the Target Action .............................................................................................................................. 225

Parsing out the Next Action ........................................................................................................................... 226

Action Transition ........................................................................................................................................... 228

Action Transition Visualization .......................................................................................................................... 228

Action Proxy List ................................................................................................................................................ 230

Story List (Logic Drivable Action Proxy List) ...................................................................................................... 231

IK System ........................................................................................................................................................... 233

Part 7 Physics ......................................................................................................................................................... 238

Enable Dynamics................................................................................................................................................ 238

Dynamics Types ............................................................................................................................................. 238

Dynamics Channels ........................................................................................................................................ 240

Pre-build RBD Objects and Visual Clue .............................................................................................................. 241

Fully Pre-build RBD Objects for Dynamical .................................................................................................... 243

Collision Detection............................................................................................................................................. 244

Mark Collide................................................................................................................................................... 244

Pre-build RBD Objects for Collision Detection .............................................................................................. 244

Collide Check Channels .................................................................................................................................. 245

Optimization .................................................................................................................................................. 249

Dynamics Features ............................................................................................................................................ 249

Physics Global ................................................................................................................................................ 249

Step Time and Sub Step ................................................................................................................................. 250

Disable sub-tree simulation (skip finger and toes etc…) ............................................................................... 251

Gravity VS Mass ............................................................................................................................................. 252

Joint Move Inertia .......................................................................................................................................... 253

Page 10: MiarmyManualForV2.0

Miarmy 2.0 Manual

10 ©2011-2013 Basefount

Terrains and Default Terrain ......................................................................................................................... 254

Maya Field ..................................................................................................................................................... 257

Force Field General Rules .............................................................................................................................. 258

Maya Fluid ..................................................................................................................................................... 259

Build-in Force Field ........................................................................................................................................ 259

Combo ........................................................................................................................................................... 261

Kinematic Primitives ...................................................................................................................................... 262

Cloth simulation............................................................................................................................................. 263

More realistic Cloth Simulation and Cloth Collision ...................................................................................... 268

Mute Dynamics .............................................................................................................................................. 269

Rigid Body Dynamics Emitter ........................................................................................................................ 269

Rigid Body Contact and Leave to Agent ........................................................................................................ 273

Render RBD Emitter ....................................................................................................................................... 276

Agent Bone Particle Emitter (Action Phase based) ....................................................................................... 277

Part 8 Render ......................................................................................................................................................... 280

Agent Cache ....................................................................................................................................................... 280

Creating Agent Cache .................................................................................................................................... 280

Agent Cache for Bone Rotate Only ................................................................................................................ 281

Agent Cache with translate ........................................................................................................................... 282

Agent Cache with cloth .................................................................................................................................. 282

Agent Cache Format ...................................................................................................................................... 282

Command Line Caching ................................................................................................................................. 282

Render Solutions ............................................................................................................................................... 283

Render by Miarmy Mesh Drive .......................................................................................................................... 284

Concept .......................................................................................................................................................... 284

Features: ........................................................................................................................................................ 284

Optimizing Mesh Drive before Implementation ........................................................................................... 285

Generate (Duplicate) Mesh ........................................................................................................................... 285

Pairing ............................................................................................................................................................ 287

Enable Mesh Drive ......................................................................................................................................... 288

Render by Renderman ....................................................................................................................................... 288

3Delight Configuration .................................................................................................................................. 288

Page 11: MiarmyManualForV2.0

Miarmy 2.0 Manual

11 ©2011-2013 Basefount

Manually Setup Renderer (Windows) ........................................................................................................... 289

Pipeline .......................................................................................................................................................... 289

How to Render ............................................................................................................................................... 290

Render Agents ............................................................................................................................................... 290

Random Geometries Rule .............................................................................................................................. 291

Texture Naming Convention and Random Textures ..................................................................................... 293

Render Global ................................................................................................................................................ 295

Texture generate and path accessible ........................................................................................................... 295

Multi cam render ........................................................................................................................................... 296

Preset shaders ............................................................................................................................................... 296

Self-defined Renderman Shader ................................................................................................................... 302

Prman Rib Export, support .slo for custom Shader ....................................................................................... 304

Light Usage & Shadow ................................................................................................................................... 305

Motion Blur .................................................................................................................................................... 308

Renderman Procedural Primitives ................................................................................................................. 310

Renderman Extra Rib Attribute (internal or custom) .................................................................................... 313

Hierarchical Subdivision Mesh ...................................................................................................................... 315

Command Line (Batch) Exporting RIBs .......................................................................................................... 316

Misc New Layers: ........................................................................................................................................... 316

Split render .................................................................................................................................................... 318

Procedural Primitives .................................................................................................................................... 320

Subdivision Mesh ........................................................................................................................................... 323

Matte ............................................................................................................................................................. 324

Fetch Agent Render Information from Miarmy to Your Own Pipeline ......................................................... 324

Render by Mesh Drive ....................................................................................................................................... 326

The Old Mesh Drive 2.0 (Obsoleted) ............................................................................................................. 326

The History of Mesh Drive ............................................................................................................................. 326

NEW: Mesh Drive 3.0..................................................................................................................................... 326

Render By Arnold ............................................................................................................................................... 333

General Introduction ..................................................................................................................................... 333

Arnold Procedural Primitive .......................................................................................................................... 333

The tools ........................................................................................................................................................ 339

Page 12: MiarmyManualForV2.0

Miarmy 2.0 Manual

12 ©2011-2013 Basefount

The Pipeline ................................................................................................................................................... 339

Render By Mental Ray ....................................................................................................................................... 341

General Introduction ..................................................................................................................................... 341

The tools ........................................................................................................................................................ 341

Render Pipeline and Assets Organization: .................................................................................................... 342

Render By V-Ray ................................................................................................................................................ 346

V-Ray archive Support ................................................................................................................................... 346

Preparation .................................................................................................................................................... 346

Pipeline & Assets ........................................................................................................................................... 347

Under the hood ............................................................................................................................................. 347

Replace Shader .............................................................................................................................................. 349

Alembic Cache (Geometry Cache) ..................................................................................................................... 350

Alembic Cache Export .................................................................................................................................... 350

Export FBX ......................................................................................................................................................... 351

Bake Bone + Geometry ...................................................................................................................................... 352

Bake to Bone Animation ................................................................................................................................ 352

Directly Get Simulation Data Using MEL/Python .......................................................................................... 352

Part 9 Optimization ............................................................................................................................................... 354

Low Efficiency Channels Optimization .............................................................................................................. 354

Vision ............................................................................................................................................................. 354

Collide Family Channel & Pre-build RBD Object ............................................................................................ 357

Collide Any Channel ....................................................................................................................................... 358

Bounding Box Display ........................................................................................................................................ 358

Solver Space....................................................................................................................................................... 359

Easy Transition ................................................................................................................................................... 359

Optimizing Crowd Dynamics ............................................................................................................................. 359

Using Spot or Zone Trigger Dynamic ............................................................................................................. 359

Mute Dynamics .............................................................................................................................................. 360

Aggregate Optimization ................................................................................................................................. 361

Part 10 Expanding Guide ....................................................................................................................................... 363

Scripts ................................................................................................................................................................ 363

Build your own logic Preset ........................................................................................................................... 363

Page 13: MiarmyManualForV2.0

Miarmy 2.0 Manual

13 ©2011-2013 Basefount

Build your own channel Preset ...................................................................................................................... 363

Build your own automatic original agent setup pipeline .............................................................................. 363

Build your own automatic action creation pipeline ...................................................................................... 363

Particle Express for Hybrid Dynamics Effects ................................................................................................ 363

Command Line Tasks ..................................................................................................................................... 363

Command Line (Batch) for Developer ........................................................................................................... 363

API ...................................................................................................................................................................... 365

Write your own Field Node ........................................................................................................................... 365

Render Fur ..................................................................................................................................................... 365

Use Miarmy Engine Drive Maya Character ................................................................................................... 365

Miarmy Reference ................................................................................................................................................. 365

Callback Functions ............................................................................................................................................. 365

After Load Miarmy ......................................................................................................................................... 365

Before Save .................................................................................................................................................... 365

After Save ...................................................................................................................................................... 365

Selection Change ........................................................................................................................................... 366

Before Duplicate ............................................................................................................................................ 366

Reserved MEL Command .................................................................................................................................. 366

Cloth .................................................................................................................................................................. 366

Channel Reference List ...................................................................................................................................... 367

Page 14: MiarmyManualForV2.0

Miarmy 2.0 Manual

14 ©2011-2013 Basefount

Brief Thank you for reading this. This document listed and explained every detail of Miarmy. Before you reading this,

please make sure you already know some basic of Miarmy. This document explained many things in technical

under the hood and not a step by step tutorial. If you like to know or learn Miarmy from start, please refer the

PDF Miarmy Example tutorials and Miarmy Online video tutorials www.youtube.com/basefount.

Structure We organize this document like this:

Part 1 Main concept: This part explained the logic engine concept of Miarmy, the Miarmy infrastructure

contents and general workflow and pipeline for making project

Part 2 Menu Item: This part detailed listed all the menu item of Miarmy

Page 15: MiarmyManualForV2.0

Miarmy 2.0 Manual

15 ©2011-2013 Basefount

Part 3 Agent Infrastructure: This part listed and explained the agent contents we need create and how

to make them work.

Part 4 Logic in-depth: This part explained the logic workflow and pipeline in-depth and listed all the logic

algorithms of Miarmy Human Logic Engine.

Part 5 Logic & Simulation: This part explained all the perception contents under the hood workflow and

algorithm, such like road, zone, etc.

Part 6 Action: This part explained the action node, action transition mechanism and drive action in logic.

Part 7 Physical Simulation: This part explained the physical collision detection and dynamic simulation

and some more stuff under the hood.

Part 8 Rendering: This part explained the Miarmy caching mechanism and rendering workflow

Part 9 Optimizing: This part explained in-depth how you can optimize your scene.

Part 10 Expanding: This part explained using Script and C++ API for expanding Miarmy. (coming soon)

Part 1 Main Concept In Miarmy, we get rid of any node connections and programming, balanced the simplicity and diversity, and

dedicated designed a fuzzy logical based human logic engine for imitating how people thinking. And you can

easily construct complex logic just by several nodes.

Miarmy Human Logic Engine Concept Basically, people think things just like this, “If there is something happening, decide to do something”. For

instance, there are some obstacles in front of me, I decide to turn away and go around them. People always

make some decisions based on what is happening.

More specific, each “decision” contains “something happening” and “the next things want to do”. In Miarmy, we

call them “conditions (sentences input)” and “decisions (decisions output)”. People always make some decisions

based on the conditions.

Page 16: MiarmyManualForV2.0

Miarmy 2.0 Manual

16 ©2011-2013 Basefount

There may be many things happening together, so, we maybe have many decisions. From these decisions we

need figure out which is the correct next things to do. The process from decisions to behaviors is called “defuzz”

in Miarmy engine and this process is total automatic.

Additionally, in the process of defuzz, there may be several decisions conflicted. So, people will naturally make

priority for them. For example, someone in my left and near, I want to go right, but there is a cliff on my right,

without saying, I have to go to left for avoiding the fall. In this situation, go left and go right are conflicted

decisions, we need make a priority for them. Avoid cliff take higher priority than avoid each other. People always

make priority based on natural principles, and finally decide what to do next.

Generally, Miarmy Engine was built for trying to simulate the above brain process in human brain, conditions,

decisions, priority ranking and behaviors.

In Miarmy,

We use “decision node” to imitate the “the conditions and decisions”,

We use parenting hierarchy to rank priority for multiple “decision nodes”.

We make the “defuzz” (from decisions to behaviors) process totally automatic.

Decision Node Decision nodes are the basic units for simulating the Human Logic. In each one of decision node, there are

Several conditions tests

Some decisions to make.

We usually call these conditions as “sentences” and call the decision results as “outputs”. Miarmy engine will

test the “sentences” true or false with fuzzy logic, and then figure out whether and how much decides the

“outputs”.

Decision Node Pipeline

Defuzz Process Defuzz is the process based on your decisions figure out the behaviors, and this process is totally automatic. In

this process we need each decisions active and decisions priority. After that, we can assign the behavior to the

digital actor.

Page 17: MiarmyManualForV2.0

Miarmy 2.0 Manual

17 ©2011-2013 Basefount

Solving Decisions Active

The decision active is the condition test result of decision node. For example, if someone in my left and near, I

need go right and slow down.

Input Sentences:

1. Someone in my left

2. Someone is near

Output Decisions:

1. Decide go right

2. Decide slow down a bit

In this example, the decision active of this decision nodes is the condition test result of these input sentences.

We use the fuzzy logic to test conditions, and the result value will be a float value from 0 to 1. We will talk about

the sentences test later in detail. See Part 4 – Logic in-depth

Blue bound for conditions and yellow bound for decisions

Make Priority for Decision Nodes

For achieving the priority for decisions, we just need simply re-arrange the hierarchy of decision nodes.

Decision node priority ranking pipeline

In the following real example, character need to avoid each other, get around a zone and follow the road

direction. We need make the following priority ranking:

1. First priority: avoid each other

2. Second Priority: get around a zone

Page 18: MiarmyManualForV2.0

Miarmy 2.0 Manual

18 ©2011-2013 Basefount

3. Third Priority: follow road

Just re-arrange the hierarchy of these nodes we can achieve this:

Priority ranking by hierarchy

You can also group a bunch of decision nodes together and make this bunch of decision nodes totally lower

priority than the other bunch of nodes.

All of decision making process and priority ranking process are driven by Fuzzy Logic engine. We will explain the

in-depth algorithm and implementation in Part 4: Logic in-depth

Agent Brain Instantiate You may ask, a group of agent, all of them have the same brain, are their behaviors also the same??

No. The behavior is depending on the decisions, and the decisions are depending on not only the brain, but the

environment. Different agents are facing different environments. Therefore, they will have different decisions

and behaviors

Just like the picture below.

Page 19: MiarmyManualForV2.0

Miarmy 2.0 Manual

19 ©2011-2013 Basefount

The same brain in different condition, brings out different behaviors

Assets Management

Miarmy Contents

Miarmy_Contens Group is the main group contains all of Miarmy infrastructure. They are agent groups,

Perception_Set group and Placement_Set group

Miarmy Contents, General Group

Agent Groups

Usually there may not be only one kind of agent in scene. We group their contents in different groups and this

kind of group is McdAgentGroup node, we dedicated designed the McdAgentGroup rather than using group

node (Maya transform node), because we want them can be searched by engine easily. Technically,

McdAgentGroup node is the same as transform node. In addition, there are many extra attributes on this node.

And we call them “Agent Type Attributes”

Page 20: MiarmyManualForV2.0

Miarmy 2.0 Manual

20 ©2011-2013 Basefount

Extra attributes on McdAgentGroup node

And for each type of agent, there are several kinds of contents in different groups. The contents in each agent

group node, only belongs to their specific agent type. They are shown in following image, and we will introduce

them in details.

Agent Group Structure

Setup_<agentName> under Agent Group Node

This group contains the user defined character rig. And this rig is usually should be referenced into Maya scene

for keeping you scene clean, because this rig will not be useful when all agent infrastructure created. We just

need reference its bone structure for easily deleting after everything is done.

Page 21: MiarmyManualForV2.0

Miarmy 2.0 Manual

21 ©2011-2013 Basefount

A rig been referenced to scene under Setup Group

Original_<agentName> Group under Agent Group Node

This group contains a bone structure with exact the same as the character rig. Original agent is the template of

agent and contains many necessary attributes which character rig doesn’t have. When we place the agent out,

we also need the original agent to provide some extra information, such like the render, cloth, matching

information. We will continually provide more information throughout this entire document.

Action_<agentName> under Agent Group Node

This group contains all the action nodes, the action nodes are generated from animated Character Rig and

responsible for drive the agent to the target poses. For more details about the action nodes, please check out

the “action” chapter.

ActionProxy_<agentName> under Agent Group Node

This group will contain an only one node if you create action proxy. The action proxy is a fairly simple node only

contains a list of action names. If you already create some actions for this type of agent, you can fill some

existed action names into action proxy list and our engine will take place the logic procedure and perform the

actions inside this list cyclically, one by one. For more details about action proxy node, please check out the

“action Proxy” chapter

TransitionMap_<agentName> under Agent Group Node

This group contains the action shell and state nodes. They are the element nodes of the Transition Map. For

more detail about the action transition, please check out the “Transition Action” and “Transition Map Viewer”

chapter.

Decision_<agentName> under Agent Group Node

This group contains all of the logical decision for this type of agent. With these nodes, we define the agents’

brain and behaviors

Page 22: MiarmyManualForV2.0

Miarmy 2.0 Manual

22 ©2011-2013 Basefount

Geometry _<agentName>under Agent Group Node

This group contains all the geometries of this agent type need to be rendered. Just using the simple structure

arrangement you can achieve the random geometries. For details, please check out the “random geometry” in

“render” chapter.

Perception_Set Group

All of the perception contents node will be located in this group after them firstly been created, there are lot of

types of perception content, such as road, bound, zone, field, etc. For more detail, please check out the

“Perception Contents” chapter

Placement_Set Group

All of the place nodes will be located in this group after them firstly been created. Place node is a pre-

visualization of the agents would to be placed. This node will provide a visible position and rotation for the

agents to be populated and let the users setup their transformation and proportion. For more details, please

check out the “Placement” chapter

Naming Conventions Note: This naming convention is only available in current version. In future, the naming might be more arbitrary.

Animation Rig

Rig joints and controls can be any naming including namespace

Original Agent, Action, Action Shell, State and Decision

<Name>_<Node Type>_<Agent Type Name>

Example:

The agent type name is casual

Original Agent Joint: torso1_ogb_casual

Action Example: standToRun_action_casual

Decision Example: default_decision_casual

State Example: walk_state_casual

Action Shell Example: jog_actionShell_casual

Page 23: MiarmyManualForV2.0

Miarmy 2.0 Manual

23 ©2011-2013 Basefount

Bounding Box and Action Proxy

There is unique bounding box in each type of agent, and also Action Proxy node

<Node Type>_<Agent Type Name>

Example:

Original Agent Bound Box Example: BoundingBox_casual

Action Proxy Example: actionProxy_casual

Geometry

Geometry cannot contain namespace comma “:”, except, it can be any name

General Pipeline In this chapter we will introduce the general pipeline of all Miarmy throughout. But this is just a general

introduction, if you want to know the details, please refer the specific part and chapter.

Plan

Crowd simulation sometimes is a little bit complex that you have to consider the entire pipeline throughout

from modeling to final rendering. We need plan it carefully before we start it. Here we listed some important

stuffs you need plan them in details before starting.

Models complexity for rendering speed

If you have many complex models for each agent, it is going to be difficult for rendering. So please plan

the complexity of your models based on the shot and agent number.

How to do the animation and Action

You need consider which action you need the agent have, so you need prepare them before started, you

can use any type of animation keyframe, preset packages or motion capture are ok.

Logic complexity

We need carefully plan which the behaviors we want to the agents perform and which the logic can

achieve these. Then we can plan which decision the agents need make. And which the perception we

have to create. If the scene is too large, you need consider using the Decrease Intelligence Mechanism

or making some agents with very low-intelligence for filling the scene.

Agent types

You need consider how many types of agent you need, such as solider and enemy. Each one has a color

and some specific attribute such like sound range, vision range, density etc.

Page 24: MiarmyManualForV2.0

Miarmy 2.0 Manual

24 ©2011-2013 Basefount

Whether we need perform crowd dynamics

If you want to let your agent been enable ragdoll dynamics, you need plan them from start. When

agents perform dynamics, each of the character bone will be transformed to RBD, so each bone should

have length. Mute some agents are never going to be enabled dynamics for saving huge time. Plan the

collide body etc.

Which renderer you need to use

For current version, if you want to render you scene by Renderman, you need install 3delight.

If you want to render you scene with Mesh Drive and arbitrary type of renderer, you need first consider

the complexity of your character model because mesh drive need duplicate all the geometries out and

drive them. See “Mesh Drive”

Prepare

Rig

In this step we usually reference rig to scene, or if you want, you can build your own one. The rig has to

obey some limits, please check out the “rig” chapter

Animation

We create action node for agent from animated character rig with same structure, so you need prepare

these animated character before starting.

Create Agent Infrastructure

Original Agent Create and Check

In this step we need build original agent from character rig. If everything of rig in all right, the original

agent will be the exact same bone structure as character rig, without all of the controls like the IK solver

and constrains. The original agent is the blueprint template of agent. For more about the original agent,

please check out the “original agent” chapter

Original Agent Refine

Then we need fine-tune the original agent in many aspects. Setup bone attribute, setup agent attribute,

adjust the bounding box, set flags, etc.

Physical Setup

If you want to your agent can be enable dynamical ragdoll or be influenced by the force field, you need

setup the physical bones and joint correctly and carefully. Also you need setup the collision detection

flags (see “Original Agent” and “physics simulation” part)

Page 25: MiarmyManualForV2.0

Miarmy 2.0 Manual

25 ©2011-2013 Basefount

The original agent, left: physical joints, right: original agent bounding box

Simple Render Test

You need skinning all of the geometries to original agent so that our engine can render it. In this step,

we usually create a very simple placement node and place the agent out and render some agents.

A simple setup and placement

Test render by mental ray and 3delight

Page 26: MiarmyManualForV2.0

Miarmy 2.0 Manual

26 ©2011-2013 Basefount

For Logic and behavior

Create Perception & Logic

In this step we need create the planed logic for the agent, and make perception contents like road, zone

into your scene.

Test simulation, fine-tuning, and optimizing

In this step we need place part of the agents out and check is that everything running ok. Please notice,

we are not recommended you place full number of agents for now. Small group of agents are easier for

debugging and designing the logic of them.

Usually you need find-tune the data in logic node for achieving better results. Also, you can continually

add perception contents and logic in any time even in simulation playing back.

Optimization

You can optimize your scene in many aspects. You can decrease the intelligence of many agents in real-

time, mute some agents’ dynamic etc. See dedicated Part 9, Optimization

Generate Crowd and Preview

After you satisfying your setup, you can place all of your agents out and check out the entire scene in

your shot

Rendering and output

Caching

After caching, you can achieve interactive playback for your large scene. You can easily watch your

finally results. Also, the deformation motion blur can be rendered out only after caching.

Get rid of error agents

If some of agents are not correct, we recommend you get rid of them out of the shot. But you cannot

delete the agent directly because this agent will appear again after next placing. What you need to do is

using a Maya expression to put these agents out of the screen. Just like “McdAgent1.ty = 100000;”

Render it!

If you satisfy your scene, you can render it by 3delight directly or duplicate these geometries out and

render them by any other renderer. You also can make geometry cache or Alembic cache for exporting

to others package for VFX and rendering.

Page 27: MiarmyManualForV2.0

Miarmy 2.0 Manual

27 ©2011-2013 Basefount

Solver

Solver Contents

When you click the Miarmy > Miarmy Ready, the solver contents have been created, they are “McdBrain”,

“McdBrainPost” and “McdGlobal”, without these nodes, you simulation is not going to start.

Solver setup and contents creation

Simulation Pipeline

Each time update, Miarmy will do the following things if the simulation is not broken.

1. The McdBrain is responsible for collecting the information from scene. Such as the agent information,

the perception contents information, etc.

2. Then, McdBrain will send the collected data to engine.

3. The engine will calculate out the result, such as the agent transformation and posing.

4. The McdBrainPost is responsible for updating the scene using the engine results

Simulation Pipeline

Page 28: MiarmyManualForV2.0

Miarmy 2.0 Manual

28 ©2011-2013 Basefount

Reset, Update, Pause and Break Mechanism

There are 4 statuses of solver which are “reset”, “update”, “pause” and “break”.

Suppose that the start time of engine is 1, we can set it by McdBrain.startTime

Green: reset, Yellow: update, Red: will break simulation

Take a look at the green point, any time you can reset your scene by setting current time to start time (or before

start time)

As the yellow arrows shown, the engine can simulate and update Maya scene correctly, when playback from

start time and frame by frame.

If you jump frame back or jump more than one frame, the simulation will break, just like the red arrows shown.

At this time, the engine will never solve until you reset it (back to start time).

If simulation has been paused at the “x”th frame, you can jump time as you like, but before resuming it, you

need set the time when the time simulation break which is the “x”th frame. You can pause the simulation in

Miarmy Global.

Reset: the agents will be set back to initial status, meanwhile, some information in agent memory will

be clear and reset, such as the physical stuff, cloth buffer, etc.

Update: simulation in progress, engine is still working for updating scene

Pause: simulation stop but can resume later

Break: simulation will not continue proceed any more until reset.

Non-Connection Sequential Node Communication

Using some non-traditional Maya techniques, we designed a non-connection sequential node communication

solver. So, there are no connections among any Miarmy nodes for data transferring. All of data transfer is

happening in memory. When we create the Miarmy scene, we don’t need hypergraph anymore.

Page 29: MiarmyManualForV2.0

Miarmy 2.0 Manual

29 ©2011-2013 Basefount

Page 30: MiarmyManualForV2.0

Miarmy 2.0 Manual

30 ©2011-2013 Basefount

Part 2: Menu Items

Menus

Miarmy Ready!

Click this button system will do the follow things for you:

1. Setup Playback Options:

a. Update all viewport

b. Play every frame

c. By 1.0 frame for each update

d. Max playback speed is realtime (depending on the user specify, 24fps or 30fps)

Page 31: MiarmyManualForV2.0

Miarmy 2.0 Manual

31 ©2011-2013 Basefount

2. Create Something:

a. Create a McdBrain node if not exist

b. Create a McdBrainPost node if not exist

c. Create a McdGlobal node if not exist.

d. Create Miarmy_Contents group and some preset stuffs

Miarmy Contents:

Agent group 1: agent repository

o Setup: rig location (usually reference into the scene)

o Original Agent: template for current agent

o Action: Miarmy action generated by Maya animation

o Action Proxy: an action list node can proxy all action playback

o Transition Map: state and action for build transition map

o Decision: logic entity

o Geometry: binding geometry

Agent Group 2

o …

o …

Agent Group 3

Miarmy Contents Check

It will check the naming convention and integrity of Miarmy_Contents group and stuff inside.

It will try to fix the naming in specific group.

Maya 2012 Import

Page 32: MiarmyManualForV2.0

Miarmy 2.0 Manual

32 ©2011-2013 Basefount

Maya 2012 cannot import contents without name prefix or namespace. This tool let you import contents

without changing the name of objects.

Miarmy Global

Transition Type

o Use Simple Transition

If enable, the transition map will be ignored by engine. Transition will automatically happened

by themselves between any 2 actions.

Page 33: MiarmyManualForV2.0

Miarmy 2.0 Manual

33 ©2011-2013 Basefount

Solver Options

o Stop Feedback

If enable, the agent will not send information to Brain Viewer. It will save your time if you are

already done the logic construction.

o Pause Solve

If enable, the simulation will be paused. And if you disable this at the frame you enable this, the

simulation will continue.

o Start Time

Specify the simulation start frame.

Agent Cache Options

o Enable Agent Cache

Enable agent cache, make the engine find cache file instead of solving

o Is Cache Bone Translate

If enable, when making cache, the translate information will be recorded. When assigning, the

translate information will be set to bone. It’s useful for record break body like the sword and

shield

o Cache folder

Specify in which the cache file located, the path should be accessible

o Cache Name

Specify the cache file name such as “scene001cache”

o Cache Offset

Frame offset when apply cache to scene.

Mesh Drive Options

o Start Agent Global ID

Specify the first agent which will perform mesh drive

o End Agent Global ID

Specify the last agent which will perform mesh drive, mesh drive will enable the agent id

between these 2 values

o Enable Progress Bar

Show updating progress bar when agents drive their meshes

o Clear

Delete all duplicated meshes

o Duplicate Mesh

Duplicate meshes for agents, from start ID to end ID

o Pairing Meshes and Agent

Mapping agent to their paired geometries in agent memory

o Enable Mesh Drive

Page 34: MiarmyManualForV2.0

Miarmy 2.0 Manual

34 ©2011-2013 Basefount

Enable mesh drive for update meshes.

Note: if you change your frame rate of this scene in Maya Preferences, the start time will change. You need

to fix it to the correct value.

Physics Global

Page 35: MiarmyManualForV2.0

Miarmy 2.0 Manual

35 ©2011-2013 Basefount

Solver

o Each Step Time:

Specify how much time will proceed in one Maya frame

o Sub Step:

Specify how many steps will make in Each Step Time

o Is Self-Collide:

Specify whether you need enable collision on bones of single agent

o Gravity X:

Gravity acceleration in X direction

o Gravity Y:

Gravity acceleration in Y direction

o Gravity Z:

Gravity acceleration in Z direction

Agent Body

o Stop Apply Force Speed

When the speed of RBD exceeds this value, the force field cannot add force on to it.

Page 36: MiarmyManualForV2.0

Miarmy 2.0 Manual

36 ©2011-2013 Basefount

Agent Cloth

o Cloth Density

The particles’ density of cloth

o Vertical Stretch Stiffness

Stiffness in vertical direction, bigger value leads harder deform in vertical space

o Horizontal Stretch Stiffness

Stiffness in horizontal direction, bigger value leads harder deform in horizontal space

o Shearing Stretch Stiffness

Stiffness in diagonal direction, bigger value leads harder deform in diagonal space

o Bending Stretch Stiffness

Stiffness for bending, bigger value leads harder bending or curling.

Default Plane Terrain

The attribute effect on the plane terrain default created.

o Dynamic Friction

The friction force when object is moving on terrain

o Static Friction

The friction force when object is before moving on terrain

o Restitution

The energy of bounces back from collision, increase this make object bounce greater on the

default terrain

Field Multiplier

Exclusive adjust the force effect on the rigid body of Miarmy. If the Maya field or fluid affects both

Miarmy contents and Maya contents, you can adjust these values to change the result only on the

Miarmy contents.

o Field Force Multiplier

The value will be multiply the result force effect on the rigid body from Maya field

o Fluid Force Multiplier

The value will be multiply the result force effect on the rigid body from Maya fluid

Render Global

Page 37: MiarmyManualForV2.0

Miarmy 2.0 Manual

37 ©2011-2013 Basefount

Summary

First line: The result folder name of output image or rib

Second line: The result file name of output image of rib

Image File Output

The attributes can change the file export name, format and path

o Output Folder

The location your image files of each pass will output

o Ribs Name(Rib/)

The file name of RIB file

o Pics Name

The file name of image file

o Extension

The file name extension

o Image Format

The format of output image

Page 38: MiarmyManualForV2.0

Miarmy 2.0 Manual

38 ©2011-2013 Basefount

o Start Frame

The frame the render will start

o End Frame

The frame the render will end

o Frame Padding

The bit of digits of file name endin

Renderable Camera

Adjust the camera attributes

o Renderable Camera

Select the renderable camera here

o Alpha Channel

Enable this if you want to export alpha channel

o Depth Channel

Enable this if you want to export depth channel

o Camera Motion Blur

Enable this if you want ot apply motion blur when camera is moving

Image Size

o Preset

Choose width and height presets

o Width

The X resolution of output image

o Height

The Y resolution of output image

o Copy from Maya

Copy the same setup from Maya Render Global node

Split Render

To know more about split render, please refer the render part of this manual.

o Split X

The number of parts the viewport should be split in horizontal space

o Split Y

The number of parts the viewport should be split in vertical space

o Bound Filter

The filter pixels which between any 2 split parts

Page 39: MiarmyManualForV2.0

Miarmy 2.0 Manual

39 ©2011-2013 Basefount

Texture Options

o Generate .tex Everytime

The system will generate a .tex texture file for each of texture file and send the .tex file to the

RenderMan renderer when rendering. By default, the system will check the existence of

that .tex file, if there is .tex file exist, system will not generate them again. If you need convert it

every time, please enable this.

Image Quality

The attributes exclusive belong to RenderMan and control the quality of output images

Please refer the RISpec if you want to know them in details

o Shading Rate

Minimum rate of surface shading

o Pixel Sample X

Sampling rate in the horizontal directions

o Pixel Sample Y

Sampling rate in the vertical directions

o Filter method

Antialiasing by filtering the geometry (or supersampling) and then sampling at pixel locations

o Pixel Filter X

The filter in horizontal directions

Page 40: MiarmyManualForV2.0

Miarmy 2.0 Manual

40 ©2011-2013 Basefount

o Pixel Filter Y

The filter in vertical directions

o Deformation Motion Blur

Enable this to enable deformation motion blur, only available with agent cache

o Motion Blur

Enable this to enable motion blur

o Shutter Open

The times at which the shutter opens

o Shutter Close

The times at which the shutter closes

Ambient Occlusion Options

o Occ Sample

Increase this can get smoother result (less noise) but take more time to render

Render Passes Setup

Specify which pass or passes should be rendered

If in preview mode (Miarmy > Render Preview), renderer will render the first option which

enable here.

If in batch mode (Miarmy > Render Extra > Render Batch to Image Files/RIB Files), renderer will

render all the options enabled here.

Render Preview (i-display)

Render current frame from current active viewport and put the image to the frame buffer (or i-display). The pass

to be rendered should be the first pass enabled in Render Pass Setup of Render Global.

Render Extra (sub menu)

Page 41: MiarmyManualForV2.0

Miarmy 2.0 Manual

41 ©2011-2013 Basefount

Foreground Render

Open Maya Render View, and render this scene from start frame to end just inside of Maya

Render Batch to Image Files

Render this scene from start frame to end frame and output the images to the folder been specified in

Render Setting

Render Batch to RIB Files

Convert the scene to the RIB files start frame to end frame and output the RIB files to the folder been

specified in Render Setting

Add Subd Attribute

Add 2 attributes to the selected objects, so that the objects can be recognized to the subdivision mesh

by the render engine.

Delete Subd Attribute

Remove the 2 attributes of subdivision mesh flags from selected objects

Add Displacement Bound Attribute

Add an attribute to the selected objects, so that the renderer will use this value when dealing with

displacement shader

Delete Displacement Bound Attribute

Remove the attribute of displacement bound from selected objects

Add Matte Attribute

Add an attribute to the selected objects, so that the renderer will render it totally black but alpha

channel existed.

Delete Matte Attribute

Remove the attribute of matte from selected objects

Note: if this attribute is added to the agent instead of geometry, the specific agent will matte out all the

geometries it used

Page 42: MiarmyManualForV2.0

Miarmy 2.0 Manual

42 ©2011-2013 Basefount

Agent Viewer (Auto Focusing)

The Agent Viewer will display the bone structure and some flags set in Agent memory

Bone structure:

The name of bone in memory, it can be used in channel, like torso1:tx

Flags

(@) sign

This bone will join collision check if using “collide” channel

(*) sign

This bone can feel field and fluid when dynamics is turned on

Agent Manager

Page 43: MiarmyManualForV2.0

Miarmy 2.0 Manual

43 ©2011-2013 Basefount

Agent manager can determine which type of agent is activated. System will create contents such as logic

decision nodes or action nodes for the active agent and put the contents inside the active agent group.

Active

Active the agent type in this line

Modify

Modify the name of agent

Delete

Delete all the contents of this agent

Color buttons

Select color for active agent, when the agents are placed, the color of bones will be the same color

selected here

Add Agents

Add a new type of agent to scene

Terrain Manager

Page 44: MiarmyManualForV2.0

Miarmy 2.0 Manual

44 ©2011-2013 Basefount

Terrain manager can mark geometry terrain. When the geometry is marked terrain, the agents can interactive

with it and the rigid body can collide in it. In fact, the geometry which been marked terrain is connected by a

McdTerrain node.

Terrain Node

The McdTerrain node name which connected to terrain geometry

Mesh

Actual mesh name been marked terrain

Dynamic Friction

The friction force when object is moving on terrain

Static Friction

The friction force when object is before moving on terrain

Restitution

The energy of bounces back from collision, increase this make object bounce greater on the terrain

Is anim

Enable this if the terrain has animation or deformation.

Is Plane

Enable this if the terrain is a plane, it can speed up the physical simulation

Select

Select the transform node of this terrain geometry.

Visualization

Sound range switch

Switch on/off the sound range

Vision range switch

Switch on/off the sound range

Page 45: MiarmyManualForV2.0

Miarmy 2.0 Manual

45 ©2011-2013 Basefount

As the picture above, the red circle is sound range, and the green frustum is the vision range.

Setup Rig

Miarmy provide a free setup pipeline tool, which can generate a simple rig from the template.

Import Template

Import template with default pose

Import Template (Preset Pose)

Import template with the preset pose

Setup Rig

Convert the template to the rig

Import Standard Bone Tree

Import a clean and preset posed bone chain which can be used to motion capture

Page 46: MiarmyManualForV2.0

Miarmy 2.0 Manual

46 ©2011-2013 Basefount

Above 3 pictures, from left to right:

1. Template with default pose

2. Template with preset pose

3. Bone chain with preset pose

After setup, the rig has been generated.

Original Agents

Create Original Agent

Create Original Agent if there is correct rig in Setup group for the active agent type

Create Original Agent (Preset Pose)

Create Original Agent with many preset setup

Page 47: MiarmyManualForV2.0

Miarmy 2.0 Manual

47 ©2011-2013 Basefount

Select Skin Bone and Geo

Selete all the joints except end ones from current active original agent

Hide Bone Shape

Hide all the box shape of the bone

Unhide Bone Shape

Hide all the box shape of the bone

Re-create Original Agent

Delete the current active original agent and create it again. If you delete some important part from

original agent, you can use this tool

Delete Original Agent

Delete the current active original agent

Create Bounding Box for Agent

Create bounding box for current active agent

Shape Box Adjustment (This feature is not finished yet)

Go Original Pose

Clear all rotation value from original agent and put it to the origin

Send Active Geo to Original Agent

Copy geometries and skinning info from setup rig to Original Agent, only can work on active agent type

Placement

Create Placement Node

Create a placement node for you

Placement Editor

Page 48: MiarmyManualForV2.0

Miarmy 2.0 Manual

48 ©2011-2013 Basefount

Placement editor can setup the proportion for the selected placement node

o Proportion Setup (slider)

Only the place-able agent type can be listed here. The agent with original agent is correct agent

type. Move any of the slider, the others types will automatically update except 0 proportion

type

0 proportion

Crank down to 0 for turning off this type of agent place

o Make Even

Auto averaging all the proportion of exist types

Place

Populate agent to scene.

De-Place (Delete All Agents)

Delete all the agents and flush the undo queue. We not recommended delete agents by “del” key

because that the agent is actually leave there in memory.

Inverse Place

Create a brand new place node from the selected agents, and this will record follow info:

o Parent node of each agent

o Type of each agent

o Translate and Rotate

o Mute dynamic flag

Attach Terrain

Attach place node to the selected terrain

Page 49: MiarmyManualForV2.0

Miarmy 2.0 Manual

49 ©2011-2013 Basefount

Detach Terrain

Detach place node from terrain

Attach Curve

Attach place node to the selected curve

Detach Curve

Detach place node from curve

Mocap

Import Standard Bone Tree

Import a clean and preset posed bone chain which can be used to motion capture

Human IK (available next time)

Characterize (available next time)

Actions

Create Action

Create an action node, then playback once and store the animation data to this node, from rig (with

animation) to action

Action Editor

o Basic Attribute

Page 50: MiarmyManualForV2.0

Miarmy 2.0 Manual

50 ©2011-2013 Basefount

Length

The length info of current selected action

Rate

The playback speed multiplier, e.g. 2 means playback speed is 2 times than normal

Is Final

Enable this means that once agent transit to this action, never transit out, e.g. dead

o Transition

Control the transition between 2 actions

Is Cycle

Enable: cycle action (e.g. walk), Disable: transition action (e.g. standToWalk)

Cycle Filter

A percent value stand for a smooth filter when the action performing self-cycle

transition

Entry Range

The range of transition from previous action to the current one

Exit Range

After this percent range, this action can transit to next action, before that, it playback

itself

o Agent Transform Speed

The speed of transform node of the agent, this can create the locomotion result, please check

out the detail of this in Animation and Action session

Channel(TX, TY, TZ, RX, RY, RZ)

Block/Open the channel on agent transform node

Auto Fill

Use the preset channel preset

Rebuild

Important: After editing the channels, user need click this rebuild button make it works

o Agent Transform Fix

This feature can offset the result of transform speed of the root, e.g. one of the motion capture

data is x-oriented, but one can use this feature to rotate it back to z-oriented action

Transform Data

Specify which channel and how many values need offset

Fix Agent Transform

Once specify the value in blank, click this for performing offset

o Exit Choices

In different phase, action can transit to different next actions. We can specify the exit choices

here

Exit Action

The list of actions which the current action will transit to

Start Frame & End Frame

Between start and end frame, the current action will transit to this exit action if there is

a transition signal

Page 51: MiarmyManualForV2.0

Miarmy 2.0 Manual

51 ©2011-2013 Basefount

Preview Bar

Preview in which phase we can transit to which exit action

Create Action Proxy

Create an action proxy node for current active agent type

Action Proxy Editor

Action proxy can check the transition between any actions and see is them transit smooth or correct

For more details of action proxy, please check out the Transition session of this manual.

o Active

Activate/deactivate element of agent name

o Play list

The names of actions in list

o Set

From right to left set

o Available Actions

Choose which action to be set

Transition Map

Page 52: MiarmyManualForV2.0

Miarmy 2.0 Manual

52 ©2011-2013 Basefount

(Note: need switch to the transition map viewport)

Move tool

Click and drag to move the states and action shells in transition map viewport

Create State

Create a new state node for current active agent type

Create Action Shell

Create a new action shell node for current active agent type

Add/Edit Action Group

Add an action group flag to the selected action

Cancel Action Group

Remove the action group flag from the selected action

Knowledge Perception

Please check out the channel spec for the detailed information

Create Solver Space

Create a solver space node

Create Road from Curve

Create a road object from your selected curve, the agent can feel it

Attach Road to Terrain

Page 53: MiarmyManualForV2.0

Miarmy 2.0 Manual

53 ©2011-2013 Basefount

Attach the road to terrain

Road Mode Switch

Switch road between flow and road modes

Create Bound

Create bound box/sphere so that the agent can feel it

Create Spot + Force Field Combo

Create a spot node and set the Feel Mode to “both”

Create Spot

Create a spot node and set the Feel Mode to “Only Spot”

Create Force Field

Create a spot node and set the Feel Mode to “Only Field”

Create Wind

Create a wind node so that the agent can feel it

Create Zone

Convert the selected geometry to zone object

Select Zone Node

Select the geometry firstly, and then this tool can help you get the related zone node

Logic and Decision

Make Decision

Create a decision node for the active agent type, for detail, please check out the logic part of this

manual

Decision Node Editor

o Input Part (Normal Mode)

The inner logic part

Make Default/Global Button

Change the current selected decision to Global Mode

Active

Activate/Deactivate of this sentence

Priority

Page 54: MiarmyManualForV2.0

Miarmy 2.0 Manual

54 ©2011-2013 Basefount

The priority of this sentence, bigger value has higher priority

Logic

The operate before this sentence

Not

Determine whether invert the logic result

ID

The Identity of this sentence assigned by the system

Input

Input sentence

Inf

Whether infinity for the fuzzy range in, e.g. “< 10” means negative infinity to 10

Min

The minimum/start value of range in which the result will be true

Inf

Whether infinity for the fuzzy range out, e.g. “> 10” means 10 to positive infinity

Max

The maximum/end value of range in which the result will be true

Fuzzy In

Blur the start of true range, not available when negative infinity

Fuzzy Out

Blur the end of true range, not available when positive infinity

Input Type

Chose the input type between max or average

Max

Take the result which makes this sentence fully activated

Average

Take all the results and calculate out the average, then calculate the activation

of this sentence

Auto Fill

Some presets for the user, one can add new preset in McdSentencePresetListGUI.py

Move Up

Change the order between 2 sentences up and down, move current sentence up

Del

Delete current sentence

Parse Result

The result of inner logic

o Output Part (Normal Mode)

Active

Page 55: MiarmyManualForV2.0

Miarmy 2.0 Manual

55 ©2011-2013 Basefount

Activate/deactivate output channel

Decision

The output decision

Value

The output value if full activated

Auto Fill

Some presets for the user, one can add new preset in McdDecisionPresetListGUI.py

o Decision (Global Mode)

Make Normal Button

Change the current selected decision to Normal Mode

Default Action

Play this action when there is no other action activated.

Active

Activate/Deactivate the default output channel

Decision

The output channel

Default Else

System will use this value when the channel are not been activated

Output Type

The output value change type, absolute value or change rate

Defuzz Type

The output defuzz type average/blend/max

Auto Fill

Some presets for the user, one can add new preset in McdDecisionPresetListGUI.py

Preset Logic Behavior

Create the preset logic decision nodes for current active agent type

Physics

Page 56: MiarmyManualForV2.0

Miarmy 2.0 Manual

56 ©2011-2013 Basefount

Cloth Setup

o Attach Cloth (Tip: points to box)

Mark cloth for selected geometry and attach the selected points to the bone shape of original

agent (firstly select the cloth points, then the bone box shape)

o Clear Cloth

Unmark the cloth for the selected geometry

Force Field

Create PhysX force field

Kinematic Primitive

Create PhysX kinematic Primitives

Create PhysX Debug Node

Create a PhysX debug node which can display all the contents of PhysX scene.

Debug Tools

Create PhysX Debug Node

Create a PhysX debug node which can display all the contents of PhysX scene.

Agent Match

Page 57: MiarmyManualForV2.0

Miarmy 2.0 Manual

57 ©2011-2013 Basefount

Match the original agent to the selected agent, this feature is used to integrate your baking or rendering

pipeline

Agent Return

Put the original agent back to origin and default pose

Re-Link Miarmy

Reconnect your Miarmy if you install a new version in the other place

Un-Link Miarmy

Disconnect Miarmy from this Maya

3Delight Setup

Check Renderer Status

Check is your 3delight been installed correctly, check are your 3delight paths been setup correctly, check

are your 3delight shaders been compiled ok, etc. If there is anything incorrect, the finished dialog will

report them

Compile Shaders

Find the source code of shader in Miarmy installation place and compile using your installed 3delight

program, then put the result shaders into 3delight shader path

Remove 3delight.dll

Remove the 3delight.dll from your Maya bin folder. Because system will copy a 3delight.dll to your Maya

bin folder when installing, this 3delight will proxy/take over the 3delight of yourself if you already using

your own 3delight. Delete the 3delight Miarmy provided here.

New Icons GUIs and

Credits

Special Thanks,

Page 58: MiarmyManualForV2.0

Miarmy 2.0 Manual

58 ©2011-2013 Basefount

The New Icons, Toolbar and new control Menu with a lot of useful and handy tools are created by Thanapoom

Siripopungul from Luma Pictures. We really appreciate his brilliant skill and kindest help! And we’ll continue

work together and provide better tools for you.

The Tools

Toolbars

“Main GUI” and tools created by Thana

Proxy List Easy Control

Main GUI has some cool features like the proxy list operators

Add action proxy

Page 59: MiarmyManualForV2.0

Miarmy 2.0 Manual

59 ©2011-2013 Basefount

You may notice there are many more operations than Miarmy Proxy Editor and much easier to operate on the

action proxy list. The result will sync to Miarmy Proxy List.

(left) Main GUI, (right) Miarmy GUI, they will sync

Action Shells Handy Tools

Another very handy tool is auto create action shells, in the Main GUI, ACT tab, user can multi select the action

name list and then click “Create Multiple Action Shell”, the action shell will automatically create in Transition

Map

Page 60: MiarmyManualForV2.0

Miarmy 2.0 Manual

60 ©2011-2013 Basefount

Specify action and get ready for action shells creating

After some re-arrangement, it can be listed in Map

Created action shells

Also there is a tool can assign action group for selected action shells list together. Just load the right list “Load

Action Shell” and then click “create multi action group”

Page 61: MiarmyManualForV2.0

Miarmy 2.0 Manual

61 ©2011-2013 Basefount

Mark action group for multiply action shells

Also many tools very useful, if you interesting, please just use it and give us feedback and we can improve them

for you

Part 3: Agent Infrastructure

Rig Animation Rig can be anything, FBIK, Human IK, or any kind of custom Maya joint system. Miarmy need the joint

structure of your rig for generating the Original Agent and fetch the animation data from that, and nothing else.

Just making sure your bone structure obey some rules and everything will be OK.

Page 62: MiarmyManualForV2.0

Miarmy 2.0 Manual

62 ©2011-2013 Basefount

Bone structure

Single Chain Joint Structure

You should make sure your rig is a single chain rigging system. Single chain rigging system means each of the

joint (except root) must have a joint parent. No matter how many children nodes under each joint, and no

matter how many constrain and IK, just make sure each bone has a joint parent. Notice the following 2 pictures,

the left one is an example of single bone chain, because each joint (except root) in structure has a joint parent,

although joint 2 have several non-joint children. However, the right picture is not a single bone chain. Please

notice the parent of joint 3 is locator 2. The locator 2 breaks the chain.

(Left:) single chain rig; (right:) non single chain rig

Bone with length

If you like to enable dynamics on your rig, please make sure each bone has a length, otherwise, once you enable

dynamic for the agent originate from this rig, your dynamic system will unstable, even might crash Maya

The joint2 and joint3 overlapped and the joint2 doesn’t have length

(Green:) correct joint2 with length (red:) joint2 and joint3 overlapped without any length

Page 63: MiarmyManualForV2.0

Miarmy 2.0 Manual

63 ©2011-2013 Basefount

Bone Naming

We highly recommend you make the name of the bone unique because the repeated name may bring some

unpredictable problems. Non-unique name is no problem in most case but we are not sure is there further

problem in features of coming future.

Please take a look at the following 2 pictures, the left one contains some joints which name is not unique

whereas the right bones are all unique name.

(Left:) joint name non unique; (right:) joint name unique

And once you select a joint with non-unique name, the verbose in script editor will be its full dag path instead of

its node name.

Select the non-unique name of joint

Joint Orientations

The root joint should orient to positive Z axis, because all of Miarmy engine algorithms (like the sound, vision,

field and so on) and action system take the +Z axis of agent as the face front. Please make sure your rig and

animation is facing to +Z axis.

Page 64: MiarmyManualForV2.0

Miarmy 2.0 Manual

64 ©2011-2013 Basefount

Facing to +Z axis

About binding

The geometries on the rig will not join the render pipeline, you need duplicate and bind the geometries to the

original agent (and we have script can do this for you automatically). We will talk about this in following

chapters

Original Agent

What is Original Agent? And why we need it?

Original agent is the blueprint or template of agents. It is generated form animation rig. Original agent contains

a bunch of Miarmy necessary information we need them to populate agents. Each one of Original Agent is

responsible for populating one type of agent.

You may ask, if we have ability to populate agents directly from animation rig, why we need Original Agent. The

answer is obvious:

Animation rig is complex and contains many extra useless nodes and information for building agents.

These stuffs will make Maya scene messy.

Original agent has much extra necessary information and nodes when populating agents. We don’t want

to add these stuffs directly to your animation rig.

So, the animation rig is not part of your Miarmy scene, usually we just need it to be referenced to scene.

Page 65: MiarmyManualForV2.0

Miarmy 2.0 Manual

65 ©2011-2013 Basefount

Original agent is a main and important part of your Miarmy scene. It contains the same bone structure

information of the animation rig, contains enough necessary information to populate agents. Additionally, it is

very “clean and clear”

Creating Original Agent

For creating original agent, you need firstly make sure that your animation rig meets the requirements we

mentioned above and then just simply put you entire rig into the “Setup_<AgentName>”. And you can create

original agent with menu item Miarmy > Original Agent > Create Original Agent.

There is another situation we need notice. Some rigging system has control joints structure and deformer joint

structure, please make sure your deformer joint structure above the control joints. Or you can make the

Once you click “Create Original Agent”, our code will parse the structure from your animation rig and create a

new rig based on your rig. After that, it will add a bounding box for each joint of the new rig. The new created

From another point of view, if you original agent can be created correctly and successfully, that prove that your

animation rig is ok.

Agent Group Node and Agent Type

The agent group nods is the root node for managing all the contents of one agent type. Our system distinguishes

different agent types using this group node. You can add, edit or delete the agent group in Miarmy > Agent

Manager. Please take a look at the follow example, there are 4 types of agent in scene, each one of them have

its own setup, original agent and other contents. And in each one of agent type node, there are several groups

nodes for storing the contents of this agent type.

(left:) Agent group nodes; (right:) contents in Agent_aaa

Technically, the agent group node is a simply transform node and the Maya type name is “McdAgentGroup”.

Page 66: MiarmyManualForV2.0

Miarmy 2.0 Manual

66 ©2011-2013 Basefount

Due to that usually there is not only one type of agent in scene, when we want to create some contents for

specific agent type, we need specify which type is activated for current been dealing with, and the new created

stuff will automatically belongs to the active type. For example, we want to create a logical decision node for

type “aaa”. We have to activate the “aaa” type of agent in Agent Manager. Then, the system will know the new

created decision node belongs to “aaa” agent type and group the decision node to the Decision_aaa node. For

detail, see “Menu Item, Agent Manager” chapter.

(left:) new created node belongs to aaa; (right:) Agent Manager, agent which type name is “aaa” has been activated

The active agent name will be stored in McdGlobal node, with attribute name is “activeAgentName”, the

following picture demonstrate this.

The agent type name

The attribute in McdGlobal Node

Importantly, there are several attributes on each agent group node, and these attributes belong to this type of

agents

Page 67: MiarmyManualForV2.0

Miarmy 2.0 Manual

67 ©2011-2013 Basefount

Extra attributes on McdAgentGroup node

Scale min/max: random range for sizing agents

Sound Freq: the sound frequency of agents

Sound Range: the sound range (amplitude) of agents. If 0, it will automatically use the diagonal length of

bound box of this agent

Vision X/Y: vision range frustum angle in horizontal and vertical

Density: the bone density for physical simulation

Start Delay Rand: some random frame before starting action

Road Probe: how far the agent can feel in front road

HP/MP Min/Max: random range for setting initial HP/MP

Render Geometry Binding

Different render pipeline support different binding method.

If you are going to use 3delight build-in plugin for rendering, you can use arbitrary binding method, such

as smooth skinning bind, rigid skinning bind, even constrain.

If you are going to use Mesh Drive Pipeline for rendering you scene directly in Maya or export geometry

cache, you need to use smooth bind skin the geometries to the original agent. Notice it’s only support

smooth skinning bind.

About render, see details in Part 8 Rendering.

Render Geometry Management

After skinning, you need put your geometries to Geometries_<agentNam> group like this:

Page 68: MiarmyManualForV2.0

Miarmy 2.0 Manual

68 ©2011-2013 Basefount

Putting the geometries of original agent in Geometry_<agentName>

Cloth geometry should be put in his group.

Render Geometry Shader

Different render pipeline support different kind shader on geometries.

If you are going to use 3delight build-in plugin for rendering, you can only use the default shader like

Lamber, Blinn, or Phong. Or you can create custom surface or displacement shader with McdRMShader

and McdRMDispMat. And our plugin doesn’t support bump map, we only support displacement map.

If you are going to use Mesh Drive Pipeline for rendering you scene directly in Maya or export geometry

cache, any type of shader is available such as mental ray, v-ray, and so on.

About render, see details in Part 8 Rendering.

Bone Shape for Display & Physical Simulation

Adjust the boxes of the original agent and make them look right size and transform. The placed agents will be

the same as the original agent.

Also, don’t forget resize the green bounding box, make it can bound your agent. No need precise, but roughly

bound the agent. This bounding box can determine:

Default sound range

OpenGL display culling (The bounding box of each agent)

Split render culling

Be careful: don’t scale or move the joint!!

Page 69: MiarmyManualForV2.0

Miarmy 2.0 Manual

69 ©2011-2013 Basefount

(left:) the original agent boxes; (right:) the placed agents

The final bone (end box) is not necessary to deal with, just ignore it.

You can ignore the head end. It’s useless and will not join the animation and physical simulation

Bone Attribute & Flags

Also, each of the boxes has some extra attributes can be applied:

Page 70: MiarmyManualForV2.0

Miarmy 2.0 Manual

70 ©2011-2013 Basefount

Bone Scale Min and bone scale max determine the current bone random size when populating agents

Bone Thickness is not available for current version of Miarmy

Field Feel determine whether this bone can feel Maya field after turning on dynamics

Collide Feel determine whether this bone can join collision checking when we apply “collide” channel

Collide Cloth determine whether this bone can collide against with cloth

We will call them flagged bones when collision detection or interacting with force field.

Physical Joint Type

Between each pair of bones, there is a joint. It is use to build rag doll joint. Each joint can be one of 3 types like

the picture below middle.

Page 71: MiarmyManualForV2.0

Miarmy 2.0 Manual

71 ©2011-2013 Basefount

3 different types of joint respectively: ball, shoulder, hinge

Physical Joint Direction

Each joint have a green arrow, you should always point this arrow to the next bone

Pointing the green arrow to next bone

Physical Joint Limits

Each of joint has some rotation limits need to setup, especially on elbow and leg. And the same attribute name

maybe have different meanning if the different joint type. The swing attribute cannot be the negtive value.

Joint types and limit attributes

Ball joint

Ball joint can swing and twist:

Page 72: MiarmyManualForV2.0

Miarmy 2.0 Manual

72 ©2011-2013 Basefount

Ball joint example

Ball joint swing and twist limit

After Miarmy 1.5, once you select the physical joint, it will become to a visible manipulator

Left non-selected, Right Selected

The ball joint setup (Blue: swing down, red: swing up, yellow and purple: twist in counter/clockwise)

(From left to right) Small range of rotate, middle range or rotate, wide range of rotate

Page 73: MiarmyManualForV2.0

Miarmy 2.0 Manual

73 ©2011-2013 Basefount

Shoulder joint

Shoulder joint can swing only, cannot twist

Shoulder joint limit, swing up and down limit

Hinge joint

Hinge joint can rotate as Z axis only:

Hinge example

Page 74: MiarmyManualForV2.0

Miarmy 2.0 Manual

74 ©2011-2013 Basefount

Hinge joint rotation limit (the right one: can be rotate back easy but cannot rotate to forward)

Referencing & Namespace Pipeline

Exclude the regularity way, Miarmy Original Agent Contents can be referenced to scene. Thanks to the Maya

referencing system, we can get many benefits:

Save a lot hard disk space for different scene with the same agent.

Easy to replace agent if we want to replace another type of agent.

Artist can get benefit if the agent changed from crowd TD. One change, automatically update the agent

in any scene contains that.

Pre-Reference Contents

Before referencing, we need clean up the scene and just leave the agent group there. Please refer the pictures

below, the left picture shows if the scene non-referencing, something usually when creating agents contents by

Crowd TD. Then it should be cleaned up and just leave the “agent group” node there and save to a independent

file.

You can click “Miarmy > Export Agent” for exporting that node and sub nodes.

Page 75: MiarmyManualForV2.0

Miarmy 2.0 Manual

75 ©2011-2013 Basefount

left: non-referencing scene, right: referencing element

Referencing

Then, for the Crowd Artists/Animators, they just need reference the agent into the scene and it will contain the

namespace, the referenced agent groups need be put into the “Miarmy_Contents” sub tree, like the following

picture:

Referencing and put to Miarmy Contents

Namespace & Agent Type Name

If we deal with the scene without referencing, the agent type name will be the suffix of the agent group, like the

first picture below, whereas the type name of the referencing file, it will be the namespace.

Notice: the non-referencing and referencing file cannot exist together mixed.

Page 76: MiarmyManualForV2.0

Miarmy 2.0 Manual

76 ©2011-2013 Basefount

Regular scene without referencing namespace

Scene with namespace

And if you want to change the type name, just need change the namespace at reference editor:

Adjust namespace of agent type for referencing scene

Page 77: MiarmyManualForV2.0

Miarmy 2.0 Manual

77 ©2011-2013 Basefount

Production

Now the artists and animators can work with the referenced scene and make specific shot in production. They

can freely create scene contents like “bounds”, “spots”, and “roads” etc. Also they can tweak the placement as

wishes.

The artist can replace agent can control the namespace of the agent type.

Also once the crowd TD changes the referencing stuff, the artist’ scene will change at the same time. (Re-open

scene or refresh reference)

Animators build environments and perception contents.

Referencing Pipeline Suggestion:

The crowd TD can:

Can do anything but need responsible for exporting correct referencing file.

Sometime need do several different versions of agent for the same agent type because some shot need

some specific deal with.

The crowd artists cannot add/edit the below stuffs:

Cannot add/edit actions

Cannot add/edit transition map

Cannot add/edit Original Agents

Cannot add/edit Geometry

The artists can add/edit

Add perception contents like bound, road, etc…

Arrangement the placement

Add/edit Logic node (but not recommended)

Page 78: MiarmyManualForV2.0

Miarmy 2.0 Manual

78 ©2011-2013 Basefount

Assets management

Crowd TD will build different Type of agents, and make actions, logics, geometries etc. Of course some agents

will interactive each other, so they need make them in the same files.

Then crowd TD will export each agent file to the hard disc and store there.

Animators will referenece the agents to the different scene

Assets on hard disk should be like this

Select-able root bone for creating original agent

For example this is your rig and the root you want is “blue” joint, “red” is root but not animation root.

Root bone is not real moving root

Page 79: MiarmyManualForV2.0

Miarmy 2.0 Manual

79 ©2011-2013 Basefount

And of course the animation will be on the blue joint, just like the right picture above.

1. Select the “red” joint, add an attribute called “skipRoot” (Boolean type) and make it “True”/”On”, then

use this rig generate action node, the system will automatically find “blue” joint and skip the “red” one.

Select the red bone, and add an attribute called “skipRoot” and make it true

2. We create action node as usually. The action node will know what happened and automatically ignore

the “red” joint

3. Before creating original agent, please un-parent and create one without “fake” joint node, and the

action will drive the agent perfectly

The original agent we need get rid of the “fake” root

Everything will be OK

Page 80: MiarmyManualForV2.0

Miarmy 2.0 Manual

80 ©2011-2013 Basefount

Placement Place node is a tool can populate your agent into the scene. There are some main features:

You can adjust proportion for different types of agents

Automatically check overlap if all place nodes in the same parent

You can parent the place node to a specific node for achieving “Hierarchical Placement”

If you make the place type “custom”, you can use MEL or Python to adjust the inner data structure of it.

Inverse placement mechanism can store “the information of your custom placement scheme” to

placement node. From your agents to placement node.

Point & Formation Placement

Firstly, we are going to introduce you 2 independent placement types “point” and “formation”. Please look at

the picture below.

Point placement type

Formation placement type

Page 81: MiarmyManualForV2.0

Miarmy 2.0 Manual

81 ©2011-2013 Basefount

Note: in current version, the circle and polygon type is not available.

Creating Place Node

For create a placement node, simply click Miarmy > Placement > Create Placement Node, The default type of

place node is “point”:

(left) default initial place node (right) attributes on place node

Terminology

The single unit of triangle stand for one agent instance, we call it “Place Unit”.

The entire placement group we call it “Place Node”

The process we generate agents from place node, we call it “placement”

Page 82: MiarmyManualForV2.0

Miarmy 2.0 Manual

82 ©2011-2013 Basefount

Attributes on Place Node

There are some attributes on each of place node. And different placement type need different attributes, let’s

take a look at the following example:

Num of Agent:

The “numOfAgent” determines how many agents to be placed

Scale:

The “scale” determines the size of single place unit

Page 83: MiarmyManualForV2.0

Miarmy 2.0 Manual

83 ©2011-2013 Basefount

Noise:

The “noise” determines the random position on X and Z axis of each place unit

Orient:

The “orient” determines the orient of every place unit uniformly

Orient Random:

The “orientRandom” determines the random orient of each single place unit

High Random:

The “heightRandom” determines the random of Y-axis of each place unit

Page 84: MiarmyManualForV2.0

Miarmy 2.0 Manual

84 ©2011-2013 Basefount

For “formation” placement:

The place type is “formation”

Noise:

The “noise” working on the formation place type

Angle:

The “angle” determine the entire rotation for formation place type

Orient:

The “orient” determines each single rotate uniformly

Page 85: MiarmyManualForV2.0

Miarmy 2.0 Manual

85 ©2011-2013 Basefount

Orient Random:

The “orientRandom” determines the random orient of each single place unit

Column:

The “column” determines how many columns for a formation placement

The summary of place node attributes:

Place Type:

o Point: arrange based beehive

o Circle: not available for current version

o Polygon: not available for current version

o Curve: arrange follow curve

o Formation: arrange by row and column

o Custom: arrange by use

Num of Agent: Number of agent for current node

Scale: unit size

Noise: random x, z value of unit in space

Angle: (only work for formation place) the rotate of entire place node

Orient: unit rotation Y

Orient Random: unit rotation Y random from 0 to 360

Column: (only work for formation place) column number of a group of unit

Distance: distance between units

Height: place node height, translate Y

Height Random: unit translate Y random

Randomize Row/Column for curve and formation placement

There are some new attributes for the curve and formation distribute placement, they are

Page 86: MiarmyManualForV2.0

Miarmy 2.0 Manual

86 ©2011-2013 Basefount

Row/column new attribute

The best way to familiar with these tools are simple use it a little bit:

Row offset

Column offset

Row noise for vertical space

Page 87: MiarmyManualForV2.0

Miarmy 2.0 Manual

87 ©2011-2013 Basefount

Column noise for horizontal space

Row and column offset for horizontal and vertical space

Row and column noise for horizontal and vertical space

Page 88: MiarmyManualForV2.0

Miarmy 2.0 Manual

88 ©2011-2013 Basefount

Populate Agents from Pace Node

Then, after you adjusting place node, you can place agent by Miarmy >Placement > Place

Or you can delete all placed agent by Miarmy > Placement >De-Place (Delete All Agents)

The reasons we provide the “De-place” function for you is not only we need delete all agents automatically, but

also clear/flush the memory. As everybody knows that, Maya has a feature called “undo”. It means if undo

feature enable, the object you delete is not actually deleted, all the date still there. It’s a hazard in crowd

simulation since it will take huge memory, as well as, the physical stuffs are still there in scene.

So please use “De-place” as much as possible instead of “delete manually”.

Curve placement

(left:) Place node attach curve (right:) need to switch to “curve” mode

You need first select place node, then select the curve, chick Miarmy > Placement > Attach Curve

Terrain Attachment + Point placement

Terrain attach is happened in Y direction of unit (place element). That is means no matter what type of

placement you are using, they can be attached to terrain.

Page 89: MiarmyManualForV2.0

Miarmy 2.0 Manual

89 ©2011-2013 Basefount

For attaching terrain:

1. First make sure a plane-like geometry is zero transformation (clear all translate, rotate, scale values).

2. Select place node firstly, and geometry secondly, then click

Combining with place type, curve and terrain, you can apply any kind of placement scheme.

Terrain Attachment + Curve Placement

Terrain Attachment + Formation Placement

Polygon Based placement

Since version 1.5 Miarmy support polygon based distribute placement.

We need select the place node firstly then add select polygon, then click Miarmy > Placement > Attach Range

Mesh

Page 90: MiarmyManualForV2.0

Miarmy 2.0 Manual

90 ©2011-2013 Basefount

Specify the polygon range placement

The polygon placement distribute result

Selection Placement (only place agents from selection)

Sometimes there are several placement nodes in scene and we just want to populate our agent from what we

want to focus. Then just need to select which you interested and click Miarmy > Placement > Place (from

Selected)

Place from selected place node

Page 91: MiarmyManualForV2.0

Miarmy 2.0 Manual

91 ©2011-2013 Basefount

Proportion in Place Node

Please take a few minutes to recall the “Agent Manager”, “Original Agent” and “Multiply Types of Agent”. If

there are more than one type of agent in scene and all of them have “original agent”. The 2 conditions should

both meet. We can assign proportion for the placement node:

Open placement editor:

Select your placement node and this window will update automatically

The proportion Editor

Simply tweak the slider for assigning proportion to your placement node. The total proportion is always sum to

100%. If you don’t want to assign proportion for specific agent type, just simply crank it to “0” for locking. Notice

the “orc” agent has been locked.

Page 92: MiarmyManualForV2.0

Miarmy 2.0 Manual

92 ©2011-2013 Basefount

Lock down the orc agent type

Click “make even” for averaging the assignment. (Notice the orc has been locked)

Make even for non-locked agent types “locoman” and “loco”

Hierarchical placement

Hierarchical placement means that you can place your agent in hierarchical local space instead of world space.

For example, you have several battleships in scene, and each ship has some agents on the deck. These agents

are walking and doing something, the ships are moving. At this time the agents on deck will naturally moving

with ships also. If we put our place node under ship transform node which means a child node of ship node, the

agents populated from this node will automatically be the children of ship. These agents will act in their parent’s

local space respectively.

Agents are acting on moving ships

For achieving this, the only thing you need to do is parent your place node to its parent. Like this:

Once you place your agents, they will automatically host to the same parent of place node.

Page 93: MiarmyManualForV2.0

Miarmy 2.0 Manual

93 ©2011-2013 Basefount

Hierarchical placement, (left) before placing; (right) after placing

Solver Space

Technically, take a look at the picture above. They (2 groups of agents) are only separated by transformation

space but not solver space. Because Miarmy take local coordinate to solve, the 2 groups of agents may affect

each other even not in same world position. (Different world positions maybe the same local position)

To separate them totally and never affect each other, we need solver space node. Later, we will talk about the

solver space more detail.

The pictures above show the different parenting scheme. The left shows agents separated by transformation

space, whereas the right one shows agents separated not only by transformation space but solver space.

Inverse Placement

Inverse placement is a process which from the selected agents, create new place node. The new created node

will record the information inherit from the selected agents.

The inherited information includes:

Translate of each place unit

Rotate of each place unit

Type ID of each place unit

Parent of each place unit

Usually pipeline is, firstly you arrange agents by your hands (move them, rotate them, parent them), just like a

tactical arrangement, and then select some agents, apply inverse placement by Miarmy > Placement > Inverse

Place.

Page 94: MiarmyManualForV2.0

Miarmy 2.0 Manual

94 ©2011-2013 Basefount

(up :) select some agents, (down:) from selections inversely create new place node

Please Notice Important: There may be some overlapped placement slot in scene after inverse placement. We

highly recommend you clear old place node after inverse place node generating. If you place agent by place

node and inverse place node at the same time, the system will prompt you for confirm.

You can use inverse placement to place agent according to your rehearsal just like the picture below:

Page 95: MiarmyManualForV2.0

Miarmy 2.0 Manual

95 ©2011-2013 Basefount

Inverse placement result

You may notice the orange cycle placement are arranged by inverse placement

Place Node Data Structure

You can arrange the placement by procedural methods. Using MEL or Python script, you can access and modify

the placement data easily and directly.

We should setup the place type to “custom” for a place node firstly:

Switch to “custom mode

Transformation Info

<place node>.placement[<unit id>].agentPlace[<infomation>]

<place node>: the shape node name of place node

<unit id>: the Nth agent unit

<information>: from 0 to 7 stand for:

0. Agent Type ID

1. Translate X

2. Translate Y

3. Translate Z

4. Rotate X

Page 96: MiarmyManualForV2.0

Miarmy 2.0 Manual

96 ©2011-2013 Basefount

5. Rotate Y

6. Rotate Z

Example:

Line1: get the agent type from unit 0 of McdPlace2 node

Line2: set the translate X to unit 0 of McdPlace2 node

Parent Info

You can also specify each agent parent:

<place node>.parentSet[<unit id>]

Example:

Line3: set the parent for unit 0 of McdPlace2 node

Real Example

You can refer it from the placeStatium.txt in the <Miarmy Directory>/samples (the same place store the samples)

This code can place stadium:

Page 97: MiarmyManualForV2.0

Miarmy 2.0 Manual

97 ©2011-2013 Basefount

After executing the code in above, the result will be:

The result of stadium placement

Visualize placement

Sometimes, the small triangular locators of placement node are not enough for setting layout, so we provide a

method to visualize how the placement finally will look like.

There is group “PlacerShape_<agentName>”in agent group, just put any mesh node inside with arbitrary

hierarchy, all the placement node in scene will display out the meshes of you placed inside.

If you found that group does not exist please click Miarmy > Miarmy Contents Check

Add new group repository

Page 98: MiarmyManualForV2.0

Miarmy 2.0 Manual

98 ©2011-2013 Basefount

Original placement node

Visualize single geometry “sphere”

Visualize multiple geometries body parts

Multi type of agents (a human (pink), and a sphere (orange))

Skip flag can used to bypass individual instance

Sometimes we don’t want to place some individual agents out for some reasons, we can block them place, just

by 2 simple steps:

1. Turn the digital placer on, and check which agents you don’t want to place out.

Page 99: MiarmyManualForV2.0

Miarmy 2.0 Manual

99 ©2011-2013 Basefount

The digital placement holder

2. Mark some agents out by simple MEL command, for example in above picture, we don’t want agent 0, 1,

7, and 19 place out, we need mark these agent place extra slot 4 from false to TRUE, and the following

pictures show the whole process

Run mel command to block agent placement

Some agents been blocked placement

Animation and Action Action is one of most important infrastructure for build behavioral crowd animation. We create actions nodes

from animation on the rig.

Note: here we just introduce the creation process, for usage and details, please refer the Part 6 Action

Page 100: MiarmyManualForV2.0

Miarmy 2.0 Manual

100 ©2011-2013 Basefount

Animation to Action Pipeline Suggestion

When you creating action node, we suggestion you take the following pipeline. It would be easily for

management and further modify. Note: maybe you have better solutions, here just a suggestion.

Please take a look at the pictures below. Firstly, we suggest save as each animation file to single file (the first

picture). In each file, there is a rig (better be referenced into scene) under the Setup_<agent> name node

(second picture). You can freely key frame animation or import animation to this rig. Finally, in each file, there is

only one action node and you can export this node to anywhere.

The action create pipeline

All in all, each file contains a single piece of animation and only one action node. It would be easily for

management.

Create Action Node

Animation on the rig

The action node will be generated for active agent type. The only thing we are going to do is click Miarmy >

Actions > Create Action. And you will see some prompt need you fill or confirm:

Page 101: MiarmyManualForV2.0

Miarmy 2.0 Manual

101 ©2011-2013 Basefount

Specify an action name

The action setup wizard will pop out for setting your action node up:

If you click Setup, the wizard will begin.

Static: agent stands without transform change (e.g. stand, sit, cheer)

Locomotion(Z+): agent walks in z direction straight (e.g. walk, stand to walk, jog, run)

Locomotion: agent walks in horizontal space (e.g. walk to left)

Turning: agent turning to left or right (turn left, turn right)

Ramp: agent go up or go down (go upstairs, climbing)

Cycle: self-cycle animation (e.g. walk, stand, run)

Transition Action: middle action between 2 cycle action (e.g. stand to walk, walk to run)

Page 102: MiarmyManualForV2.0

Miarmy 2.0 Manual

102 ©2011-2013 Basefount

If you select cycle action, there is an additional attribute “cycle range”, means the self-transition range, more

specifically, if the action is go into the last XX%, the cycle will occur, self-transition. It blends the end self-

transition part to the head part of the action by some percent.

As picture above, after playing back green area, the action will perform self-cycle.

Either you select “cycle action” or “transition action”. There will be 2 attributes need set up, “transition in” and

“transition out”.

Transition in:

When previous action transit to current action, some percent should be smooth blended. This is the entry range

of this current action. Like the picture below, when the previous action transiting to current action, 10% of

action length should be blended from previous end to current start.

When transiting in, blend with previous action

Transition Out:

When current action should transit to next action, only when the current action playback after exit range

percent, the current action can transit to next action, otherwise, maintains the self-playback

Page 103: MiarmyManualForV2.0

Miarmy 2.0 Manual

103 ©2011-2013 Basefount

Only after 80% playing back, the current action can transit to other actions

Your action nodes will be created in:

You can select one of it and open Action Editor for checking or editing details:

Action editor

The more detail about action and something under the hood will be described in Part 6 Action

Transition Map Building

Concept

Action transit from one to another can be 2 methods:

1. Easy Transition

2. Transition Map

The easy transition makes your action transit to another directly automatically.

Page 104: MiarmyManualForV2.0

Miarmy 2.0 Manual

104 ©2011-2013 Basefount

Except Easy Transition, there is another transition method we can apply, it is Transition Map. Transition Map is

able to precisely control how one action transit to another, which others action will in between of them. For

example, the current action is “walk” and the target action is “stand”. If we are using Easy Transition, the action

transition will be “walk -> stand” directly. Whereas if we are using Transition Map, the result will be “walk ->

walk to stand -> stand”, which guild by transition map. Please look at the picture below.

Also, the Transition Map can control action blending, action randomization, and then get the feedback from

agent playback.

Transition Map screenshot

Note: Transition Map is always showing the contents of active agent. Please make sure you already activate the

agent type which you want to edit.

Transition Map located in viewport renderer:

You should switch it to front view for viewing it:

Transition Map consists of “State”, “ActonShell” and “connections”

Page 105: MiarmyManualForV2.0

Miarmy 2.0 Manual

105 ©2011-2013 Basefount

(left:) action shell (right:) state

Action Shells are the aliases of actions. They stand for actions but not actions.

States are terminals can hook many cyclic actions.

Main Features of Transition Map

Naming checking

The action and action shell are twins. Engine parses “action shells” in Transition Map whereas drives agents by

“actions”. So both “action shells” and “actions” should exist with right naming conventions.

The “runToJog” and “jogToRun” only have action shell without real action, the title of action shell will be

“red”

The “jog” has both action shell and action and can be recognized by engine. The title will be normal

“black”

Precise transition action control

Between each 2 cyclic action, we can apply some transition actions between 2 states. To trigger the action,

simply put your action name in decision node. All the things are automatically done by engine. The engine can

always find the shortest way to get your target action.

Page 106: MiarmyManualForV2.0

Miarmy 2.0 Manual

106 ©2011-2013 Basefount

Action group

A group of cyclic action can make a “signal” group, when our logic decision call “actionGroup:sit” channel the

system will automatically random select one of the actions of it.

Action blending

One action can blend to another action with blend engine. Not only the action itself, the rate can be blended.

Blend is from 0% to 100%. 2 blend actions should have the same number of frames!

Call “walk->walkHappy” in decision node can perform this:

Page 107: MiarmyManualForV2.0

Miarmy 2.0 Manual

107 ©2011-2013 Basefount

Exits choice

Between 2 cyclic actions

Take a look at the above picture, from walk to stand, there are 2 ways: “walkToStandR” and “walkToStandL”, we

want to choose one of them in different situation. More specifically, different phase of action should transit to

appropriate transition action.

We just need specify the Exist Choices in form of Action Editor, everything will be ok. You may notice the right

blue-white bar shows the exit phase.

How to Build Transition Map

In Transition Map renderer, switch to “Front” View:

Page 108: MiarmyManualForV2.0

Miarmy 2.0 Manual

108 ©2011-2013 Basefount

Enable Move Tool firstly, and there are 3 types of operations in Transition Map,

1. click-hold for moving nodes

Move the nodes

2. Above pictures, ctrl + click “walkHappy”, and ctrl + click walk, for connecting

Link 2 nodes

3. Above pictures, shift + click walkHappy, and shift + click walk, for disconnecting

Page 109: MiarmyManualForV2.0

Miarmy 2.0 Manual

109 ©2011-2013 Basefount

Break connections

And there are 3 types of Action Connections in Transition Map (enable move tool firstly):

1. The cycle action:

a. ctrl + click walk action

b. then ctrl + click walk state

c. ctrl + click walk state

d. ctrl + click walk action

Cycle action host on a state

2. The transition action:

a. Ctrl + click walk

b. Ctrl + click walkToStand

c. Ctrl + click walkToStand

d. Ctrl + click stand

Page 110: MiarmyManualForV2.0

Miarmy 2.0 Manual

110 ©2011-2013 Basefount

Transition action between 2 states

3. Action Blend:

a. Ctrl + click walkHappy

b. Ctrl + click walk

Blend action link to an another action

Uncheck the Simple Transition in Miarmy Global:

If you unintentionally enable Simple Transition, the Transition Map will have a background with tip message

“Simple Transition” apear

Page 111: MiarmyManualForV2.0

Miarmy 2.0 Manual

111 ©2011-2013 Basefount

Watermarks there in simple transition mode

Easy control transition Map Move Tool

Watch Cameras

When the users switch to brain viewer or transition map, the system will automatically add the cameras to

watch the contents of them. This can avoid the conflict using “top” and “side” camera in scene.

Orthographic camera automatically added

Better Move Tool

Also we improve the transition map move tools, when we move the state, the related actions will be moved also,

and the transition action will move 50% along with the moving vector

Page 112: MiarmyManualForV2.0

Miarmy 2.0 Manual

112 ©2011-2013 Basefount

Move together with the states

Move together with the action blend

Decision Decision node is another infrastructure of agents’ brain. Please check out the details in Part 7 Logic in-depth and

Part 8 Logic & Perception

Create Decision node

Firstly, you need active the agent type which you want to edit.

You can easily create it from Miarmy > Logic Decision > Make Decision

Agent There is much information on each instantiated agent. Some of them are exist in the form of attributes, located

in channel box, whereas some of them in memory and cannot access by regular methods.

Notice: the information (attributes and memory data) on agent cannot be saved when

you are saving your scene. All of the information is originated from Original Agents. In

this version of Miarmy, Only “muteDynamic” attribute can be stored in place node

through inverse placement feature

Page 113: MiarmyManualForV2.0

Miarmy 2.0 Manual

113 ©2011-2013 Basefount

Acting agents

Agent attributes

Mute Dynamic. Once enable, this agent can entirely block the dynamics feature, and this attribute can be stored

in place node through inverse placement.

This is a very important feature for optimizing crowd dynamics, and we will introduce it in detail in Part 9

Optimization – Mute Dynamics

The others attributes, originated from Original Agent

Page 114: MiarmyManualForV2.0

Miarmy 2.0 Manual

114 ©2011-2013 Basefount

Agent scale 0.8(left) and 1.3(right)

Sound range 35(left) and 60(right)

Sound frequency 5(left) and 3(right)

Page 115: MiarmyManualForV2.0

Miarmy 2.0 Manual

115 ©2011-2013 Basefount

Vision X 100(left) and 30(right)

Color 4(left) and 8(right)

Compare the left and right attributes differences and agent results

Agent Mode

There are 3 modes of agent:

Acting mode: controlled by action and logic decision.

Dynamics mode: controlled by action and logic decision.

Page 116: MiarmyManualForV2.0

Miarmy 2.0 Manual

116 ©2011-2013 Basefount

Combo mode: some parts controlled by action whereas another parts controlled by dynamics, such as

these feature enable: breakable dynamics, partial dynamics and body dynamics

Agent Memory Data

You can check the bone structure and flags on bone through Agent Viewer. Because these data cannot be saved,

so we didn’t provide any method to modify them.

Take a look at the following picture, the tree like list is the bone structure. The bone name is the “real name” in

memory and if you want to fill the bone-specific channel in logic decision node (such as bone “upArmR:tx”),

please use the name in this list.

The bone maybe has some flags, such as the root, have “@” and “*” flags. Check the legend on the bottom of

the list, the “@” stand for the collision detection flag, and the “*” stand for field affect flag. We will talk about

the collision detection channel in Part 5 Logic & Perception, and the field dynamics in Part 7 Physics

Agent viewer, contains bone structure and flags

Page 117: MiarmyManualForV2.0

Miarmy 2.0 Manual

117 ©2011-2013 Basefount

Part 4 Logic in-depth This part explained all the logic engine calculation and procedure. All of them are happened under the hood

automatically and it will not need you understand all of them at this time. You can combine with the video

tutorials and make everything clear gradually.

Fuzzy Logic In the world of fuzzy logic, there is no “True” or “False”, because the boundary of “True” and “False” have been

blurred. Instead, we called them “active”. If true, it’s 1.0 active, and if false, it’s 0.0 active, between true and

false, it’s a float point value from 0.0 to 1.0 active, such 0.618 active.

Make an example and take a look at the pictures below, in regular logic, an input value is -80, the output should

be “True”, and another input value is -100, the output should be “False”. But in fuzzy logic, the input values -80

and -100 are neither true nor false. Notice the slope in in the second picture, the input -80 get active value 0.667,

and the -100 get the active value 0.333

Regular Logic: Red: False, Green: True

Fuzzy Logic: Red: 1.0 Active; Green: 0.0 Active; Gradient, 0.x Active

So our Miarmy system is full Fuzzy logic system implementation. And all the calculations are based on “Fuzzy

Active” rather than “True/False”, including sentence test, priority and node active test.

Look at an example:

This is regular logic we are talking about, something true, do 1, something false, do 2:

1. When hot, turn on fan.

2. When cool (not hot), turn off it.

Page 118: MiarmyManualForV2.0

Miarmy 2.0 Manual

118 ©2011-2013 Basefount

Color means fan speed, the dark line is the temperature

Here we bring in a concept called “active”, ranging from 0 to 1, please take a look at the picture below

When false, the active is 0

When true, the active is 1

The active value 0 and 1, represent the true and false

Then, this it is fuzzy logic, it make the boundary blurred:

Color means fan speed, the dark line is the temperature

1. When cold turn off fan (the active value is 0.0)

2. When a little bit hot, turn on fan (the active value is 0.2)

3. When hotter, turn up fan (the active value is 0.8)

4. Very hot, turn up fan speed to max (the active value is 1.0)

Pipeline

Terminology

As we mentioned in the Part 1 Main Concept, in a single decision node, there are several conditions and

decisions. In terminology, we are going to call them sentence inputs and decision outputs.

There is an input channel in each sentence input whereas an output channel in each decision output.

Please distinguish the “active” and “results”, the active is a fuzzy logic concept value and it would be and usually

in range from 0.0 to 1.0, whereas, the results can be any values, it’s a variables. E.g. channel “tz” active is 0.55,

channel “tz” value is 100, and the results is “100 * 0.55” = 55

The calculation result of an input channel is an array, and it would be arbitrary number of results (even 0-length

array and no result), we called them channel results

Page 119: MiarmyManualForV2.0

Miarmy 2.0 Manual

119 ©2011-2013 Basefount

The calculated active of a single sentence, we call it sentence active

The calculated of a decision node, we call it node active

After node active, we will get some output channel results, we call them decision results

We need solve out the behavior results from decision results, and this calculation process we call it defuzz

General Pipeline

Our brain node will collect all the information from scene (environment perceptions & agents themselves) and

put the information to Miarmy Core Engine. Then our engine will deal with the information and solve out the

behavior results, finally drive agents and update the scene in brain post node.

The engine is not a node or command, it’s a piece of code can receive information, solve out the results and

send information back

Logic General Pipeline

Engine Process Breakdown

1. Calculate each sentence input channel results

2. Solve out the sentence active from the sentence channel results by fuzzy logic

3. Use sentence active and logic rule and priority among these sentences, solve out the node active

4. Using hierarchical priority ranking system, recalculate the node active

5. Collect all the decision results based on node active

6. Using defuzz engine and decision results to calculate behavior result

Please notice the color of the following pictures:

Firstly, we need solve out the channel results from the type of input channel

Page 120: MiarmyManualForV2.0

Miarmy 2.0 Manual

120 ©2011-2013 Basefount

Step 1: from input channel, calculate the channel results

After getting the values from input channel, we will use the test range, fuzzy value and input type to calculating

out the active of a single sentence, we called this sentence active

Step 2: Sentence Active Calculation Pipeline

Then we need use the logic tool and priority among several sentences and to calculate out the node active

Step 3: Node Activate Calculation Pipeline

Using priority ranking hierarchy, recalculate out the new node active

Step 4: Modify node active using priority ranking hierarchy

Page 121: MiarmyManualForV2.0

Miarmy 2.0 Manual

121 ©2011-2013 Basefount

Using the active value from each node, and decision output values, we can get many decision results. Then

using defuzz method, we can solve out the actual results of each type of channel, drive behavior

Step 5 & 6: using node active and decision results finally get the behavior results, defuzz

Page 122: MiarmyManualForV2.0

Miarmy 2.0 Manual

122 ©2011-2013 Basefount

Implementation

Step 1: Get Channel Results

From input channel name, we can let the engine calculate the results for this channel, the result is an array, and

the length of array is non-fixed, even can be zero.

A sentence of node, Red: input channel

The channel “sound.x” may return many results based on how many agents in the sound range of current agent.

Also maybe it returns nothing. (See “sound” perception chapter for getting the details the return values of

“sound.x” channel)

Step 2: Fuzzy Logic for a Single Sentence Calculation

In the following picture, a single sentence contains an input channel, a true range and 2 fuzzy values.

A single channel in yellow bound, Red: input channel Green Bound: true range Blue: fuzzy values

Each sentence is composed of:

Page 123: MiarmyManualForV2.0

Miarmy 2.0 Manual

123 ©2011-2013 Basefount

Input channel: return a list of values based on channel type

Test rule: ID, pre-operator, priority, inverse flag

Test range: the full true range without fuzzy blur

Fuzzy value for the start and end of test range, plus and minus

Firstly, the input channel will return a list of values from Channel Input Engine base on the information of agent

itself and environment.

Using input type, we can deal with the list of input results.

The input type have “max” and “average” 2 kinds of calculation algorithm:

Max: choose the value make the sentence most be activated one

Average: take all the results from that array and calculate the average one

Finally, we can get one result value, we call it Channel Result. Please distinguish it with the Channel Results

Use the Channel Result being input value and use fuzzy logic to test its output active, this active is sentence

active

Fuzzy Range

And the sentence contains a “true range”:

True range from -90 to 0 make sentence true

Then and a fuzzy value, such as 30, then turns out the fuzzy range:

=> (-90 – 30), (-90 + 30), (0 – 30), (0 + 30)

=> -120, -60, -30, 30

Fuzzy range from -120 to 30 make sentence activated

Page 124: MiarmyManualForV2.0

Miarmy 2.0 Manual

124 ©2011-2013 Basefount

Then the sentence active value will be:

Full active 1.0: if Channel Result from -60 to -30

Non active 0.0: if Channel Result less than -120 or greater than 30

Float point active 0.x: if Channel Result from -120 to -60 or -30 to 30

If using “Inf” channel (infinity channel), enable, and the fuzzy out will disappear

0 to + infinity in channel

The true range will be like this:

True range: input > 0 true

Then and a fuzzy value, such as 20, then turns out the fuzzy range:

=> 0 + 20 = 20; 0 – 20 = -20

=> -20, 20

Fuzzy range: input greater than -20 make sentence activated

Then the sentence active value will be:

Full active 1.0: if Channel Result greater than 20

Non active 0.0: if Channel Result less than -20

Float point active 0.x: if Channel Result from -20 to 20

Testing that Channel Result with the fuzzy range, we can get the “sentence active” in this step

Page 125: MiarmyManualForV2.0

Miarmy 2.0 Manual

125 ©2011-2013 Basefount

Step 3: Fuzzy Logic between Sentences Calculation

Among the different sentences, there are “active flags”, “sentence priority”, “’not’ flags”, “logic operators” and

the ID of each sentence. Using these logic tools and the “sentence active” of each sentence from previous step,

we can calculate out the “node active”

Yellow bound are logic tools

We can give a logic operator before the each sentence

&&: “and” operator, ||: “or” operator, xor: “exclusive or” operator

You can also using the “not flags”, “sentence priority” modify the result, and the calculation rule will be

conclusion in Parse Result, use this rule and sentence active from each one, we can finally get the node active

An example of more complicated situation, but usually we don’t need that

Algorithm for prefix operator:

Add: the minimums active value

Page 126: MiarmyManualForV2.0

Miarmy 2.0 Manual

126 ©2011-2013 Basefount

Or: the maximums active value

Exclusive Or: the absolute value of the different

After the calculation among these sentences, we will get the node active, in this step.

Step 4: Fuzzy Logic for Priority Ranking and Interfere to Node Active

By now, we have already known the node active, every node has its own node active, but if they are re-

arranging by hierarchy, the node active will be interfered. The decision in higher hierarchy takes higher priority.

A real example of decision hierarchy

Direct hierarchy:

(1 – Node Active) will passed to the child, and multiple to the Node Active of child

For example, the node 1, node 2, node 3 active values are: 0.2, 1.0, and 0.5

the node1 active is 0.2, then the 0.8(1-0.2) will be passed to node2

the node2 active is 1.0 and it will yield to 0.8(1.0 * 0.8), and the 0.2(1.0 – 0.8) will be passed to node3

the node3 active is 0.1(0.5 * 0.2)

So the node active results of the 3 nodes are: 0.2, 0.8, and 0.1 after ranking priority.

Page 127: MiarmyManualForV2.0

Miarmy 2.0 Manual

127 ©2011-2013 Basefount

Grouping hierarchy:

(1 – Max Active) will be passed to the child group, and multiply to all of the children decisions

For example the node active values from node1 to node 4 are 0.1, 0.4, 0.7 and 0.5

the max active value of node1 and 2 is 0.4, so 0.6(1.0 – 0.4) will be passed to group2 and multiple to

node3 and node4

so the post-calculated active value of node3 is 0.42(0.7 * 0.6) and node4 is 0.3(0.5 * 0.6)

Grouping and Node Hierarchy Hybrid

You also can combine the direct and grouping method together, and the algorithm is the same

Hybrid hierarchy ranking priority

Page 128: MiarmyManualForV2.0

Miarmy 2.0 Manual

128 ©2011-2013 Basefount

Step 5 & 6: Output Mechanism - Node Active, Default Decision and Normal Decision

Using each node active value, we can firstly get the output channel active of each node, and then solve out the

decision results. Just like the picture below, if the node active is 0.2 after sentences calculation. The “ry” and “tz”

channels are active 0.2 for this specific node. The decision results are “ry”: 24 (120 * 0.2) and “tz” 4 (20 * 0.2).

Normal Decision determine output channel based on node active

But please notice, this output channel active (like the 0.2 we just mentioned) is not the final output active for

this type of channel, system need also calculate the node active from every node. And finally, system need solve

out the ultimate correct active value of a type of channel combine with several active values from every node

and the default value of this channel in the default decision.

Before continuing, we need now introduce a concept called default decision.

Default decision implicitly contains the default value of every channel’s output. (even there is no default

decision, these implicit values exist)

The default value means the value which output channel will blend with, when this type of output

channel has not been fully activated by any of normal node.

One can explicitly specify one or more default values for some specific channels and those default values

will take place the implicit ones.

If we want to get the ultimate active value of specific channel, we need combine with default decision node.

Default value will work when this channel is not fully activated

Page 129: MiarmyManualForV2.0

Miarmy 2.0 Manual

129 ©2011-2013 Basefount

Please look at the picture above, “tz” channel has been explicitly re-specified and when there is no any node

trigger “tz”, the “tz” channel will be 100.0 by default; And if the “tz” channel is fully triggered by any other node,

the tz will take the value from that node; Or if the “tz” channel has not been fully triggered, system will calculate

a blended value base on Defuzz Type Algorithm.

3 types of defuzz algorithm

Average: average result from every normal decision, then average the default one

Max: get the max one from result of normal decisions if the max one less than 0.5, get the default one

Blend: don not distinguish the normal and default decision, blend the result all.

So far as we know, each node has a node active, and each node has several outputs. The part would a little bit

confusion so we will explain this directly by an example. Imagine that we have bunch of decision nodes, and

each one of them has several outputs. There must be several overlapped channel names. We need calculate the

output active based on the defuzz type. Let’s take a look an example, just look at the following 3 nodes, 2

normal decisions and a default decision.

We just demonstrate the calculation of channel “tz”.

2 normal decision nodes with 0.2 and 0.8 active and a default node

For the first normal node, we got:

value:20

active: 0.2

For the second normal node, we got:

value: 20

active 0.8

The default decision node, we got:

Page 130: MiarmyManualForV2.0

Miarmy 2.0 Manual

130 ©2011-2013 Basefount

Value: 200

We can calculate the result by following rules:

Average Type

o The default node active is (1 – max): 1 - 0.8 = 0.2

o Sum = 0.2 * 20 + 0.8 * 20 + 0.2 * 200 = 60

o Sum of Active = 0.2 + 0.8 + 0.2 = 1.2

o Result: 60 / 1.2 = 50

Max Type:

o We get the max active 0.8, the second normal decision

o Result: 20 itself (the second normal decision value)

o Note: if the max active blew 0.5, we take the default value in default decision 200

Blend Type:

o We get the max active 0.8, the second normal decision

o Result: 0.8 * 20 = 16

o Note: similar like Max Type but we need multiply the active value.

Page 131: MiarmyManualForV2.0

Miarmy 2.0 Manual

131 ©2011-2013 Basefount

Part 5 Logic & Simulation As far as we know we can use input channel get an array which contains the input results. So different channel

channels get the different array based on our channel input engine.

And also there are a lot of decision results represented by the output channel, we need transform that to the

execute information by our channel output engine and send them to agent.

Logic Presets There are many presets for building decisions or filling channels, after you familiar with all the concepts, you can

use these preset accelerate the brain construction process.

Channel Presets

Automatically fill the channel contents

Channel presets

Page 132: MiarmyManualForV2.0

Miarmy 2.0 Manual

132 ©2011-2013 Basefount

Decision Presets

Automatically create decision will logic inside.

Logic decision presets

Interactive with Agent Some channels can return result based on other agents, let the agent can feel others. They are “sound” and

“vision”

Sound

Sound channel is useful and effective ways for knowing the agent nearby and usually used to apply agents

collision avoidance. Each of agents has an intrinsic sound range attribute and a sound frequency attribute.

Selecting any agent, you may notice it is located channel box:

Sound attributes

Each of the agents has a sound itself. Like this:

The sound range for agent

Page 133: MiarmyManualForV2.0

Miarmy 2.0 Manual

133 ©2011-2013 Basefount

Sound channel have some auxiliary option, like sound.x, sound.y, sound.d, etc. No matter what channel you are

using, before calculating, sound channel will firstly find the agents in its range, then only calculate result based

the in-range agents. Like the picture shown blow, the Y agent can only feel B and C for sound testing, whereas

the X will let agent C and A for testing.

The agent Y cannot feel agent A and X, and the agent X cannot feel agent B and Y

And actually the sound range is a 3D range, means it can feel the agent in top and button of it.

Select the agents in sound range firstly

After getting the agents in the sound range of current agent, it will test them by specific channel and return

values.

The sound.x will return the degree relative to the current agent. Look at the picture below,

The sound.x will return 45 for agent “A”, -135 for agent “B”. As for agent “C”, because the C agent is not in range

of agent, so, there is no return. The final result will be an array which contents are [45, -135].

Using this array, we can combine the “input type and “fuzzy range”, we can calculate out the sentence active.

Also see the picture below, for example, we are testing is there any agent in my left front, and the fuzzy range is

0 to 90, with a fuzzy value (the red gradient color). The results are [45, -135],

So the 45 make the sentence fully active 1.0, and the -135 make the sentence active 0.0, if we using

“input type: Max”, we need find the maximum sentence active. Conclusion, the sentence active will be

1.0

If we are using “input type: Average”, we will take both sentence active 1.0 and 0.0 and average them,

so the sentence active will be 0.5

Note: There’s a concept call subjective and objective, like the picture shown above,

when we testing agent Y, the “Agent Y” is subjective agent, we call it “current agent”,

and this time “Agent A, B, C and X” are objective agents, we call them “others agents”.

The engine will iterate calculate every agent in scene, and each one of them have one

chance being the “current agent”

Page 134: MiarmyManualForV2.0

Miarmy 2.0 Manual

134 ©2011-2013 Basefount

The sound.x is testing others agents in horizontal space whereas the the sound.y is testing others agents in

vertical space

sound.x channel example for current agent

Take a look at the following picture, the sound.ox channel tests the in-range agent’s orientation. The agent A,

angle is α, should be -60 degree; for agent B, the angle is β = -160, in this example, the input results contents are

[-60, 160]

The sound.ox is testing agents in horizontal space whereas the the sound.oy is testing agents in vertical space

sound.ox channel example for current agent

sound.d channel will return the every distances between the current agent and the others agents in sound

range. For the following example, only the agent A, B, C can join calculation. Assuming that the sound range of

current agent if 25, the input results should be [d1, d2, d3], approximate [18, 16, 23]

Page 135: MiarmyManualForV2.0

Miarmy 2.0 Manual

135 ©2011-2013 Basefount

sound.d channel example for current agent

sound.f channel will return the each frequency of agent in current agent sound range. For the following example,

the current agent can feel A and B, if the frequency of A is 3, the frequency of B is 5, the input results should be

[3, 5]

sound.f channel example for current agent

You may notice, with sound channel, we can easily get the information from nearby agents and response, so it’s

usually can use to aiming target, of avoid close agent.

Page 136: MiarmyManualForV2.0

Miarmy 2.0 Manual

136 ©2011-2013 Basefount

Vision

Vision channel is useful ways for finding identify far agent. Any agents in current agent vision range can be seen.

Each of Miarmy agents has 2 intrinsic vision ranges attribute and a color attribute. Selecting any agent, you may

notice it is located channel box.

Vision attributes

Each of the agents has a vision itself. Like this, notice the green frustum, it is the vision range of selected agent

Vision range frustum

You can define these attribute in agent group node, see Part 3 Agent Infrastructure

The same as sound, vision channel also have some auxiliary option, like vision.x, vision.y, vision.h, etc. No matter

what channel you are using, before calculating, vision channel will firstly find the agents in its range, and then

only calculate result based the in-range agents.

Like the picture shown blow, the current agent cannot see agent B, C and D, but cannot see Agent A and E

And actually the vision range is a 3D range as well as sound, means it can feel the agent in top and button of it.

Page 137: MiarmyManualForV2.0

Miarmy 2.0 Manual

137 ©2011-2013 Basefount

Select agents in vision range firstly

After getting the agents in the vision range current agent, it will test them by specific channel and return values.

The vision.x will return the degree relative to the current agent. Look at the picture below,

The vision.x will return α degree for agent “A”, γ degree for agent “B”, and β degree for agent C”. As for agent “D”

and “E”, because they are not in vision range of agent, so, there is no return. The final result will be an array

which contents are [α, β, γ]. As shown by following picture, the result approximate is [30, 15, 35].

The vision.x is testing others agents in horizontal space whereas the the vision.y is testing others agents in

vertical space

vision.x channel example for current agent

Page 138: MiarmyManualForV2.0

Miarmy 2.0 Manual

138 ©2011-2013 Basefount

vision.z channel will return the every distances between the current agent and the others agents in vision range.

For the following example, only the agent A, B, C can join calculation. Take a look at the example picture below,

the input results should be [d1, d2, d3]

vision.z channel example for current agent

vision.h (hue) channel will return the each color of agent in current agent vision range. For the following

example, the current agent can see A, B and C, if the color of A is 0, the color of B is 2, the color of C is 3, the

input results should be [0, 2, 3]

vision.h channel example for current agent

Page 139: MiarmyManualForV2.0

Miarmy 2.0 Manual

139 ©2011-2013 Basefount

You may notice, with vision channel, we can easily get the information from far and in-front agents and

response, so it’s usually can use to identifying and chasing target.

Agent Exclusion Feature

Sound channel and vision channel has agent exclusion feature among sentence calculate, this feature can make

sure the channel get more precise and natural results. Additionally, this feature is automatically enabled, and

user cannot disable it.

Usually we need use not only one type of channel for interactive the others agents. For example, sometimes we

need test is there someone in my left and near. (So that we can turn right and slow down)

As far as we know, we can use sound.x channel to test is there someone in my left, and use sound.d channel to

test is there someone nearby, then naturally use “AND” operator to get the intersection agents.

Just like this:

Someone in my left and near

At this time, the agent exclusion feature will be automatically enabled. Please take look at the pictures below,

the agents are gradually excluded by the filter and never join the calculation again for the other sentences in the

same decision node, and we will finally get the accurate agent meet condition.

From left to right, the exclusion filters respectively are “sound range”, “sound.x” and “sound.d”

Suppose that we didn’t have Agent Exclusion Feature and take a look at the following example, the node will get

the wrong result (wrong node active)!! Please notice the following second picture, green dot mean there is an

agent make sound.x channel test active 1.0 and notice the third picture, green dots mean there are 2 agents

Page 140: MiarmyManualForV2.0

Miarmy 2.0 Manual

140 ©2011-2013 Basefount

make sound.d channel active 1.0. Finally, sentence A and B will both active 1.0, the A “&&” B logic expression

makes this node active 1.0. The system would mistake there is someone in my left and near. But unfortunately,

in fact, there is no agent in the GREEN Zone in third picture! That is means that, actually there is no agent in my

left and near. So, without agent exclusion feature, the channel will not very accurate.

Situation without agent exclusion feature

The vision channel also has agent exclusion feature enable. Therefore, between each sound and vision channel,

we only need “&&” (“and” operator).

And also we need avoid sound and vision channels are filled in the same decision node, because the sound and

vision channels have independent exclusive agent engine.

All of them happened automatically and the user will not notice it.

Dynamically Decrease Intelligence Mechanism (DDIM 1.0)

In some situation, for optimizing and speeding up of simulation, we need disable some feeling for some agents.

And block the others agents feel them.

sound.mute (output channel)

If this channel is executed, the current agent will disable the sound and also cannot be hear by others agents.

vision.mute (output channel)

If this channel is executed, the current agent will disable the vision and also cannot be seen by others agents.

There is an example we explained more about this in Part 9: Optimization - Lower the Intelligence

Collision Detection

Collide channels are another important kind of feature make agent interactive each other. For details, please

check out Part 7 Collision Detection

Page 141: MiarmyManualForV2.0

Miarmy 2.0 Manual

141 ©2011-2013 Basefount

Interactive with Environment One can create many Miarmy perception contents in scene and organize them to environment.

Some channels can return results based on environment, let the agent can feel the contents of the scene and

interactive with them, like follow a road, avoid stuff and so on.

Ground

Ground channels let agents are able to feel terrains and interactive with them, adapt the shape of terrain, such

like follow the height and align the orientation.

For making the agents are able to feel terrains, we need mark that piece of plane mesh terrain in Miarmy Terrain

Manager. (We highly recommend that you simplify the mesh before marking it terrain)

And once a piece of geometry marked terrain, there is a McdTerrainNode connect to this mesh. This node will

record some attributes of terrain for physical simulation usage. So you don’t need do anything on this node.

Terrain manager and mark terrain

Once marked terrain for a mesh plane, agent will find them when apply ground channels.

Above and beneath the terrain plane mesh

The ground channels will first find the closest terrain and return only one result to input results. Shown as the

following picture, in this moment, the agent A can only feel and interactive with terrain 1 and the agent B can

only feel and interactive with terrain 2

Page 142: MiarmyManualForV2.0

Miarmy 2.0 Manual

142 ©2011-2013 Basefount

Agents are able to feel the closest terrain in scene

The ground channel will return the height underneath the feet of agent. For example and take a look at the

following picture, the ground channel will return 3 for first agent, 0 for second agent, minus 4 for third agent

and 2 for last agent.

The ground channel example for agents

The ground.dz will return the angle between the Z-axis of agent and the terrain plane of that agent place, for

example the following picture, the first agent will return α = 35 because the ground in-front is higher, and the

second agent will return β = -40 because the ground in-front is lower, whereas the third agent will return 0

because the ground in-front is align to Z-axis of current agent.

The ground.dz channel example for agents

The ground.dx channel is very familiar with ground.dz channel, nothing special but testing the X-axis. In

following picture, the first agent will return α = 40 because the right terrain is higher, and the second agent will

Page 143: MiarmyManualForV2.0

Miarmy 2.0 Manual

143 ©2011-2013 Basefount

return β = -35 because the left terrain is higher. The third agent will return 0 because the x-axis of agent is align

to the terrain

The ground.dx channel example for agents

Once we get the relationship between the agents and terrain, we can move the agents up and down, rotate

them forward or backward, and left or right for adapting the terrain

Using with ground, ground.dx and ground.dz, we can align our agent seamless to terrain

Bound

Bound is a kind of perception contents, which can be cubic and spherical shapes in this version of Miarmy and

you can key frame it for triggering some event easily, such as triggering a group of agent start to run. (Bound can

be any shapes in next version)

You can create bound in Miarmy > Perception Contents > Create Bound, and each bound has 2 bound related

attributes

Bound channels let agents are able to feel bound and test whether in or out side of bound. It’s the simplest

channel but very useful.

Note: the agents can read the information from deforming terrain, but it may not

accurate when the deformation is big, because there is a Maya Bug. For avoiding the

bug, we just need simply create a geometry cache for that terrain and remove the

deformers.

Page 144: MiarmyManualForV2.0

Miarmy 2.0 Manual

144 ©2011-2013 Basefount

(left:) Bound attributes (right:) Spherical and cubic bound

The bound.in channel will return 1 when the agent inside of it while 0 when the agent outside of it. Suppose

there are 3 bounds in scene and 5 agents located in different places, so the inputs result will be:

return 1 for agent A, C, E

return 0 for agent B, D

Bound channel example

Indexing Technique

Some perception contents support indexing. The perception contents which can be indexed are:

Bound

Zone

Road

Wind

On each one of these perception contents, there usually is an attribute XXX ID, such as Bound ID or Road ID. The

channel name can be modified to such as bound[2].in, road[0].x or zone[15].d. If the channel name have ID, it

can only percept and interact with the perception contents with the same ID, for example, road[3].ox can only

fetch results from the road which Road ID is 3.

For example, bound is one kind of them. Please notice there is a Bound ID attribute on each bound.

Page 145: MiarmyManualForV2.0

Miarmy 2.0 Manual

145 ©2011-2013 Basefount

Bound ID attribute can be any positive value (including 0)

We can simplify use bound[0].in to test whether current agent in bound which Bound ID is 0. So modified from

the previous bound example, the results will be:

Return 1 for agent A, because only A is inside of bound which ID is 0

Return 0 for agent B, C, D and E

Bound channel with indexing techniques

Zone

Zone is a kind of perception contents created from a little piece of mesh, usually not complex one.

And similar like terrain, once a piece of geometry been marked zone, there is a McdZoneNode connect to this

mesh. This node will record the Zone ID attribute for this zone.

(left:) any piece of simple mesh can be marked “zone” (right:) Zone ID attribute on zone

Zone channels let agents are able to feel a geometry zone plane with arbitrary shapes, and return the

relationship to the zone.

In fact the return results are based on the closest point on zone. So any zone channels will firstly find the closest

points from zone, and any calculation is based on these points. The red dot on the edge of zone as shown below:

Page 146: MiarmyManualForV2.0

Miarmy 2.0 Manual

146 ©2011-2013 Basefount

Find the closest point, (left) 2D space, (right) 3D space

The zone.x channel will return the degrees between the agent’s Z-axis and the line from agent to the zones, in

horizontal space. Look at the following picture below, the red dots are closest points and the angle α and β will

be the retuned input results, approximate α = 80 and the β = -140, input results [80, -140]

The zone.x is testing zones in horizontal space whereas the the zone.y is testing zones in vertical space

zone.x channel example

The zone.d (zone.d2d) channel will return the distances from agent to zones in XZ plane. Please take a look at

the following 2 examples.

The first is in the top view, and the agent and 2 zones are all in XZ plane. After agent finding the closest points on

plane, zone.d channel will return in distances in XZ plane, the input result will be [d1, d2].

Page 147: MiarmyManualForV2.0

Miarmy 2.0 Manual

147 ©2011-2013 Basefount

Example of zone.d or zone.d2d channel in top view

The second example shown this in 3d perspective view, please notice although the agent is in top of left zone

but it is in side of it, the distance in XZ plane is actually 0. And the distance from the right zone should be

mapped to the XZ plane d2 instead of those grey lines.

Another example of zone.d or zone.d2d channel in perspective view

The zone.d3d channel will return distances in 3d space. Shown as the following picture, (please distinguish this

to our previous zone.d2d example) we directly get the results from agent to the closest points of the zone. They

are green lines in the following picture, without mapping them to XZ plane. The input results will be [d1, d2]

Page 148: MiarmyManualForV2.0

Miarmy 2.0 Manual

148 ©2011-2013 Basefount

zone.d3d channel example in perspective view

The zone.in channel can test whether current agent in the zone area in XZ plane and return 1 if the agent inside

of it. Like the picture shown below, the agent A, B, and C is inside the zone area in XZ plane and will return 1 for

zone.in channel. For agent D, zone.in channel will return 0 due to that it is not inside of any zone area.

If you using zone[2].in for testing them, the agent B and C will return 1 and agent A and D will return 0.

zone.in channel example with/without zone ID, in Top View

The zone.hi can test the heights from agent to the zones. Firstly we get the vectors from agent to the zones, and

map those vectors to the Y-axis, like the green lines shown in the following picture, the channel input results

should be [h1, h2]

zone.hi channel example in perspective view

Page 149: MiarmyManualForV2.0

Miarmy 2.0 Manual

149 ©2011-2013 Basefount

Repel/Forbidden Zone

What is Repel Zone

There is an interesting extra attribute on Zone object, it is “auto repel distance”, when this value set greater

than 0.1, it can repel agent out from zone without any logic trigger, this is useful when the agents want to get

around this zone.

Usage

All the things are automatically without any logic and

But please notice, if the agent already inside, it cannot push out them

Repel zone distance example, the agents already in there will not been pushed out

We recommend combine the obstacles meshes to a single mesh (and delete the history), can accelerate the

simulation speed tremendously.

Page 150: MiarmyManualForV2.0

Miarmy 2.0 Manual

150 ©2011-2013 Basefount

A more complex example

Spot

Spot is another perception content of Miarmy. It’s actually a point in 3d space. With spot channels, agents can

test distances and directions with the spots and interactive with them, such like follow a spot, or trigger some

behaviors near a spot.

Additionally, spot support indexing.

(Left:) spots in scene, (right:) spot attributes

Note: you may notice there are some extra attributes on each spot, they are actually

belongs to build-in force field, we designed spot with a build-in force field combo due to

that in many case we need them both working together. We will talk about this later in

Part 7: Physical Simulation – build-in force field

Page 151: MiarmyManualForV2.0

Miarmy 2.0 Manual

151 ©2011-2013 Basefount

You can create spot in Miarmy > Perception Contents > Create spot, and each spot has 1 spot related attribute.

The spot.x channel will return the angle between the Z-axis of agent and the line of agent to the spots (angle

between black line and green lines, shown as below). In the following example, the spot.x channel will return α

degree for spot A, β degree for spot B and γ degree for spot C, so the input results should be *α, β, γ+,

approximate [45, 130, -70]

The spot.x test spots in horizontal space whereas the spot.y channel test spots in vertical space

spot.x channel example

The spot.d channel will return distances between the agent and the spot in 3d space, like the following picture,

the spot.d channel will return the input results [d1, d2, d3] from current agent.

Page 152: MiarmyManualForV2.0

Miarmy 2.0 Manual

152 ©2011-2013 Basefount

spot.d channel example

Road

Road is a main perception content of Miarmy. It’s actually a point in 3d space. With spot channels, agents can

test distances and directions with the spots and interactive with them, such like follow a spot, or trigger some

behaviors near a spot.

For creating road, just select any curve, and click:

Creating road from curve

Road under the hood

Assets

Once we create a road, there are 3 kinds of asset been created, they need working together for displaying the

road and interacting with agents. Please manage them well and don’t delete any one of it, or your road would

not working properly.

Page 153: MiarmyManualForV2.0

Miarmy 2.0 Manual

153 ©2011-2013 Basefount

1. Road control curve

2. Road mapping curve

3. Road node

Take a look at the following pictues, in the left picture, the selected curve on top of road is the “control curve”

and the blue-arrows-formed road on the ground is the “road node”. In the right picture, the selected curve on

the ground is the “mapping curve” which is a mapped curve from control curve. It always been set as

Intermediate Object (know more about Intermediate Object, please Google “Maya intermediate object”).

Control curve and mapping curve, the blue flow arrows are road node

Management by Parenting

For parenting road to others node ,you just need parent the control curve to other node. For example, you need

parent your road from “Perception_Set” to “group1”, you just need select curve1 and parent curve1 to the

group1, then the rest suff will be automatically moved to group1.

Parenting “road” process from Perception_Set to group1, only operate on curve1 (the control curve)

Road Visualization by Control Curve Points

Arrange well the points on control curve can lead better visualization of the curve, just like the pictures below.

Page 154: MiarmyManualForV2.0

Miarmy 2.0 Manual

154 ©2011-2013 Basefount

(left:) A well arranged control curve (right:) a non-well arranged control curve

But please don’t add or delete points on control curve, because in fact the control curve is controlling the

“mapping curve” all the time. The road will not working if you add/delete the topology of the control curve.

Road Precision by Control Curve Points

The precision of road is determined by the complexity of control curve (before creating)

Usually, a more precise road only can lead better visual result, but the calculation is slower, we not recommend

you do that.

Attach Road to Terrain

Road can be attached to terrain. Select the control curve and terrain mesh, and click Miarmy > Knowledge

Perception > Attach Road to Terrain, your road will be attached to terrain.

Page 155: MiarmyManualForV2.0

Miarmy 2.0 Manual

155 ©2011-2013 Basefount

Road has been attached to terrain

Road Mode

Road can be 2 modes: flow mode and road mode.

Using flow mode, you can roughly constrain a group of agents follow a flow and make them

convergence or separate by flow edge direction.

Using road mode, you can precisely constrain you agents in road even a portion of road.

Flow mode:

Flow Mode: turn on flow and turn off road

Road mode:

Road Mode: Turn on road and turn off flow

Page 156: MiarmyManualForV2.0

Miarmy 2.0 Manual

156 ©2011-2013 Basefount

Usually, you can switch mode by menu item:

Switch road mode in menu item

Flow Mode Attributes

Please notice, flow mode is not support indexing techniques,

Flow mode attributes

Flow Width Attribute:

The narrow and wide flows, controlled by “flowWidth” attribute

Note: There would be an update problem here. Sometimes, after switching mode, the

road would disappear, like this (picture below, left). You can simply move the control

curve little bit, it would be ok. (Right picture)

Page 157: MiarmyManualForV2.0

Miarmy 2.0 Manual

157 ©2011-2013 Basefount

Flow Orient Attribute:

The outward and inward flows, controlled by “flowOrient” attribute

Flow Edge Attribute:

(left:) 1.0 (100%) edge ratio (right:) 0.3 (30%) edge ratio

Flow Len Attribute:

The long and short arrows’ length of the flows, controlled by “flowLen” attribute

When the agent is in flow, it can feel it automatically.

Road Mode Attributes

Road mode can use indexing techniques.

Page 158: MiarmyManualForV2.0

Miarmy 2.0 Manual

158 ©2011-2013 Basefount

Road mode attributes

Road Width Attribute:

Narrow or wide roads, controlled by “roadWidth” attribute

Road for perception

Road Orientation

No matter road or flow mode of the road, the relationship of road orientation and agent orientation is the same,

just as the picture shown below. If the road direction pointing to the agents left, the return value should be

positive, if the road direction pointing to the right of agent, the return value should be the negative.

Page 159: MiarmyManualForV2.0

Miarmy 2.0 Manual

159 ©2011-2013 Basefount

The relationship of road orientation and agent orientation (both road and flow mode, the same)

Road Channels

Different mode should use different channel, or they will not work.

If you are using flow mode, there is only one channel called road.flow available.

If you are using road mode, you can use road.x and road.ox channels.

Firstly, if the agent isn’t on the flow, the channel will return blank. For the agents on the road, the channel will

return the angle between the agent Z-axis and the flow direction.

Take a look as the following picture, the red arrows are the flow direction, and the blue arrow are the agent Z-

axis. For agent D, the channel road.flow will return blank, for agent A, B and C, the channel will return α = -70, β

= 30 and γ = 25.

Page 160: MiarmyManualForV2.0

Miarmy 2.0 Manual

160 ©2011-2013 Basefount

road.flow channel example, red: flow direction, blue: agent z axis

The road.x channel will return the position of agent on the road, the middle of the road is 0, and the left and

right side of the road are 1.0 and -1.0. In the following example, the agent C will return blank because it’s

outside of the road, the agent A, B and C will return -0.4, 0.2 and 0.5 respectively.

road.x channel example

The road.ox channel will return the angle between the agent Z-axis and the road direction, the red arrow is the

road direction and the blue arrows are the agent Z-axis. For the agent C, the channel will return blank, and for

the agent A, B and D, it will return β = 35, γ = 0 and α= -70 respectively.

Page 161: MiarmyManualForV2.0

Miarmy 2.0 Manual

161 ©2011-2013 Basefount

road.ox channel example, similar with the road.flow

Maya Field

Agents can feel Maya field directly without any additional setup.

Red arrows are the directions of field and the blue arrow is the Z-axis of agent

Similar the road.ox, the field.ox channel will return the angle between agent Z-axis and the field direction of

agent position in horizontal space. In the following example, the channel will return result α = 25, β = -65 and γ =

-110 respectively, for agent A, B and C.

Page 162: MiarmyManualForV2.0

Miarmy 2.0 Manual

162 ©2011-2013 Basefount

Arbitrary Maya field and field.ox channel example

The field.ox is dealing with horizontal space whereas the field.oy is dealing with the vertical space

The field.a channel can return the Maya field amplitude from the agent position.

Composition of Forces

The force field related channels, like the Maya field, fluid, and the wind, are not support indexing techniques.

But they support composition of forces.

Imagine that there are several fields in scene. At this time, channels like the field.ox will NOT return an array

contain each result from each field. Instead, it will return only one result based on the composition of force field.

Like the following example, the 3 red vectors are the initial forces from 3 fields. The orange vector is the

composition force of f1 and f2, and the Green vector is the final composition force vector from f1, f2 and f3.

Channel field.ox will return angle between the blue vector (Z-axis of agent) and the green vector (Force

Composition), which is angle ϴ.

Composition of forces f1, f2, f3 => F1+2+3

Page 163: MiarmyManualForV2.0

Miarmy 2.0 Manual

163 ©2011-2013 Basefount

Maya Fluid

The fluid channels are totally the same as the of Maya field channels, because in fact, fluid is somewhat like the

field, we can read field information from fluid, like the direction and the amplitude.

So the fluid channels including, please refer the field perception contents.

fluid.ox

fluid.oy

fluid.a

Formation Control

Formation control feature is able to make agent feel and perform based on the formation target points. The

points in a mesh or lattice can be set as the targets points of formation.

Formation Object & Formation Node

To use the formation feature, we need firstly flag a formation target object. It can be a mesh or lattice. Select

one mesh (or lattice), and click Miarmy > Knowledge Perception > Mark Formation Flag to make the object to a

formation object.

Make a mesh to formation object

Page 164: MiarmyManualForV2.0

Miarmy 2.0 Manual

164 ©2011-2013 Basefount

Make a lattice to formation object

At this time, you can see that digital number in each point shows that this object has been marked as “formation

target” object. The Node control this digital number display is the formation node. The mesh shape connects

into this node, like the picture below:

Formation node, mesh connect to formation node

And some attributes can control the digital number display of formation node

Formation node attributes

Formation Placement

Then we can place agent from the formation object, Miarmy > Placement > Create Placement Node From >

Mesh (or Lattice)

Create placement node from lattice or mesh

Place notice the created placement node must connect with the same formation control node from mesh or

lattice. (This process will be done by system automatically)

Page 165: MiarmyManualForV2.0

Miarmy 2.0 Manual

165 ©2011-2013 Basefount

Formation node connect both target object and placement node

IMPORTANT: Mesh > formation node > place node

Once everything has been setup ok, the agents been placed from the placement node will store the information

of formation object and the target ID of that point.

Each agent stores info in memory.

Formation object

Point ID in formation object

So each agent has a formation target point, and this point is unique one. In each frame and when the channel

call, the agent can find where the target point is and what the relationship with it.

Formation Channels

Since each agent has a “Formation Target Point”, we can use logic channel read it and get the direction and

distance from it. The name “Formation Target Point” is too long, so we abbreviate this name to “ftp”

ftp.x channel

Similar like “sound.x” channel, it can return the horizontal degree relative to the agent, if the target point is in

agent’s left, return 0 ~ 180, otherwise on the right, return -180 ~ 0. The example of following picture: if the

target point is at A, the return value will be 50. And if the target point is at B position, the return value will be -

120.

Page 166: MiarmyManualForV2.0

Miarmy 2.0 Manual

166 ©2011-2013 Basefount

The ftp.x channel example

ftp.y channel

Similar like “ftp.y” channel, just in vertical space, especially useful control the formation of birds with lattice type

of formation object.

ftp.d channel

Similar like “sound.d” channel, it can return the distance from agent to target point. For example below,

If the target point is in position of A, it will return 1

If the target point is in position of B, it will return 0.3

If the target point is in position of C, it will return 1.2

ftp.d example

With the formation control channel, you can easy let the agent follow its target point, and keep the formation

changing based on the target mesh/lattice changing.

Page 167: MiarmyManualForV2.0

Miarmy 2.0 Manual

167 ©2011-2013 Basefount

Delay Effect

Due to the agents are following the target points, the agent usually slower than the target object and follow that.

For getting the best result, when we’re deforming/animating the target object, we’d better make it a little bit

faster than agent moving but not too much.

If the target object is deformed slower than the agent moving, it will make the agents backward.

If the target object is deformed too fast, it will destroy the formation shape.

So, the best way is make the target object move a little bit faster than agents but not too fast. Just like the

following picture. The deforming object is some bit ahead of birds.

Delay Effect

Page 168: MiarmyManualForV2.0

Miarmy 2.0 Manual

168 ©2011-2013 Basefount

Multiple Formation Target Objects

If you have many formation target objects, please setup them one by one separately. That is means we need

mark formation and generate placement node for each of formation object. The usage of formation channels is

the same.

Multiple formation objects driving agents

HP & MP

HP (hit point) and MP (mana point) are 2 custom variables for arbitrary usage, usually be used to simulate the

energy of agent. Each one of agent has some initial HP and MP value after first creating. This value is store in

memory and only can be modified by the related channels.

You can set the initial HP and MP in McdAgentGroup node and randomize them when initializing.

Page 169: MiarmyManualForV2.0

Miarmy 2.0 Manual

169 ©2011-2013 Basefount

The McdAgentGroup node and the attributes on it

The hp channel for input, it will return the current value of HP inside the agent memory.

The hp and hp.set channel for output, it will set the value of HP to the specific value.

In most of the cases, we are not use using hp channel like that. Usually, we firstly setup the hp channel in default

decision node, make the output type “change rate”.

At this time, the hp for output channel will not set HP value, instead of that, it will change the HP value per

second. For example, when the agents are walking on the radiation zone (zone[1].in channel greater than 1), the

HP will drop some points(5 points) per-second. And if you want to reset the HP value in agent memory, you

need use hp.set channel because at this time the hp channel is in “change rate” mode, you cannot reset hp

value directly by hp channel.

Setup output type to “change rate”

Agent hp will drop at speed of 5points/second if it in the zone which index is 1

Reset agent hp to 100 if the agent in bound

Page 170: MiarmyManualForV2.0

Miarmy 2.0 Manual

170 ©2011-2013 Basefount

The MP and the mp channels are totally the same as HP and hp channels

Lean

Lean channel will return the relationship between the agent and the 0 transformation space, using lean channels,

you can test is agent tilt up/down or roll left/right

Mathematically, it will return the Y component of the X, Y or Z unit axis. It’s one of the simplest channels. The

unit axis only have length 1, so the result will be [-1,1]

lean.x: negative means roll left, positive means roll right

lean.z: negative means head down, positive means tilt up

lean.y: (not usually use) negative means agent flip down, positive means agent in positive side

Example of lean.z

Page 171: MiarmyManualForV2.0

Miarmy 2.0 Manual

171 ©2011-2013 Basefount

Example of lean.x and lean.y

This can be used to control bird flying, if tilt up, flip faster the wings, if head down, stop flip

(Left) flying up, wing flapping, (right) head down, stop flapping

Parent channel, transform space

Since version 1.5, Agent can be parent to others transformation space when simulation, and t

Sometimes we want to achieve agents walk on vehicle, and when the vehicle move away, the vehicle will take

away the agents and the agents will move along with them.

Page 172: MiarmyManualForV2.0

Miarmy 2.0 Manual

172 ©2011-2013 Basefount

The agents are in world space

We make that plane a zone, and when the agents are on that plane, it will perform parent channel:

Parent channel

After parenting, the agents will go to the pPlane1

And when we click the rest, the agent will come out to original transformation space.

Page 173: MiarmyManualForV2.0

Miarmy 2.0 Manual

173 ©2011-2013 Basefount

Note: when placement, the agent will record the current parent node to its memory and will return to its parent

when we reset the start frame

Parent Channels:

parent:xxx

parent current agent to object which name is xxx

parent:0

parent to world space

Notice, the parent object cannot contain scale value!!

Some Transform Channels

tx, ty, tz, rx, ry, rz can be filled in input channels now and it will return the value of current tx, ty, tz, tx, ty, tz

respectively from defuzzed output channels.

For example, this can be used to control bird flying. When the birds is turning, the “ry” channel will be reflect the

birds behavior, we can put “ry” in input channel, make them lean to left when turning left and lean to right

when turning to right.

(Left) turning right (right) turning left

Scene Info

The channel frame will return the current frame number.

The channel goFrame will return the frame number since beginning of simulation start.

Page 174: MiarmyManualForV2.0

Miarmy 2.0 Manual

174 ©2011-2013 Basefount

Randomize

The noise channels will return a random number from 0 to 1 based on different conditions. You can easily

combine this value with fuzzy logic to make your output randomize.

Channels

The channel noise.id will return a random number based on agent ID. Each agent has a unique ID in scene once

it was placed out.

The channel noise.time will return a random number based on current frame number.

The value range of the returned random number is from 0 to 1, a float point number.

Usage Example

Randomize speed

The bigger activated, the faster the speed, random by agent id

Page 175: MiarmyManualForV2.0

Miarmy 2.0 Manual

175 ©2011-2013 Basefount

Random speed

Randomize actions

Random action

Sine Channels

Sine is a very simple math tool can return value between 0 and 1 and also it’s a periodic value.

sin(x * frequency), the x is hidden and it’s the second unit

Page 176: MiarmyManualForV2.0

Miarmy 2.0 Manual

176 ©2011-2013 Basefount

Channel with “all” suffix: control all, means all agents have same phase, all the agents will get the same value,

also have same period

sin_all()

sin_all(<frequency>) for example sin_all(2)

Channel with “agents” suffix: randomize phase on each agents, different agent will get the different value due to

the randomized phase. But all of them have the same period

sin_agent()

sin_agent(<frequency>) for example sin_agent(1.5)

Note, the higher frequency the faster change the value

Timer Channels

We can use timer channels to return a value between 0 and 1 from time to time, There are some parameters we can specify into the timer channels:

Seed: assign it for different timer can get different phase results

Freq: make the timer playback faster or slower than others There is a sub channel:

“.bf”: this make the timer result “back and forth” instead of “finish and return” There are some channels we have “_agent” extension:

_agent: make another seed for different agents. Examples:

timer

Example “timer” channel in sequential 6 time points

timer(seed)

Page 177: MiarmyManualForV2.0

Miarmy 2.0 Manual

177 ©2011-2013 Basefount

Example “timer(1) and timer(2)” channels in sequential 6 time points

timer(seed, freq)

Example “timer(1,2) and timer(1,0.5)” channels in sequential 6 time points

timer.bf The sub channel “.bf” stands for “back and forth”, it will backward playback the timer and return the value like ping-pong playback in Maya time slider.

Example “timer and timer.bf” channels in sequential 6 time points

timer.bf(step)

timer.bf(seed, freq)

Page 178: MiarmyManualForV2.0

Miarmy 2.0 Manual

178 ©2011-2013 Basefount

timer_agent Make another seed for different agents

Example only one “timer_agent” channel for 2 different agents in sequential 6 time points

timer_agent(seed)

timer_agent(seed, freq)

timer_agent.bf

timer_agent.bf(seed, freq)

timer_agent.bf(seed,)

Agent Bone & terrain Channels

Agent bones can interactive terrain now by bone channel:

joint1:ground

footL:ground

The return result will be the same as the regular terrain.

If the bone is higher than terrain, it will return positive value

If the bone is lower than the terrain, it will return negative value

This is useful when the joint is controlled by IK system, because sometimes we need put our feed on the ground

if the feet beneath the terrain.

And if there is no terrain detected in vertical space, it will use the default 0 plane.

IK Offset Channels

IK is the data in action node can modify the result of animation when assigning data from action node to agent.

Currently, we support only IK offset channels from the bone name, such as:

Page 179: MiarmyManualForV2.0

Miarmy 2.0 Manual

179 ©2011-2013 Basefount

footL.ik:yOffset

For more details about IK, please the IK session in Animation Part

MEL/Python source in Logic Channels

We can fill a mel/python command in input or output of Miarmy Channel, this can make your Maya scene

interactive with your agents or your agents trigger Maya do something! This can expanding our works to

another level

The format will be:

maya.mel:<mel command or mel proc name>

maya.python:<python command or python function>

We highly recommend you just use a predefined procedure or functions

For example:

maya.mel:getAttr pSphere1.ty;

maya.mel:onemelproc;

maya.python:onepycommand()

A MEL command in input (complete command)

Note: the return value of this command should be ONE float value, or otherwise, it will not work properly.

This also can be output, for example something happened we execute a mel/python command.

Python command in output (predefined function)

Page 180: MiarmyManualForV2.0

Miarmy 2.0 Manual

180 ©2011-2013 Basefount

Simulation Space

World Transformation for physical simulation

If our agent enable dynamics, no matter where the agents and how the structure like, the agent will enable

ragdoll in world transformation space. Including the kinematic primitives, terrains, all of them will join the world

space calculation.

Local Transformation for non-physical simulation

Except physical simulation, in most case and more interesting, we are dealing with the agent which driven by

logic and decisions.

As our design, all of the Miarmy agents (not enable dynamics) and perception contents are calculated in local

transformation. Our engine will fetch the data such as the rotate of agent, the position of spot, all from their

local transformation.

So you can easily parent you agents to different transform nodes such as locator nodes make engine calculate

them separately. With this feature, you can easily simulate different groups of agent on different moving objects

like some battleships.

Simulation in different transformation space

But only using the simple transform node is not enough at all, because the agents in a transform node can feel

the agents in others transform node. This may cause the calculation error. Take a look at the following example,

we were going to make them moving in different space and not affect each other. However, their local positions

are the same. When the engine calculating, the agent A can feel agent B and try to avoid it, also the agent B will

avoid agent A.

Page 181: MiarmyManualForV2.0

Miarmy 2.0 Manual

181 ©2011-2013 Basefount

Same local positions in different transform nodes

For entirely avoiding agents in one space feel the agents in another space, you can group them to Solver Space

Node.

Solver Space Node

Technically, the solver space node is the same as locator (without shape node), also a kind of transform node.

But our engine can recognize it and calculate the agents and contents inside of it independently.

For creating solver space node, you just need simply click Miarmy > Knowledge Perceptions > Create Solver

Space.

(Left:) the solver space node, (right:) solver space attribute flag

Once you putting the agents and perception contents inside of solver space node, they will work independently

in local transform space. The agents in a solver space node will not feel the agents or perception contents in the

others solver space nodes.

If you want to parent you agents to a solver space, please parent the place node to the solver space or using

inverse place for recording parent’s name.

Page 182: MiarmyManualForV2.0

Miarmy 2.0 Manual

182 ©2011-2013 Basefount

The solver space hierarchy

The contents in solver space can be parented to any other nodes inside of this solver space node, just make sure

the root of them is this solver space. Shown as the following picture, McdSpace1 is a solver space node, you can

put different perception contents in different groups in McdSpace1, some spots in “null1”, and some roads in

“null2”. Our engine can recursively find out the solver space node.

Arbitrary hierarchy under Solver Space node

Join World Attribute

There is a special “joinWorld” attribute on each of solver space.

Once you enable this attribute, the engine will take the world transformations of agents in this solver space

node instead of normal local transformation. And the agents in this solver space can feel others agents and

perception contents in the others solver space nodes which “joinWorld” attribute been also enabled. Calculate

just like they are in world space, but they are actually also the child of each solver space node.

Output Behavior Channels

Transform Speed

tx: move some units per second in the x-axis of the agent object

tx: move some units per second in the y-axis of the agent object

tx: move some units per second in the z-axis of the agent object

tx: rotate some degrees per second by the x-axis of the agent object

tx: rotate some degrees per second by the y-axis of the agent object

tx: rotate some degrees per second by the z-axis of the agent object

Bone Offset

<boneName>:tx add offset units in translate X of the bone whose name is boneName

<boneName>:ty add offset units in translate Y of the bone whose name is boneName

<boneName>:tz add offset units in translate Z of the bone whose name is boneName

<boneName>:rx add offset degrees in rotate X of the bone whose name is boneName

<boneName>:ry add offset degrees in rotate Y of the bone whose name is boneName

Page 183: MiarmyManualForV2.0

Miarmy 2.0 Manual

183 ©2011-2013 Basefount

<boneName>:rz add offset degrees in rotate Z of the bone whose name is boneName

Sound

The sound has two channels can be output, they are sound.f and sound.a.

By default the frequency and range of sound are the values from McdAgentGroup node. However, you can use

the sound output channels to modify them.

(Left :) the McdAgentGroup node; (right :) The default sound Frequency and range on node

Note: if the sound range is 0, means the sound range will take the value calculated from bounding box, see Part

4 Agent Infrastructure – Original Agent

The channel sound.f in output channel can modify the sound frequency of the agent, whereas the channel

sound.a in output channel can modify the sound range.

Vision

There is no vision channel for output directly, but there is a color channel can modify the result of vision

received.

(Left :) the McdAgentGroup node; (right :) setup the color for this type of agent

The channel color in output channel can modify the color of agent, and change the vision.h results.

If the color result is -1 in output, the agent cannot been seen by any other agents.

Aim Constrain

We provide a turn-key aiming feature for the bones of agent, which can drive your agent bone aim to target.

There are some subtle features of it.

Page 184: MiarmyManualForV2.0

Miarmy 2.0 Manual

184 ©2011-2013 Basefount

Aim channels

Preparation for Bone Axis

Before generating the original agent, we need setup our rig. If we want to one of the bone aim to target, we

need firstly make sure the aiming axis and up vector. In the following pictures show, before generating original

agent, please make sure the X (or Z) axis is the aim axis and the Y axis is the up vector. (Note: the other orient

scheme is not support for current version of Miarmy)

The X (or Z) should be aim axis and the Y should be up vector

Aim Channel Features

Aim Channels

The channel conventions of aiming:

<Bone Name>:aim<axis><space>-><Target object>

<Bone Name>:aim<axis><space>(<percentage>)-><Target object>

Page 185: MiarmyManualForV2.0

Miarmy 2.0 Manual

185 ©2011-2013 Basefount

The <Bone Name> should be the segment bone name from agent memory. You can check the real name

in agent memory by Miarmy > Agent Viewer

The <axis> should be the axis of bone which you want to it aim to target

The up vector should be always Y axis (for this current version of plugin)

The <Target Object> name should be the unique name in Maya Scene. The dag nodes with the same

name in different hierarchy many cause problems.

For example:

eyeL:aimX3d->pSphere1

head:aimZ2d->pSphere1

Once the channel is activated, the bone which you specified will turn and aim to the target with a rotation speed

gradually. This speed is determined by channel result which range is 0 to 1.

Note: the aim turning process is interpolated by Quaternion, so there is no Gimbal Lock.

Gradual Aim

Once the bone wants to aim to target, it will aim to target gradually rather than pointing to target directly. Like

the following picture, from default pose, the bone point to the target object gradually, and the speed is

depending on the output value. 0 make the bone still, 1 make the bone instant point, the value between 0 and 1

(such as 0.4) make the bone point to target 40% each frame.

Gradually aim to target from default to aim pose

Percentage Aim

We can specify percentage in aim channel to make the bone aim to right direction but not fully aim to target.

For example, we can specify a 60% aim channel like this, eyeL:aimX3d(60)->pSphere1, you may notice the bone

will approach to the 100% aim pose but not fully aim to target. Finally, it will stand the pose which performs 60%

aim direction between the default pose and 100% aim pose.

Page 186: MiarmyManualForV2.0

Miarmy 2.0 Manual

186 ©2011-2013 Basefount

60% aiming make non-full aim result

Self-restitution

Once the sentence is not true (the default output value of each aim channel is -0.2) or the channel result is

negative, the bone will restitute to the default pose gradually and automatically.

Returns back to default pose automatically

Aim Space

Aim space is simple. In some case, we just want to the bone aim to target in horizontal space, such as our “neck”.

Our head can rotate to any directions but our neck can only rotate in some degree in Y axis:

Page 187: MiarmyManualForV2.0

Miarmy 2.0 Manual

187 ©2011-2013 Basefount

Use 3d for the head whereas 2d for the neck

Hierarchical Aim Mechanism

This process is entire automatically, and here we just explained what is happen under the hood.

When you have multiple bones in the same hierarchy want to aim to the same (or different) target, the order of

aim bone may cause problem. Imagine that your hand and arm want to point to the some targets. If your hand

point to the target firstly, and then you rotate your arm secondly, after your arm aligning to its target, maybe

the previously done hand will not point to right direction.

With Miarmy hierarchical aim mechanism, we firstly collect all aim tasks and then execute them hierarchically.

For example in the arm tree, it’s definitely arm will aim to target before the hand performing aim.

Multi Targets Choose

Rather than Maya traditional aim constrain, we can make the agent bone to aim arbitrary number of targets,

just using simple sentence active:

Let’s take a look at the following example directly.

We want to our agents aim to right sphere when they are in blue bound whereas aim to left sphere when they

are in red bound. Just using the bound channels and the indexing technique, we can easily achieve that.

head:aimZ2d->pSphere2 (active in red bounding box)

head:aimZ2d->pSphere1 (active in blue bounding box)

Page 188: MiarmyManualForV2.0

Miarmy 2.0 Manual

188 ©2011-2013 Basefount

2 different targets can be triggered aim by different conditions

The bone will always aim to the target which makes the output the most activated.

Arbitrary Aim Axis and Up Vector

Aim channel now extend to arbitrary axis and up vector,

The old version before 1.5, we only support Y for default up vector and the aim axis should be X or Z:

Aiming: X, upvector Y (default)

Aiming: Z, upveotr Y (default)

The previous version no need specify up vector. The up vector is default and must be Y axis.

<Bone Name>:aim<axis><space>-><Target object>

<Bone Name>:aim<axis><space>(<percentage>)-><Target object>

The new version we add the up vector and for arbitrary aiming axis:

The new ones:

<Bone Name>:aim<axis><space>-><Target object>

<Bone Name>:aim<axis><space>(<percentage>)-><Target object>

Page 189: MiarmyManualForV2.0

Miarmy 2.0 Manual

189 ©2011-2013 Basefount

<Bone Name>:aim<axis><upVector><space>-><Target object>

<Bone Name>:aim<axis><upVector><space>(<percentage>)-><Target object>

For example the following picture, we need specif the z axis aimming axis and the x up vector, so we need fill the

channel head:aimZX->pSphere1 or head:aimZX(60)->pSphere1

Z: aim, X: up vector (not work in previous version before 1.5)

Of causer, if you use the default one without up vector, it still work but use Y for default up vector, it will not

change the previously setup.

aimX (x for aimming, Y for up vector)

aimZ (z for aiming and Y for up vector)

Action

We will talk action related channels in details in Part 6 Action

Ragdoll

We will talk this in details later, see Part 7 Physical Simulation

Page 190: MiarmyManualForV2.0

Miarmy 2.0 Manual

190 ©2011-2013 Basefount

Traffic System

What is Traffic System?

Miarmy Traffic system tools provide the tool can automatically setup many complex logic and perception stuffs

in the crossroad. With traffic tools, we can build many crossroads and link them together by roads and form an

interesting system.

Traffic system, crossroads & roads

Features of Traffic crossroad

In this version, our traffic system can only control the cars. We made a crossroad node to provide enough

information to control the car characters.

A crossroad node

Sockets Type

You can choose either 3 or 4 sockets for each crossroad. With the socket type attribute T-Cross or X-Cross.

Page 191: MiarmyManualForV2.0

Miarmy 2.0 Manual

191 ©2011-2013 Basefount

Socket type attributes

Left T-Cross and right X-Cross

Socket Angles

Each socket can be set for different angle for many non-standard crossroads. By each socket independent

attribute.

Socket attributes

The right side crossroad has 2 non-0 angles

Page 192: MiarmyManualForV2.0

Miarmy 2.0 Manual

192 ©2011-2013 Basefount

Entry and Exit

The ports with color are the entries whereas the blank with a white short-line is the exit

The colorful is 3 entries into the crossroad, where as the

Traffic Lights:

The port with green color is stand for this port is green light and let car to pass. Whereas the port with red color

cannot let car to pass

Different light have different pass

That traffic light can be controlled by the attributes:

Traffic light control attributes

Light Change Frame: each a span of time, the light change

Light Change Offset: offset the start time counter

Road width

The entry and exit can set different width for fitting the different road and scene setup. It controlled by the road

width attribute:

Page 193: MiarmyManualForV2.0

Miarmy 2.0 Manual

193 ©2011-2013 Basefount

Road width attributes

Left wider and right more narrow

Left or Right Convention

For different county, people have different traffic convention, so we make the crossroad left right switchable. It

controlled by the attribute,

Right Free

Page 194: MiarmyManualForV2.0

Miarmy 2.0 Manual

194 ©2011-2013 Basefount

The left entry and right entry of the crossroad

Car Stop & Walk Area

The different area can make the different

The area between red and blue circle: car will stop in this area if meet red light and also inside this area

The area between yellow and red circle: people will walk in this area for cross the road (not available in

this version)

The 2 important areas

Traffic Quadrants & Lights

Each crossroad has 4 quadrants. And each opposite two quadrants are a pair, each pair are perform the same

red/green light change.

4 quadrants in crossroad

Page 195: MiarmyManualForV2.0

Miarmy 2.0 Manual

195 ©2011-2013 Basefount

Crossroad Under the hood

When simulation, we’re storing many paths and areas information into the crossroad memory.

If one agent contains the “traffic” fuzzy logic channels, we will firstly test the agent inside or outside the

crossroad range. If inside, we’ll give the agent some proper information of the crossroad, like the path, entry id,

etc. The information will be stored into agent’s brain.

And the traffic channels will return the correct values based on the crossroad information in agent brain.

Once the agent outside the crossroad, the information of crossroad in agent brain will be cleared, then, these

traffic channels will be disabled automatically and no any return (false).

Next session we’ll talk about the traffic channels.

Traffic Channels and Usages

Priority

Future of Traffic System

In the future, we’ll expanding the traffic system to people control and flyover control

Watch Logic Results

Brain Viewer

Using brain viewer, you can check the agent logic status and easy for debugging your agent brain.

Page 196: MiarmyManualForV2.0

Miarmy 2.0 Manual

196 ©2011-2013 Basefount

Brain viewer GUI

Please check out the features demonstration picture below, from brain viewer, you can easily watch the brain

logic structure and sentence active status, and their priorities and defuzz behavior results.

Features details in brain viewer

The brain viewer should be watched in Top View. If the display not correct, please crank the near/far clip plane

for trying to correcting it.

Page 197: MiarmyManualForV2.0

Miarmy 2.0 Manual

197 ©2011-2013 Basefount

Feedback in Essential

Feedback mechanism is an important feature of Miarmy Engine, when simulation, the engine can always

feedback the logic and action status from “marked” agent. For marking the agent, you need just simply select

any one of agents. The latest selected agent will be marked automatically. Our engine will do an extra time of

calculation for this agent and feedback the result to Brain Viewer and Transition Map.

For blocking the feedback, you need disable feedback feature of Engine in Miarmy >Miarmy Global. Once disable

the feedback feature, the simulation will speed up about 20%. So we highly recommend you disable this after

debugging agents and populating huge number of agents.

Block the feedback from agent

Simulation Extra Tools

Feet Map Generator

We can generate feet map based on some specific bones when they walking on the default plane or terrain.

Preparations

There must be some preparation have to been done before generating the foot map,

For holding the area of foot map, we have to build a polygon plane and naming it to “McdFootMapBase”, and

this map should wrapping all the agents inside, of course this mesh can be scale.

Notice, this mesh should be poly plane and the width and height MUST be 1.

Must be poly plane and width/height 1

Page 198: MiarmyManualForV2.0

Miarmy 2.0 Manual

198 ©2011-2013 Basefount

The McdFootMapBase Mesh

And also we need put a mesh to the FootMap_<agent name> to the Miarmy contents, if not existed this folder,

please click Miarmy > Miarmy Contents Check

This mesh should be also the polygon plane and height/width MUST be 1

And of course this map can be scale freely

Then assign a Targa(.tga) file to this mesh,

The texture can be any texture type, but the foot from should be pointing to “down”, because when we make

the map down side, the default UV will make this towards Z direction

Foot map should point down, make default UV point to Z+

Page 199: MiarmyManualForV2.0

Miarmy 2.0 Manual

199 ©2011-2013 Basefount

Assign a .tga map to the map mesh (must be tga)

After assigning the map, scale it to proper size, same as foot just cool!

Setup foot map and put to FootMap_<agent name>

Turn on foot man generation flag on the original agent

Foot Map Generation

Then we can generate the foot map, but before that, let’s take look at some attributes need be setup, Miarmy >

Miarmy Tools

Page 200: MiarmyManualForV2.0

Miarmy 2.0 Manual

200 ©2011-2013 Basefount

Foot map attribute

Foot map folder: Where the foot maps put in

Foot map Name: what name is the foot map

Foot map resolution: X/Y pixel unit of the foot map

Foot map lifespan(frame unit): how much we need inherit previous frame (we will talk about this later)

Foot map height threshold: when the foot less than this value it will generate foot (distance to terrain or

default plane ground)

If the threshold set to 2 and the height greater than 2, it will not generate foot print

The red part greater than 2, will not generate foot print

Let’s talk about the foot print lifetime. When we generate the footMap(N), we will based on the lifespan and use

the footMap(N-1)’s data to fade some foot map. That is means, once we setup the the lifespan greater than 1, it

will take the previous frame to generate current frame, it will fade out instead of disappear immediately.

If you fill 1: 50% will read from previous frame

If you fill 2: 67% will read from previous frame

If you fill 3: 75% will read from previous frame

If you fill 1000: foot prints from previously map will not disappear at all

Page 201: MiarmyManualForV2.0

Miarmy 2.0 Manual

201 ©2011-2013 Basefount

Life span result

Use this map generate particle or others effects

Visualization

Visualize HP, MP Data

When you select any one of agent, you may notice there are 2 bars on the head. They are HP/MP bar. You can

use it for visualizing the information of the internal HP/MP data. Like the picture below.

Page 202: MiarmyManualForV2.0

Miarmy 2.0 Manual

202 ©2011-2013 Basefount

HP/MP bar on the head

If you have some logic want to control the HP/MP data, for example, when agent fighting, the HP drop some

points each second, these bars can indicate you very clearly how many HPs or MPs remain. And this can improve

your productivity.

You can turn this off at Miarmy > Visualization > HP/MP Bar Switch

Some HP dropping when fighting

Page 203: MiarmyManualForV2.0

Miarmy 2.0 Manual

203 ©2011-2013 Basefount

Visualize Action Transition

There are 2 modes for displaying transition status

1. Normal playback: there will be only one bar on the ground

2. Transition in process: there will be 2 bars on the ground

(Left) currently playback (right) in transition

Turn of this at Miarmy > Visualization > Action Info Switch

Visualize Agent ID

There is a little green digit show the unique id of this agent

The agent ID in yellow circle

Bounding box display Mode and Inverse Placement

Agents can be display as bounding box and this can speed up the graphic card interactive speed, We’re not

means the bounding box from Maya, it is the Miarmy Bounding box display mode,

Page 204: MiarmyManualForV2.0

Miarmy 2.0 Manual

204 ©2011-2013 Basefount

boundMode attribute on each agent

On each agent, there is an attribute “boundMode”, when turn this on, the agent will become the bounding box

display mode:

(Left) agent display (right) bounding box display

This attribute is support inverse placement. Once you inverse place, all the information will store back to

placement node and it will place out the agents with bounding box mode after next time open your scene.

Page 205: MiarmyManualForV2.0

Miarmy 2.0 Manual

205 ©2011-2013 Basefount

Part 6 Action In this part, we will detailed explained how Miarmy Animation and Action system working and under the hood.

Action Infrastructure

Action Node Data

The action node contains

Action length (integer)

The length of this action

Action Data (2D array)

The pose data of each frame, using this data array and a frame number, we can set the agent pose. Note:

the root data in this action data array would be modified after generating of agent transform data.

Original Root Bone Animation Data (array)

Extract the root bone pose data of each frame from Action Data before generating agent transform data

Agent Transform Data (array)

Calculated agent locomotion data for each frame from Original Root Bone Animation Data

In this version of Miarmy, the data of actions are stored according to the bone hierarchy. So, the actions drive

agents by bone hierarchy. The bone structure of rig and original agent should be the same all the time for the

same type of agent. The actions are generated from rig, and these actions can be shared to use among the

different types of agents if the hierarchy of them are the same.

Note: in the next version of Miarmy, action drive agent support “hierarchy + bone

name” combination method and coming in April. At that time, the action drive agent not

only depending on the hierarchy, you can add some extra bones to the Original Agent

and reuse the existed action node

Page 206: MiarmyManualForV2.0

Miarmy 2.0 Manual

206 ©2011-2013 Basefount

Action Node Attributes for Playback and Transition

There are many attributes in each action we can setup them in action editor

Action Editor

Rate

The speed of playback for this action

Is Final

If enable, once agent transit to this action, it will never transit to others in any situation. Like the “dead” action.

Is Cycle

If enable, means we dealing with this action a cycle action can be transit to itself.

Cycle Filter

Only work with cyclic action, blending the end self-transition part to the head part of the action by some percent.

As picture above, after playing back green area, the action will perform self-cycle.

Entry Range

When previous action transit to current action, some percent should be smooth blended. This is the entry range

of this current action. Like the picture below, when the previous action transiting to current action, 10% of

action length should be blended from previous end to current start.

When transiting in, blend with previous action

Page 207: MiarmyManualForV2.0

Miarmy 2.0 Manual

207 ©2011-2013 Basefount

Exit range

When current action should transit to next action, only when the current action playback after exit range

percent, the current action can transit to next action, otherwise, maintains the self-playback

Only after 80% playing back, the current action can transit to other actions

Agent Transform Data

Agent Transform Data is generated from you “rig root”, and stored independently in action node. It's a kind of

locomotion data can be applied to overall agent

As we all know, we create action from animation, it is a piece of motion in a range. For example a character is

walking in scene and we build action data 24 frames.

In the below picture, it’s a walk cycle, no special:

A walk cycle from A to B, for example 24 frames

The normal animation will be from A to B and get back to A, once again, from A to B, repeatedly.

We want to apply it to the agents and make the agent move forward in any direction and not in one place. We

want to make the agent travel in scene.

Transform “the walk cycle A to B” to “agent locomotion data”

Page 208: MiarmyManualForV2.0

Miarmy 2.0 Manual

208 ©2011-2013 Basefount

The red line is repeatedly playback animation

The yellow line is the action with agent transform data. The movement of yellow paths shown is our purpose.

With agent transform data, we can apply the accumulate locomotion to the agent, and our agent can work

independently in our scene

For this purpose, we need separated the animation in 2 parts:

Action data: the animation pose data of each frame

Agent transform data: the root node velocity data can be used to apply to single agent transform.

Usage:

1. The action data part is responsible to pose you agent only.

2. The agent transform data part is responsible to move your agent for each frame.

The agent transform data actually is an array of velocity value for each frame. So, no matter where the agent is

and what direction the agent orient to, we just apply a velocity to it each frame. The result is, the agents can

travel in scene anywhere respectively, and not repeat playback.

Agent transform data can be several types:

The “A” picture above shows the “locomotion” type, and “B” shows the “turning” type.

Static: agent stands without transform change (e.g. stand, sit, cheer)

Locomotion: agent walks in z direction straight (e.g. walk, stand to walk, jog, run)

Turning: agent turning to left or right (turn left, turn right)

Ramp: agent go up or go down (go upstairs, climbing)

Miarmy will automatically generate agent transform data for you when you create action.

Also we provide tools are able to re-build it or fix it

Click auto fill, you can build agent transform data as preset:

Page 209: MiarmyManualForV2.0

Miarmy 2.0 Manual

209 ©2011-2013 Basefount

Fix Agent Transform is used for shifting or rotating your agent transform data:

For example1:

The standard agent orientation is “+Z”, but if your animation rig is walking in x direction. After creating action,

you can rotate it back to +Z.

Just fill 90 in action editor, and click “Fix Agent Transform”

Fix the agent transform data

For example2 (sample 29 scene file)

The root of agent moved

Page 210: MiarmyManualForV2.0

Miarmy 2.0 Manual

210 ©2011-2013 Basefount

Please notice the above animation, from stand to sit, character’s root (hip) has been moved, from A to B.

However, this action is a static action. When this action transition to sit action, there will be a weird behavior:

The red spot is the “origin”. The left action is “stant_to_sit” and right is “sit” action.

You may notice the

1. In “stand_to_sit” action: the Origin is in the character’s feet.

2. In “sit” action: the origin is in character’s root (hip)

If the agent transit from “stand_to_sit” to “sit”, the action will “shift” forward, because the 2 action have

different origin places. At this time the only thing we need to is move the sit origin to his front, like the picture

below:

Fix the agent transform data

The result will move the action entirely forward. The play back transition will now without “shift” and seamless.

Summary: Although the agent transform data is crucial, this data can be actually automatically generated. So, in

most of time, you no need to care about that, just choose the right type. Everything will be fine.

Page 211: MiarmyManualForV2.0

Miarmy 2.0 Manual

211 ©2011-2013 Basefount

Action Features

Action Trigger

Trigger Action by Name

Logic: if the agent in the zone area of which the id is 0, perform walk

Trigger action directly by name of action

Action Group Trigger

Action Group Random

Logic: if the agent in the zone area of which the id is 1, perform one of “cheer” actions group

Trigger action by action group name

From action group, system can select one of the actions from the group. And make that selected action trigger

action. The rule of select is randomization.

Page 212: MiarmyManualForV2.0

Miarmy 2.0 Manual

212 ©2011-2013 Basefount

Randomize select one action from action group

Action Group Channels

After Miarmy 1.5 we provide some new easy to use channels for action group, user can easily use them

randomize your agent behavior

actionGroup:XXX (for input)

Test is current agent playing action from action group XXX

actionGroupSelect:XXX

Select one of action from action group and continue playback keep no change, such as some of people

run different types but will not change over and over again, some people select runFast, some people

choose runSlow and other choose runNormal. Please distinguish this with actionGroup:XXX

actionGroupRate:XXX

Set playback rate of all actions from XXX action group

*:rate

Change the current playing back action rate

Choice Rate

Action Group Playback Rate

See “Action Playback Rate” Channels

Action Blending

You can modify the playing back action by action blend and action rate which you specified in output channel.

Action to ActionBlending

If the current playback action has blend actions, the blended action will be performed automatically, based on

the defuzzed active result of blend channel. The default blend weight is 0.0. Please notice the following things.

Blend actions should be the same length as the main action. For example, the length of walkHappy and

walkSad should be the same length as the walk action

Blend actions can be different playback rate from main action. For example you can make walkHappy

faster and walkSad slower in action editor. Our action blending engine can blend the rate of them.

Action blend can be more than 1. That is means you can blend walkHappy, walk, walkSad together.

Page 213: MiarmyManualForV2.0

Miarmy 2.0 Manual

213 ©2011-2013 Basefount

The closer the the spot, the more walkHappy action will blend

Modify the action by blends

Action Blending Group

Action Partial Blending

Action Playback Rate

Action Rate

Also you can modify the speed of the playing back action by action rate channel, also based on the defuzzed

active result of rate channel. The default rate is the rate in action editor.

Modify the action by rate

You can increase the rate when the agent is walking down fast and decrease the rate when the agent is climbing.

Page 214: MiarmyManualForV2.0

Miarmy 2.0 Manual

214 ©2011-2013 Basefount

Action Group Rate

Whole Action Rate

*:rate

Action Channel for Input

Action Playback Check

Action Group Playback Check

Randomize Entry Points

When our agents step in to an action, it will start from first frame, this may cause a bit cloning/twinning or

boring result sometimes. So after version 1.5, we make our agents can step into action from randomized entry

points. We make this very easy to control but the result is pretty much natural. It’s useful when our agent

transition to some rest pose, like “standTalk”, agents can start talk freely instead of all firstly frame.

For example:

Entry points randomization

The following agents entered the “walk” action at the same time but different entry points, make this more

natural.

Result of randomize entry points

Page 215: MiarmyManualForV2.0

Miarmy 2.0 Manual

215 ©2011-2013 Basefount

Subjective Objective Action Synchronization

What is SOAS

Subjective Objective Action Synchronization (SOAS) is a technology that pairing and syncing agent action. When

the agents face to face fighting, subjective agent can tell what his doing to the objective agent and the objective

agent will take response precisely and simultaneously based on the subjective action.

SOAS doesn’t need any complex logic setup, and just 2 SOAS Channels are enough.

SOAS channel also have priority control, if another other higher priority action channels activated, the SOAS will

be disable automatically.

SOAS is usually used when 2 people fighting or such pairing behavior. For example, agent A & B, when Agent A is

attacking, the Agent B should defend, whereas the agent A is defending, the agent B should attack. And the

defending and attacking behavior must be synchronized.

2 agents are fighting perfectly

Under the Hood

The SOAS is action node level feature. That is means that no matter what the agent type is, the feature will work

OK. Such as that there are 3 types of agents, each one of them can be both the objective and subjective agent.

Also, the SOAS need the help from sound range. The action information can be only passed to others by the

sound range.

The first step is setup subjective and objective actions mapping relationship, we need specify the relationship for

engine know that before simulation.

Page 216: MiarmyManualForV2.0

Miarmy 2.0 Manual

216 ©2011-2013 Basefount

Once we fill the “tell” channel into the decision of agents, these agents will tell what it’s playing back to the

other agents in their sound range.

Some other agent with “hear” channel can hear these information and get the objective action if subjective-

objective relationship established. Then when logic active, it will perform these objective actions, also will try to

synchronize that.

Setup Subjective and Objective Action

We need firstly setup the Subjective and Objective action in Action Synchronization Editor. In Miarmy > Actions >

Action Synchronization Editor

Setup action sync relationship

For example there are 2 types of agents, A & B. The type A is subjective agent, and type B is objective agent.

The agent type A has:

Attack1_action_A

Attack2_action_A

Defense1_action_A

Defense2_action_A

The agent type B has:

Attack1_action_B

Attack2_action_B

Defense1_action_B

Defense2_action_B

So the relationship of them should be:

Attack1_action_A >>>>> Defense1_action_B

Page 217: MiarmyManualForV2.0

Miarmy 2.0 Manual

217 ©2011-2013 Basefount

Attack2_action_A >>>>> Defense2_action_B

Defense1_action_A >>>>> Attack1_action_B

Defense2_action_A >>>>> Attack2_action_B

Behind the scene, these actions subjective/objective relationship information are actually the action nodes

connections. The subjective action “.syncTo” attribute link to the “.syncs*<id>+” attribute of objective action.

Of course, one action can be objective action of multiple subjective actions. The “.syncs” attribute is an array

attribute.

SOAS Channels

tell:

This is an output channel and when active, it will tell the other agents what is its playing back action and which

frame

hear:

It’s actually an action channel, also output. It will make agent hear they others tell it. And find out the objective

action if heard one is subjective action. If active, it will try to play back that objective action, and try to

synchronize subjective action

tell:<id>

Sub channel “id” just simulates the frequency of “tell”, letting the agent can tell different type different

information. The function is similar like the “tell” channel. If you don’t specify this sub channel, it will be default -

1

hear:<id>

Same as “hear” channel, but it is only able to hear the agent using the same sub channel “id”.

Page 218: MiarmyManualForV2.0

Miarmy 2.0 Manual

218 ©2011-2013 Basefount

SOAS Channels Priority

The SOAS channels also have priority. When an objective action is activated by SOAS Channel, but there is

another action activated by any other channels have higher priority. The agent will try to transit to the higher

priority one instead of SOAS controlled one.

For example, if two channels “hear” and “escape” are activated together, but the “escape” have higher priority.

The agent will try transit and perform “escape” action.

Future of SOAS

The SOAS of Miarmy is not perfect yet, if the agent is too dense, the tell channel will tell many different agent

with the same information, or some agents will hear many information from multiple agents. It only work

perfect with 1 VS 1 scenario, like the picture below.

1 VS 1 scenario

In the future, we’ll make the SOAS more precisely based on sound degree limited or closest one algorithm etc.

Hook up Custom Attributes

Except rotate and translate animation channels, sometimes we want to hook some extra animation to the bones

of agent and let them playback/animate with the action. For example, there is a blend shape animation

happening on a joint/action, we want to hook it to the agent and join the simulation, then after simulation, fetch

the result back for later user. (Such as creating deformer or facial animation)

Enable this Pipeline

By default this feature will be totally disabled, if you want to use it, please firstly enable a hidden attribute in

McdGlobal node of your scene.

Click Miarmy > Miarmy Ready! It will select the McdGlobal Node, and then please manually turn that attribute

on in Maya Attribute Editor.

Page 219: MiarmyManualForV2.0

Miarmy 2.0 Manual

219 ©2011-2013 Basefount

Manually turn on the “hookCustomData” attribute on in McdGlobal Node

IMPORTANT: Before both 1 creating action and 2 creating original agent, please always enable this attribute.

Creating Action

Some joints in the animation rig may contain some custom attributes, for example, like the below image, there

are many user defined attributes and animation on “joint1”

Maya custom attribute channels

Please make sure all the Action Nodes will be created from the SAME Rig with exact the SAME custom data

scheme.

Of course also make sure enable “hook custom data” attribute in McdGlobal Node.

At this time, when we creating the action, these attributes and values, including animations, will be

automatically stored inside action node.

Creating Original Agent

Before creating the Original Agent, you need enable “hook custom data” attribute in McdGlobal Node. And after

creating the Original Agent, these custom attributes will be hooked up on Original Agent.

Page 220: MiarmyManualForV2.0

Miarmy 2.0 Manual

220 ©2011-2013 Basefount

But If you already have original agent and don’t want to re-create original agents, you need firstly active the

editing agent type in Agent Manager, then click Miarmy > Original Agent > Upgrade for upgrading/adding these

custom attributes.

You may notice that if everything all right, the “number of custom data” will be recorded in original agent bone.

And we will use this attribute to allocate memory when building agent. You can double check if these attribute

existed and have correct number

(Above) without custom data, (below) contain 3 custom data

The number of custom data will be stored. And when “original agent” building “agent”, the data will be used to

allocate exact memory in agent, for example, 3, it can allocate 3 float data in agent memory.

Notice: these data will only be linear interpolated between animations, no quaternion or other interpolated

methods.

Simulation

When simulating, these custom data in action node will be assigned to agent bone just like the “translate” and

“rotate” of the bone. Also transiting and blending normally.

When creating agent cache, these data will be also written into the Agent Cache, Character Cache etc…

After simulation, you can fetch these data to drive the deformer, or anything you like. For fetch these data,

please refer the “Single Character Cache Part” of this document (Press Ctrl + F to search).

Page 221: MiarmyManualForV2.0

Miarmy 2.0 Manual

221 ©2011-2013 Basefount

Single Character Cache

Introducing a concept called single character cache.

Regular Miarmy Cache: 1 frame 1 file, each file contains data of all agents, use this drive all Agents each

frame

SC Cache (Single Character Cache): 1 character 1 file, each file contains all frames data for this character.

Use this drive Original Agent or Middle Rig

Note: character cache is not simply rewrite, but convert/transform all the agent data to Maya format

data, that can assign and drive to Maya joint directly. It will improving driving speed tremendously.

Changed: Previously before version 2.0, our system cannot store data for end joint, now we changed many code

for making our system can extend to end joint both in action creating, agent cache or driving etc.

Custom data pipeline is now totally changed in version 2.0, now it is much more stable and will not

causing crash when many aspects.

Main Usage:

This is the fastest way to fetch agent data and you can use this bake the middle rig and export FBX (if

you have your own tools).

We can bind muscle, fur, nCloth, or hair on original agent or middle rig, and simulate this rig several

turns, each one of them and export render data like geometry and creature FX contents like hair, fur,

ncloth, etc…

Make Single Character Cache

The single character Cache will be converted from Miarmy Agent Cache, so we should make agent Cache firstly.

Ensure the agent cache is able to playback OK and confirm the frame range you need, then open Miarmy >

Miarmy Tools, and hit “Convert Agent Cache to Character Bone Cache”, please wait these process need some

time and it will write new single cache like the right picture below, you may notice these cache is based on each

character, each one, contain all the Maya joint and custom attributes animation, use these can drive “original

agent” or “middle rig”

Notice: The agent cache path need writable. Because the converted out SC Cache will be put into the same

directory of agent cache

Page 222: MiarmyManualForV2.0

Miarmy 2.0 Manual

222 ©2011-2013 Basefount

Convert Agent Cache into SC Cache

Then let us use these cache drive our character

Drive Original Agent

Need de-place agent, because this time, the agent can be disable,

Enable drive and specify the character ID

Left: original pose, right: driven by character cache

Page 223: MiarmyManualForV2.0

Miarmy 2.0 Manual

223 ©2011-2013 Basefount

Driving original agent using cache id 15

Middle Rig

We call it rig because it’s nothing to do with the original agent and agent.

Original agent contains information used to generate agent but useless for baking and exporting FBX etc… also it

contains dynamic joints and shapes, it’s heavy. Otherwise middle rig only contains the bone chain and the

custom data on that, it’s much simpler and lighter. Also if we want to export FBX or something like this it will be

faster and correct.

Just click Build middle rig, our system will build a middle rig based on your original agent.

Note: cannot build in “referencing mode”

Differences between Original Agent and Middle Rig

The bones of Original Agent only contain number of attribute. Whereas the bones of Middle rig contain the

custom attribute entities and the animation.

Original agent contain only the number of custom data

Page 224: MiarmyManualForV2.0

Miarmy 2.0 Manual

224 ©2011-2013 Basefount

Middle rig contain all the custom data

Skip Animation Calculation for Some Bones

Sometimes we don’t want to some useless joints calculate because they are not important for final result, such

as some fingers or toes, or some extra deformers on arm or legs.

Calculate the joint will spend time especially when transition, blend or self-cycle, because we need fetch data

from action node for each agent, and them using some algorithm to get the result, finally assign them to agent.

Hands and fingers are small but have many joints on them, need almost the same time as the body parts. In

most cases due to the shot, we don’t need to assigned actions to them, so we can block the animation on them.

For example, let’s disable the animation on arm of following agent:

Skip animation on shoulder and arm

Them when the animation is started:

Page 225: MiarmyManualForV2.0

Miarmy 2.0 Manual

225 ©2011-2013 Basefount

(left) skip animation on arms (right) normal situation

Action Drive Agent

Pipeline

The process which we find next action

Recalling the previously part, from output results of logic calculation we can get some action outputs. And finally

we find the biggest activated one, we call this target action. Take a look at the above picture. Then, from the

target action, we will find out the next action by the action search method.

Once we solve out the next action, this is the action we need transit into. If the transition condition meets, the

agent will transit in to it.

Note: the next action might be the currently playing back action itself.

Getting the Target Action

As far as we know, after logic engine calculation, we can get a list of output results. It contains many repeated

channel outputs and output values. Then we need use the defuzz algorithm and the default decision node to get

the behavior result.

For example, after input channel engine calculation, we get some decision results from many decision nodes, as

the following first picture show.

Page 226: MiarmyManualForV2.0

Miarmy 2.0 Manual

226 ©2011-2013 Basefount

The process of getting target action

Parsing out the Next Action

From the target action, we need solve out the Next Action firstly. There are several methods to solve out next

action

By Simple Transition

In Simple Transition Mode (Setup in Miarmy Global), if your current playing back action is “stand”, and the

target action solved out from logic engine is “walk”, the next action will be “walk” directly, because our engine

can skip the transition map and transit from current action to the target action simply and directly.

By Transition Map

If the simple transition mode has been disabled, means we are in transition map mode. Suppose the current

playing back action is “stand”, and the target action is “walk”, our system can automatically find the nearest

action in Transition Map if you setup them correctly. The search result action will be “standToWalk” in the

following example.

Page 227: MiarmyManualForV2.0

Miarmy 2.0 Manual

227 ©2011-2013 Basefount

Transit from stand to walk with transition map

By Transition Map and Action Exits

There may be several actions in next action results, for example, take a look at the picture below. If our agent is

transiting from walk to stand, our system can find 2 next actions “walkToStandL” and “walkToStandR” from

transition map. By default, the system will choose the first action to transit in.

(Upper) Search engine can find 2 nearest next actions from transition map; (Lower) exits in action editor

Page 228: MiarmyManualForV2.0

Miarmy 2.0 Manual

228 ©2011-2013 Basefount

In action editor, if we specified for “walk” action 2 exit actions, then depending on the phase of current playing

back, our system can choose the exact one next action.

Like the above 2 pictures, if current frame in “walk” action is 5 to 10, the next action will be walkToStandL,

whereas if the current frame in “walk” action is 18 to 22, the next action will be walkToStandR.

Action Transition

After action searching, we can find the next action. Then we will determine whether we need our agent transit

to next action or still playback current action continually. If the current playback is before “exit range” (red

cursor), the action will continue playback itself, whereas the current playback is exceed the “exit range” (green

cursor), and also the next action is not itself, the transition will begin.

Transition from current action to next action

After transition, the next action will be the current playback action and store in agent memory.

Please notice this process is automatic, here we just explained what happened under the hood.

Action Transition Visualization Except logic feedback, our engine is able to feedback action playback status to Transition Map. The feedback is

based on the marked agent, for marking an agent, just select this agent, as same as the Brain Viewer. Also see

Part 6 Logic & Perception – Feedback in Essential

The pictures below show the process of transition. The red or orange dots are the phase indicator for the playing

back actions. There are 3 types of status in transition process.

Cyclical playback status:

Page 229: MiarmyManualForV2.0

Miarmy 2.0 Manual

229 ©2011-2013 Basefount

Cyclically playback the “run” action

Transition in process status:

Transition in process, from “run” to the “runToWalk” action

Non-Cyclical playback status:

Playing back the “runToWalk” action, non-cyclically

Go into cyclical playback status again after transition:

Transition complete, cyclical playback “walk”

You can also disable this in for Miarmy > Miarmy Global > Stop Feedback. For details, Part 6 Logic & Perception

– Feedback in Essential

Page 230: MiarmyManualForV2.0

Miarmy 2.0 Manual

230 ©2011-2013 Basefount

Action Proxy List Action Proxy List is a node contains a list of action names. The action name can be any type of actions, cycle

action, transition action or blend action. This list is able to override brain logic and play actions in itself as your

arrangement.

It means if you create and enable the action proxy, any of logic will be ignored. The agent will perform the

actions in list sequentially just like pre-defined rehearsal.

We usually can use the action proxy list to test action continuity.

Action Proxy Editor

Action Proxy Node always located in ActionProxy_<agentName> group, and only one action proxy node can be

created for each one type of agent.

Action proxy node

And you can edit it by Action Proxy Editor.

If you want to disable the proxy list without delete it, please turn off the “enable” attribute of it.

Page 231: MiarmyManualForV2.0

Miarmy 2.0 Manual

231 ©2011-2013 Basefount

Disable without delete action proxy

Story List (Logic Drivable Action Proxy List) Sometimes users want to achieve more precise control agent actions easily or arrangement a set of actions

happened by plan, for examples:

1. Action Precise control

Example: an army square need precisely controlled. Walk 7 steps forward, hold and turn left, and go ahead 5

steps etc... This sequence of action is not easily controlled by others logic

2. Actions Combination and freely Change

Example: When dancing or exercising, there are lots of separated actions need to be combined together, similar

like example 1.

We introducing “Story List”, it’s a list contains many actions and it can be triggered by logic channel them

playback this list of actions sequentially, more specifically:

There can be many story list nodes for each type of agent, and each one contains a list of actions, when

triggered, the agent will playback the action one by one inside, and ignore the transition map.

Note: in this version of Miarmy, in action proxy list, if the next action is the same as

current one, they will transit by “entry range” and “exit range” mechanism instead of

“cycle range”. We will fix this in next minor upgrade.

Page 232: MiarmyManualForV2.0

Miarmy 2.0 Manual

232 ©2011-2013 Basefount

Story list of agent type

We can use logic channel to activate it any time, like the others channels, story list have the active value and we

always choose the greatest value to perform story list.

Story list in decision node, in bound[1], trigger story list: sto1

The story list can be set interruptible or not, if set not interruptible, the agent once entry this story list, it will

play every action inside and not go out until finish all. Ignore any other logic etc…

Default is non-interruptible

Note: the proxy list is higher priority than story list

Page 233: MiarmyManualForV2.0

Miarmy 2.0 Manual

233 ©2011-2013 Basefount

IK System IK system is a part of action node and it can modify the result of action pose for agent when the agent is playing

back this action. Or another words, modify the result of animation when assigning data from action node to

agent.

IK is the information store in action node, it can be multiple IK in single action node and each one of IKs needs

some inner data

1. Name of end effector

2. level of Bones

3. end effector moving target curve (IK data)

4. IK rotation curve (IR data)

These data can be created in action editor, just specify the end effector name and the bone number above that

end effector, then click the “Create” button, the IK data and the IR data will be created

Create IK in action node

Page 234: MiarmyManualForV2.0

Miarmy 2.0 Manual

234 ©2011-2013 Basefount

The end effector and 2 level bone

IK data: this data store the end effector position in agent transformation space, when this data exist, we will use

this data to modify the bone change

IR data: this data store the end effector rotation in agent transformation space, when the bone pose modified,

we need keep the

Let’s see the following images to explain the IK and IR data in calculation process:

The first one is the rest pose, and this foot is the end effector, the lower leg and upper leg are 2 level of IK, when

this leg is playing back animation, the leg will controlled by IK system.

Please take a look at the second picture, the IK has some offset to up, notice the blue and orange arrow, the

blue is correct rotation (the same as first picture) of the end effector, and the orange is the incorrect one

because it will keep the local rotation in side its parent (lower leg)

In third picture, the IR data is responsible to fix that rotation to correct “blue” direction

Page 235: MiarmyManualForV2.0

Miarmy 2.0 Manual

235 ©2011-2013 Basefount

The IK calculation process

Once we created these data successful, we can control the IK now;

Just by IK offset channel on the leg:

Ik offset channel

<boneName>:ik.<axis>Offset

The following 3 picture is modified by the IK offset which values are: 0, 3, 6

Page 236: MiarmyManualForV2.0

Miarmy 2.0 Manual

236 ©2011-2013 Basefount

footL:ik.yOffset = 0 footL:ik.yOffset = 3 footL:ik.yOffset = 6

This is very useful when the agent walk on the uneven terrain or slop, we can make the foot always on top of the

terrain and not penetrated into ground. (If it penetrates into ground, we can use IK offset to move them up)

IK lock

Sometimes we want to lock the end effector to world space for a while in the action playing back, for example

“walk” action. We want to lock the IK end effector to world space when the action frames the foot on ground

avoid its slip.

IK lock is happened in some frames range in the action node, so we need specify it in action node. Each IK maybe

have different range of lock down

The IK lock data specified GUI

You can specify the frame range which you want to lock your IK in the float field,

Page 237: MiarmyManualForV2.0

Miarmy 2.0 Manual

237 ©2011-2013 Basefount

The red area means in that frame, the IK will lock there 100%

The yellow area means in that frame, the IK will lock there some percent and blend with the normal IK

positions of IK data

The red 100% lock and the yellow fade out to animation

Or you can fill that by automatically calculate, our tool will collect the height of end effecter for all the frames in

action node and calculate the min and max height of it, we can auto fill that data if the end effect below to some

percent of range:

Automatically

Auto fill result of the left foot IK (when the foot lower than 10% average)

Auto fill result of the left foot IK (when the foot lower than 10% average)

If the IK been locked in world space when playing back, our system will display a locker for it:

Page 238: MiarmyManualForV2.0

Miarmy 2.0 Manual

238 ©2011-2013 Basefount

IK locker on the foot (red)

Notice: the action node created before Miarmy 1.5 Alpha 1 cannot add IK info to bone.

Part 7 Physics From design, we planned integrate NVIDIA PhysX engine into Miarmy. Miarmy now can easily handle more than

5000 agents and more than 100,000 rigid bodies on a Windows HOME level PC. In our design, all the physical

contents are calculated directly in PhysX engine and we just display them in Maya, so, there is no any bottle

neck between PhysX and Miarmy when simulation in process.

Enable Dynamics

Dynamics Types

You can easily enable agent ragdoll-like dynamics by decision channels. Basically, there are 4 types of dynamics

channels, they are:

1. Full body dynamics: enable dynamics for every part of agent

2. Detach dynamics: break a bone and its sub tree bones from agent, but keep the rest of agent controlled

by animation.

3. Partial dynamics: enable the sub tree dynamics from a bone, but keep the rest of agent controlled by

animation.

4. Body dynamics: enable dynamics for every part of agent except the root bone.

The illustration of each type of dynamics, the blue block are the bones controlled by action whereas the orange

blocks are controlled by dynamics.

Page 239: MiarmyManualForV2.0

Miarmy 2.0 Manual

239 ©2011-2013 Basefount

Normal status

(1) Full body dynamics (2) Detach dynamics, (3) Partial dynamics (4) Body dynamics

Note: in this version of Miarmy, the (3) Partial Dynamics and (4) Body Dynamics have

some problems due to the Bugs from PhysX engine. The NVIDIA is fixing it and we

believe that they can fix it soon, and we will update this part as soon as they fix it. For

details please refer the following link:

http://forums.developer.nvidia.com/devforum/discussion/3191/bug-physx-3-1-joint-

strange-movement-video

Page 240: MiarmyManualForV2.0

Miarmy 2.0 Manual

240 ©2011-2013 Basefount

Dynamics Channels

The channel “dynamics.active” can enable full body dynamics for the agent.

Full body dynamics

The Channel “<boneName>:dynamics.detach” can enable partial detach dynamics for agent. The dynamics will

be enables from the specific bone and its sub tree, and break from that bone. This is easily simulate the zombie

like character walking and being shot.

Example:

neck1:dynamics.detach

shoulderR:dynamics.detach

Detach dynamics (head, arm, head + arm)

The channel “<boneName>:dynamics.active” can enable partial dynamics from the specific bone and its sub

tree, but not detach from main agent. The main agent will be still controlled by action and Logic

Example:

torse:dynamics.active

shoulderL:dynamics.active (upLegL:dynamics.active)

Page 241: MiarmyManualForV2.0

Miarmy 2.0 Manual

241 ©2011-2013 Basefount

Enable partial dynamic from torso3 and shoulderL

The channel “bodyDynamics.active” can enable every bone of agent except root bone. And you can control the

root by animation and the rest of bones will perform dynamic simulation. Just like you are waving a Nunchaku,

the handler of it is controlled by animation and the rest are controlled by dynamics. You can constraint each of

agent to a particle and write some expression to control them.

Body dynamics enable except root bone

Pre-build RBD Objects and Visual Clue

Before us diving into the others dynamics features, we need deeply understand a very important concept. That

is pre-build RBD objects

In many cases (collision detection, cloth enable etc.), we need create some pre-build the RBD objects in agent

memory and let our animation bones drive these internal RBD before really physical simulation. In this time, you

cannot see agent perform physical behavior, but actually the physical contents are there and controlled by

action.

Page 242: MiarmyManualForV2.0

Miarmy 2.0 Manual

242 ©2011-2013 Basefount

Firstly, let’s take a look at that when these pre-build RBD objects will be created and why we need them, and

how can we know/detect their existence. Then we will introduce you how can you optimize and avoid our

engine create these pre-build RBD objects if our scene doesn’t need them.

When these conditions, these pre-build RBD will be created in agent memory:

collide channel in input

RBD collide check in input

cloth enable

partial dynamics

body dynamics

broken dynamics

We created them because we need these RBD to:

collision detection

hold cloth attach points or collide with cloth

drive the partial dynamical chain

If there are internal pre-build RBD created, you can simply switch to the wireframe mode to check their

existence. Just like the picture below, the bone with “dot/small point” is exact pre-build RBD inside its memory.

Please notice there also a “cross”, which will be talked about in collision detection session.

If there are internal RBD in agent, system will mark “dot” into the Bone

Page 243: MiarmyManualForV2.0

Miarmy 2.0 Manual

243 ©2011-2013 Basefount

If collide enable, everyone has their own pre-build RBD internal

The pre-build RBD objects will take memory, so please keep check them if you’re working on the scenes with

physical features. If not nessecery, please make sure they will not going to be created.

Fully Pre-build RBD Objects for Dynamical

Once we enable partial dynamics or break dynamics. Except the dynamic parts, the rest of agent bones have

pre-build RBD object there in agent memory. For example the following picture, the orange parts have been

enable dynamics but the blue parts are driven by action. However, the blue parts also have RBD object there in

agent memory

The blue parts also have inner RBD objects in memory

Page 244: MiarmyManualForV2.0

Miarmy 2.0 Manual

244 ©2011-2013 Basefount

Collision Detection

Mark Collide

The first and most important is mark the “collide bone”, only collide bone can generate collision event or receive

collision status. To mark the “collide bone”, please select the bones on the Original Agent, and enable specific

collide feel flag of each bone. If you don’t remember what is bone which marked “feel collide” flag, please refer

Part 3 Agent Infrastructure – bone flags

Mark collide feel bones

Pre-build RBD Objects for Collision Detection

We are using the PhysX feature for checking collision, so, if there is “collide” related channels in input sentence,

system need create pre-build RBD object in agent memory. These RBD objects are controlled by action and the

user may not notice them. Our system will use these RBD objects for collision checking and returning check

result.

Our system will only create Pre-build RBD for the marked bones and make them check collide. You can visualize

check these RBD objects directly from the wireframe mode, in the previously session, we mentioned that the

bones with “dot” inside is the RBD bone existence. Also, you may notice there is a “cross” sign inside, that is

means, No only this bone contain pre-build RBD, but also this bone can feel collide.

Page 245: MiarmyManualForV2.0

Miarmy 2.0 Manual

245 ©2011-2013 Basefount

The cross sign means this bone can feel collide

Collide Check Channels

Using collide channels, we can detect the bone collision status of agents. The collide channel including:

collide

collideBy:<Bone Name>

collideAt:<Bone Name>

riCollide

riCollideBy:<Bone Name>

riCollideAt:<Bone Name>

Using collide channel we can check the collision status for the bones which marked “feel collide” from the

current agent.

If the bones which marked “feel collide” are colliding/overlapping the others RBD, the channel will return 1,

otherwise, return 0. Just like the picture below, the “head”, “chest”, “stomach” and “arms” bones have been

marked “feel collide” flag,

Note: The bone will not check collide with terrain, only interactive with them.

And the bone also can check collide with kinematic primitive objects, which will

be explained in Part 7: Physical Simulation – Kinematic Primitives

Page 246: MiarmyManualForV2.0

Miarmy 2.0 Manual

246 ©2011-2013 Basefount

Head, chest, stomach, arms have been marked “feel collide” flag

Let’s take a look at an example below, for the agent 1, the “collide” channel will return 1 because the “chest” is

colliding with the hand of agent 2, whereas,

For the agent 2, the “collide” channel will also return 1 because the bones marked “feel collide” is also collide

with the chest of agent 1.

“collide” channel will return 1 from both agent 1 and agent 2

Page 247: MiarmyManualForV2.0

Miarmy 2.0 Manual

247 ©2011-2013 Basefount

Using “collideBy:<Bone Name>”, we can check whether a bone which name is <Bone Name> collide with the

bones marked “feel collide” of current agent, for example:

For the agent 1, collideBy:lowerArm will return 1 because the chest bone of current agent is colliding with a

bone which name is “lowerArm”

For the agent 1, collideBy:head will return 0 because no matter “chest”, “stomach” or “head” is not colliding

with the bone which name is head

For the agent 2, collideBy:chest will return 1 because the lowerArm is colliding the chest of agent 1.

collideBy:lowerArm will return 1 for agent 1 and return 0 for agent 2

collideBy:head will return 0 for both agent 1 and agent 2

collidBy:chest will return 1 for agent 2 and return 0 for agent 1

Page 248: MiarmyManualForV2.0

Miarmy 2.0 Manual

248 ©2011-2013 Basefount

Using “collideAt:<Bone Name>”, we can check whether the bone name is <Bone Name> from current agent

colliding with any else bone from others agents. No matter the bone <Bone Name> whether or not marked “feel

collide” flag.

Look at the following example:

For the agent 1, the “collideAt:chest” will return 1 because the chest is colliding with a bone

For the agent 1, the “collideAt:head” will return 0 because the foot is colliding with a bone

For the agent 2, the “collideAt:lowerArm” will return 1 because the lower arm is not collide with a bone

Collide at channels for

The “ri” prefix is use to reserve information of collide. The information will contain the collision direction and

velocity.

riCollide

riCollideBy:XXX

riCollideAt:XXX

Page 249: MiarmyManualForV2.0

Miarmy 2.0 Manual

249 ©2011-2013 Basefount

The reserved information contain the approximated collision direction and the relative velocity

The collision info reserved when checking collide

We can apply a pulse force on to it when enable dynamics, with the channel “dynamics.active.force”. The force

direction will along with the reserved vector and the force strength will be the defuzzed value of the channel.

Optimization

The pre-build RBD will take huge memory if you have huge number of agents in scene. See Part 9 Optimization –

Mute Dynamics

Dynamics Features

Physics Global

Miarmy > Physics Global

Page 250: MiarmyManualForV2.0

Miarmy 2.0 Manual

250 ©2011-2013 Basefount

Step Time and Sub Step

Step time is the time span of physical simulation in a single Maya frame. By default, in each Maya frame, the

PhysX simulate and increase 0.1 second for updating physical contents.

Sub step is the number of steps in each simulation time span. For example, if sub step is 4, and step time is 0.1,

each time PhysX simulate, it will simulate 4 times and each time takes 0.025 second.

Increase sub step can achieve precise simulation result but take more time to calculate.

Let’s take a look an example, when the agents are pushed by force field, the different sub step lead to different

precise level.

Page 251: MiarmyManualForV2.0

Miarmy 2.0 Manual

251 ©2011-2013 Basefount

Sub step from left to right: 1, 2, 4

Disable sub-tree simulation (skip finger and toes etc…)

Sometime we don’t want to our agent simulate the finger dynamics or some subtle parts that because it will

waste much time also cause problems. There is an attribute on original agents can skip these parts. This can

speed up for the dynamic simulation and reduce the problem occurring.

We can now only disable the marked bone and its sub tree, we cannot skip simulate in the middle of dynamics,

because it’s impossible for physics engine.

Upgrade it if not existed (disableDynSubTree)

Page 252: MiarmyManualForV2.0

Miarmy 2.0 Manual

252 ©2011-2013 Basefount

Make on the flags on these parts

Under simulation

The agent cache is working no any problem

Gravity VS Mass

You may encounter these situations:

The object from high place falling slow

Explosive effect not much

If the agent from high place falls to ground slowly, it means the gravity not enough. At this time you need

increase the gravity. On the other hand, if you increase the mass of agent body, there will be no any change. You

can just recall the famous story about Galileo’s 2 balls.

Page 253: MiarmyManualForV2.0

Miarmy 2.0 Manual

253 ©2011-2013 Basefount

Increase the gravity

If the force field like explosive force effect agent not much, mean the object is too heavy. At this time, you need

crank down the density for decreasing the mass of the agent bones. Mass = volume * density, the volume is the

bone shape itself.

Decrease the mass

(Left) Leaning Tower of Pisa, (right) Galileo

Joint Move Inertia

When agent moving, there is a speed, and when the agent turn to dynamics bodies and start to simulate, it need

inherit this speed. For example a man is running and sudden enable dynamics and jump, it should continue

moving forward when this man is in the sky. Just like cannon.

Galileo, he is probably best known for a story in which he dropped two different size balls

from the Leaning Tower of Pisa at the same time, and the two balls hit the ground at

almost the same time

Page 254: MiarmyManualForV2.0

Miarmy 2.0 Manual

254 ©2011-2013 Basefount

After Miarmy 1.5, we add this inertia momentum in agent memory when each frame simulation, and apply this

speed on the rigid body when the dynamics turn on.

Please take a look at the following picture, the agent in bound, it start dynamics simulation, before the turn on

dynamic, the agent is moving, and when it enable dynamics,

Inertia momentum

This feature is automatically performed, so there is no switch on and off.

Terrains and Default Terrain

In the previous Part 5 Logic & Perception, we talked about the terrain interactive with agent by logic channel. In

addition, the marked terrain can interactive with dynamical agents, automatically. Dynamical terrain can be any

shape, even deforming when simulation.

Page 255: MiarmyManualForV2.0

Miarmy 2.0 Manual

255 ©2011-2013 Basefount

The only thing need to do is mark your terrain in Terrain Manager. Please notice:

If the terrain is deforming or moving when simulation, please mark the “isAnim” flag in Terrain Manager.

Our system can update the shape of it every frame.

If the terrain is a plane, you can mark the “isPlane” flag for accelerate the calculation.

Dynamical agents interactive with terrain

Please notice the geometrical terrain has edge. If the agent position exceeds the edge range, the agent will fall

down to the abyss.

Fall down to abyss if outside the terrain range

There are some attributes on the terrain:

Dynamic Friction: friction when object moving on terrain

Static Friction: friction want to prevent object move on terrain

Restitution: you can consider it bounce capability

Page 256: MiarmyManualForV2.0

Miarmy 2.0 Manual

256 ©2011-2013 Basefount

Terrain attributes

If there is no marked terrain in scene, our system will build a default terrain. The default terrain is actually an

infinite ground plane primitive. And its attributes are located in Physics Global.

Default terrain plane

Attributes of default terrain plane in Physics Global

If you intentionally don’t want any terrain in scene, you need check on “mute terrain” in Terrain Manager, then

you scene will never create any terrain any more. And the existed terrain will be ignored.

Page 257: MiarmyManualForV2.0

Miarmy 2.0 Manual

257 ©2011-2013 Basefount

Ignore exist terrain when mute terrain check on

You can use check collision between agents and kinematic primitives using channel “collideBy:_TERRAIN_”.

Maya Field

Miarmy agent can interactive with Maya field not only from logic input channels, but also directly in dynamic

simulation. When the agent dynamics enable, the agents can directly affect by Maya field. But please notice the

field can only affect the bone which marked “fieldFeel”. You need setup the “fieldFeel” flag on the bone shape

of original agent. For reviewing the original agent and agent type, please refer Part 3 Agent Infrastructure

Mark “fieldFeel” on bones of original agent

Page 258: MiarmyManualForV2.0

Miarmy 2.0 Manual

258 ©2011-2013 Basefount

Maya vortex field affecting dynamical agents

For fine tuning the dynamical result, you need just change the attributes in Maya field node itself.

Force Field General Rules

Force Composition

No matter currently we are talking about Maya Field, or further we are going to introduce Maya Fluid, and build-

in force field, all of them drive agents by Force Composition. For example there are several Maya fields in scene,

and our agents can feel the composition force result of them.

Speed Threshold

And, no matter Maya fluid, field, build-in force field, they will apply force to the RBD object only when the speed

of this RBD slower than the speed threshold. Another words, once the RBD object exceed the speed threshold,

our system will not apply force onto it any more.

Speed threshold value in Physics Global

Page 259: MiarmyManualForV2.0

Miarmy 2.0 Manual

259 ©2011-2013 Basefount

Force Multipliers

Sometimes, maybe your Maya field not only driving Miarmy Agents, but also controlling the particles. At this

time, change the magnitude of Maya field will effect both on agents and particles. However, maybe the particle

result is OK you don’t need change it. At this time we provide the Field Multiplier for exclusively change the

result on the agents. If the magnitude of a field is 100, and the field force multiplier is 6, the force applied to the

agents will be 100 * 6 = 600 from this field.

Field Multiplier in Physical Global

Maya Fluid

Because Maya fluid can be represented by field, the Miarmy agent can interactive with Maya fluid directly also

when the agent dynamics enable. The process is the same as Maya Field.

Maya basic fluid affecting dynamical agents

Build-in Force Field

In the previously chapter, we talked about the spot node, it’s a kind of perception contents. Actually, it can be a

force field as well. When you change the Feel Mode attribute to “onlyField” mode, the spot will become a build-

in force field.

Page 260: MiarmyManualForV2.0

Miarmy 2.0 Manual

260 ©2011-2013 Basefount

(left) Feel mode change to “onlyField” (right) the force field specific attributes

If the agent enable dynamics and some of bones marked “fieldFeel” enable, the agent will be affected apply

force inside of the bound.

Push field

Pull field

Page 261: MiarmyManualForV2.0

Miarmy 2.0 Manual

261 ©2011-2013 Basefount

Vortex field

Build-in force field attributes:

Field Type: can be push, pull and vortex

Bound Radius: control the radius of bounding sphere or bounding cylinder

Bound Height: (only vortex) control the height of the bounding cylinder

Factor: (only vortex) the force multiplier when the agent far from center of cylinder

Combo

We designed spot and build-in force field together because in many cases we need them work together. Firstly

we need switch the Feel Mode attribute to “both”

Page 262: MiarmyManualForV2.0

Miarmy 2.0 Manual

262 ©2011-2013 Basefount

Combination of force field and spot

Suppose we are building an explosive scene. We can use spot logic trigger agent enable dynamics and use force

field push them out form bounding sphere. At this time, the combo of spot and force field is much easy to

operate.

Like the picture shown below, after using “spot.d” channel enable agents dynamics, these agents will be

naturally inside the bounding sphere, and immediately they will be affect by that force field and been pushed

out from the bounding sphere center.

Combo example spot trigger dynamics, force field push agent out

Kinematic Primitives

Kinematic primitive is a kind of static RBD objects can be controlled by user animation or constraint. Our agent

can collide with them automatically if they enable dynamics.

Page 263: MiarmyManualForV2.0

Miarmy 2.0 Manual

263 ©2011-2013 Basefount

You can scale, rotate, translate and key frame the kinematic primitive anytime. Or you can parent, constrain

them to anywhere.

In this current version of Miarmy, only 2 types of kinematic primitives supported, they are “Box” and “Sphere”.

For creating them, just simply click Miarmy > Physics > Kinematic Primitives.

Kinematic Primitive example

You can check collision between agents and kinematic primitives using channel “collide” or if you want agents

exclusively check collide with kinematic primitives: “collideBy:_ KINEPRIM_”.

Check collide by “collideBy:_ KINEPRIM_” enable dynamic + keyframe kinematic primitive

The logic in the above example

Cloth simulation

Page 264: MiarmyManualForV2.0

Miarmy 2.0 Manual

264 ©2011-2013 Basefount

Cloth simulation

Creating Cloth

1. Put your cloth geometry directly under the Geometry_<Agent Type> group

2. Make sure your cloth do not contain tweak info

3. Select attach points and bone shape box of Original Agent, click Miarmy > Physics > Cloth Setup > Attach

Cloth

4. You can continue add attach points to different bones from the single cloth

Step 1: put you cloth to Geometry_<Agent Type>

Notice: NVIDIA rewrote entire PhysX cloth system, and the latest cloth will be simulated in an

independent solver space and not join the rigid body collision. It’s much faster than previous

version (the more clothes the faster, at least 10 times faster and more).

But the cloth feature is not fully been finished all by NVIDIA, such as collide with ground,

cloth friction and so on. We will provide more features later in next version.

Page 265: MiarmyManualForV2.0

Miarmy 2.0 Manual

265 ©2011-2013 Basefount

Step 2: Make sure you clear the tweak info on cloth mesh

Step 3: Attach points to bone shape box of Original Agent

Tip: if your geometry mesh has tweak info, but you don’t want to change the topology (shape) of that mesh, you

can simply “add a cluster deformer” to the mesh and then “delete history” from the mesh, the 2 steps will help

you clear the tweak info on the mesh but will not modify the points position

Once your setup complete, and place your agents from placement node, the clothes will appear.

Cloth Attributes

There are several clothes attribute for uniformly control all clothes in Physics Global. And these attributes

Page 266: MiarmyManualForV2.0

Miarmy 2.0 Manual

266 ©2011-2013 Basefount

Cloth attributes in Physics Global

Solver Frequency: Solver frequency specifies how often the simulation step is computed per second

Stiff Damping: damping coefficient for stiffness of cloth

Cloth Density: the mass for each particle on mesh

Vertical Stretch Stiffness: stiffness for holding the length in vertical space

Horizontal Stretch Stiffness: stiffness for holding the width in horizontal space

Shearing Stretch Stiffness: stiffness for holding the shape

Bending Stiffness: stiffness for resisting shape bend

Note: because the cloth feature is under a major rewrite by NVIDIA, some features are not very stable. Please

use it carefully.

Cloth Collision on Bone

If we want to our cloth collide against with the bone, we need set the flag in original agents firstly.

Turn on collide cloth flag on bone shape

The cloth in PhysX 3 can only collide with capsule, so our system will create an approximate capsule based on

the shape of cubic bone.

Each cubic bone has 3 dimensions which are X, Y and Z. Our system will choose the longest dimension for the

capsule length and the second longest for the radius of this capsule. Just like the left example below. Then once

we enable simulation, the cloth will collide against the bone, like the right picture below.

Page 267: MiarmyManualForV2.0

Miarmy 2.0 Manual

267 ©2011-2013 Basefount

Approximate collision object from cubic bone

Cloth affected by Wind

Cloth can only affect by wind force field. The wind can be created in Miarmy > Knowledge Perception > Create

Wind.

Cloth affected by wind

The wind will blow to the direction which its arrow pointing. And the magnitude will be the value between

(magnitude + noise) and (magnitude – noise). In the following example, the wind magnitude result will range

from 0 to 100. (50-50, 50+50)

The wind attributes

Page 268: MiarmyManualForV2.0

Miarmy 2.0 Manual

268 ©2011-2013 Basefount

More realistic Cloth Simulation and Cloth Collision

After PhysX 3.2, there are many new features in cloth simulation especially points random force. We apply that

force on the wind, so it can make the cloth simulation more realistic:

Particle random set to 300 on attribute “jitterMag”

PhysX 3.1 cloth

PhysX 3.2 with random particle force

Of course if you turn the “jitterMag” off, it will return the result of version 1.5

Page 269: MiarmyManualForV2.0

Miarmy 2.0 Manual

269 ©2011-2013 Basefount

Mute Dynamics

There is a “muteDynamic” attribute on each agent. Once we turn this on, the agent will never enable dynamics

and will not join the collision detection, the pre-build RBD object will never been created. In some cases, using

this feature properly, it will save tremendously amount of memory for you as well as speed your simulation up.

See some real example in Part 9 Optimizing.

Additionally, this attribute cannot save with scene, if the agents have been deleted and placed out again, these

attribute will change back. So, you need enable “muteDynamics” first and use “inverse placement” to store

these data to a new place node.

Rigid Body Dynamics Emitter

Miarmy provide an interesting emitter can emit the rigid body dynamics, we call them RBD emitter. The RBD

object emit from this emitter can interactive with agents, terrains, kinematic primitives and Maya field/fluid,

also the Miarmy force field.

RBD emitter example 1

Page 270: MiarmyManualForV2.0

Miarmy 2.0 Manual

270 ©2011-2013 Basefount

RBD emitter example 2

This emitter can be created from Miarmy > Physics > Create RBD Emitter, the emit type for current version only

have “Plane”, it consist of a plane and a direction pointer to the emit direction. Like the picture below:

The RBD emitter

The RBD emitter can be freely transformed, translate, rotate or scale is no any problem.

Scaling bigger to emit the rigid bodies scatter. The RBD objects will be always emit from the plane area.

Scale freely

Page 271: MiarmyManualForV2.0

Miarmy 2.0 Manual

271 ©2011-2013 Basefount

Rotate freely

The rigid body emitter have some attributes can be adjusted to achieve different emitting result, and most of

the attributes can be keyed frame.

RBD emitter attributes

Emitter ID: control the color of object emit out. (we will extend this feature later)

Emitter ID: 2 (left) 6 (right)

Display mode: control the constant color or diffuse color

Page 272: MiarmyManualForV2.0

Miarmy 2.0 Manual

272 ©2011-2013 Basefount

Display Mode: plain (left), normal (right)

Contact event: control the how the rigid body interactive with the scene element, we will talk about this in next

session because there are some concepts need clarify before talking this.

Rate: control the number of emit each frame

Rate: 1(left) and 50(right)

Rotation speed, rx: 0.0 (left) rx -0.2(right)

Box shape attributes XYZ adjust the dimension of XYZ of rigid boxes.

Page 273: MiarmyManualForV2.0

Miarmy 2.0 Manual

273 ©2011-2013 Basefount

Box shape attributes: x:1 y:10 z:1 (left) x:5 y:5 z:5 (right)

The sphere and sphere shape is not available in this version, even the attribute still there. We’ll add sphere

shape later;

Rigid Body Contact and Leave to Agent

In the previously session we skip the “contact event” attribute of RBD emitter because we have to talk about

some new concept on collision and collision query.

3 types of contact behavior for RBD emitter’s rigid bodies

Collision Group

There are 2 kinds of rigid bodies in Miarmy:

1. The regular rigid bodies (agent ragdolls, kinematical objects, and terrains)

2. The rigid bodies emit from RBD emitters

There is a concept call “collision group” in PhysX engine. If the objects are put in different groups, we can make

them not collide at all.

If you set the RBD emitters to “dynamics” mode, we will put the 2 kinds of rigid body to

the same group, and they will collide each other and can be normally interactive each other.

If you set the RBD emitter to “ignore”, we will put the 2 kinds of rigid body to the

different groups, and they will not collide.

Page 274: MiarmyManualForV2.0

Miarmy 2.0 Manual

274 ©2011-2013 Basefount

Collision Detection Query

PhysX have another concept called Collision Detection Query, when we using “collide” or “collideAt” channels in

decision node, we are actually need query the collision.

As our design, we filtered 2 situations when query collision:

The RBD emitter rigid bodies cannot be detected by the agents

The agents cannot query collision from the terrain.

Inverse perception

Instead of letting the agents query collision with RBD from emitters, we make an inverse perception. We

designed letting the RBD query collision with agents, and if collide, it will tell the agents and automatically hold

there.

We introduce rbdCollide channel, this channel will return value bigger than 1 if the RBD objects from emitter hit

the agent body part. It’s not agent query collision from RBD objects, it’s these contact objects tell the agent, so

we call it inverse perception.

And this channel only work when we set to mode for the RBD emitter.

Firstly, the RBD objects will hold on whatever it contact if set to contact

The RBD objects hold on ground

If you don’t think it reality, you can make 2 RBD emitter and make one dynamics

Page 275: MiarmyManualForV2.0

Miarmy 2.0 Manual

275 ©2011-2013 Basefount

Combine 2 emitters

When the RBD hit the agent body, it will leave the agent body when it contact

Agent dynamics hold on body automatically

This time the hold RBD object will tell the agent, “I contact you” and the rbdContact channel will be true, then

you can enable the dynamics for the agent

Page 276: MiarmyManualForV2.0

Miarmy 2.0 Manual

276 ©2011-2013 Basefount

RBD object interactive with agents

A simple arrows rain example scene

Render RBD Emitter

Bake to Instance

We provide a simple tool can bake the RBD emitter objects directly into the polygon mesh instance.

Please make sure the RBD emitter has been cached along with the agents.

Then just select one of the RBD Emitter and one polygon mesh then click Miarmy > Physics > RBD Emitter >

Bake RBD Emitter, our system will duplicate and key frame the polygon mesh automatically for you.

Please notice we are duplicating the mesh as instance mode, so if you think the shape is not perfect, you can

tweak one of the duplicated meshes and the others will be modified simultaneously.

Page 277: MiarmyManualForV2.0

Miarmy 2.0 Manual

277 ©2011-2013 Basefount

Baking RBD emitter to Polygon Mesh Instances

Read from MEL and Deal With

Please read this from Chapter 9 Development

MEL: McdSimpleCommand -exe 35;

Agent Bone Particle Emitter (Action Phase based)

Agent bone can emit Maya particle since Miarmy 1.5.

Sometimes our agents will emit some bullets, lasers or magic ball when they performing some specific action.

We provide this tool can emit particle to scene, we call this agent particle emitters.

You need first create an empty particle shape for hold the particle

Page 278: MiarmyManualForV2.0

Miarmy 2.0 Manual

278 ©2011-2013 Basefount

Empty particle shape without any particle

We can mark this particle associate the action name, bone name and frame range, we can do that assignment in

Miarmy > Particle Emit Manager…

Agent particles emitter manager

Select particle node and click “Mark Emitter”

The emit part

The particle emitting attributes

Emit particles from “head” to particle shape when agents playing “walk” and action frame is “5 to 8”,

Page 279: MiarmyManualForV2.0

Miarmy 2.0 Manual

279 ©2011-2013 Basefount

Emit particles result

We can also emit particles from particle, and create weapon like stuffs.

The head emit particleA, and the particleA emit particleB

And user can do any job on that particle also, for example add PP attributes, or anything VFX artiests familiar.

Also can be adjusted by any attributes

Page 280: MiarmyManualForV2.0

Miarmy 2.0 Manual

280 ©2011-2013 Basefount

Part 8 Render

Agent Cache Let’s firstly check out the agent cache before rendering. One can easily and fast create Miarmy Agent Cache for

storing the simulation data of agent bones to external files. Then, using the agent cache files, artists are able to

real time drag the time slider back and forth for getting the directly visual feedback.

Agent cache is one file for each frame. It contains the simulation data in this frame. Usually the simulation data

is the bone rotates and translates, also the cloth information if there are clothes on agents.

The extension name (usually called format) of cache file is “.mmc”, and the naming convention is

“<CacheName>.<Frame Number>.mmc”, e.g. “scene001.26.mmc”.

Only with render cache, we can apply motion blur render.

Creating Agent Cache

1. Make sure you fill the right agent info in Miarmy Tools

Page 281: MiarmyManualForV2.0

Miarmy 2.0 Manual

281 ©2011-2013 Basefount

a. Cache folder: the cache file located

b. Cache name: the name of cache files

2. Click Miarmy > Miarmy Tools

3. Enable Cache in Miarmy Global

Step 1: fill right information

The cache files in d:/abc folder

Agent Cache for Bone Rotate Only

Default, we only record the bone rotate info to the cache files. It can save lot of time in the process of reading

and writing.

And there is a special usage for cache files. In dynamic simulation, sometimes for some agents, the simulate

result is not very precise. Some joints will not convergence very good. But since our cache is not going to record

the translate data, after writing out the cache and when the agents read cache file back, the joint separate

situation will disappear automatically.

Page 282: MiarmyManualForV2.0

Miarmy 2.0 Manual

282 ©2011-2013 Basefount

(left) simulation time and separated, (right) read cache from file and convergence

Agent Cache with translate

In some cases (we listed them below) we need record the bone translate info. For storing the translate info on

the bone, the only thing we need to do is enable “isCacheBoneTranslate” feature in Miarmy Glboal before

creating cache.

Enable record translate before making cache

The situations we must enable record translate:

Logic channel contains offset translate

Some parts separated from agent when dynamics enable (like drop sword and shield)

Agent Cache with cloth

If there are clothes on agents, our system will automatically record them.

Agent Cache Format

Miarmy cache is a binary stream, which contain the format.

<numberOfAgent><numberOfCloth>(<numberOfIndex1><numberOfVertex1><numberOfNormal1>)<Index><V

ertex><normal>…..<numberOfIndexn><numberOfVertexn><numberOfNormaln>< Index >< Vertex ><

normal >)<agent1 root>,<agent 1 bone><numberOfCustomData1><customData1>…<customDatak>,

……

(<repeat cloth n>)<agentn root>, <agentn bone><numberOfCustomDatan><customData1>…<customDatak>

Out engine will compare the agent number between the first data in cache file and the number of agent in scene,

and if they are not equal, the cache will not be read and setback pose to agents.

Command Line Caching

Many task of Miarmy can be done in batch mode or command line. That is means we can do our job without

open Maya, and this can save much time and memory of loading Maya editor and drawing OpenGL stuffs etc.

Page 283: MiarmyManualForV2.0

Miarmy 2.0 Manual

283 ©2011-2013 Basefount

Also these command line task can be assigned to simulation/render farm and let the machines to do that

without human resource.

Command Line (Batch) Simulation

We know that after caching agents, the crowd scene can be the real time. At this time we can summit the agent

caching tasks to our machines instead of waiting on your machine.

Before run command line, we have to do some setup:

1. The scene can be simulated normally

2. Setup the exporting path and file name correctly

3. Pre-test some frames and check is that cache can be generated properly.

Setup the agent cache path and name properly (Miarmy Tools)

Re-direct your start position into the Maya bin and Run command “McdBatchAgentCache”

Platform Command Line

Windows mayabatch “d:/test.ma” –command “McdBatchAgentCache”

Linux maya –batch –file “/usr/test.ma” –command “McdBatchAgentCache”

If everything all right, the cache (.mmc) file will be created in specified folder.

Render Solutions There are 6 types of render solutions for Miarmy, the renderman plugin and mesh drive.

Mesh Drive: using this solution, you can use arbitrary renderer to render you scene out. This method will

actually duplicate render mesh out in Maya scene.

Renderman pluing: using 3delight API, we dedicated designed a renderman plugin for exporting scene to

3delight renderer or to the RIB file, with procedural primitives.

Mental Ray:

V-Ray:

Page 284: MiarmyManualForV2.0

Miarmy 2.0 Manual

284 ©2011-2013 Basefount

Alembic Geometry Cache

FBX Export

Since we already introduced the Mesh Drive in above, from here, we will focus on the renderman plugin solution.

Render by Miarmy Mesh Drive

Concept

One can generate geometries for each one of agent directly in Maya, and use Miarmy Agents to drive these

geometries. These geometries are driven by agents rather than the regular ways such as skinCluster joints or

geometry caches, and all the processes are happened in Agent memory layer instead of Maya Script layer, so it is

relatively faster than regular deformation method.

Driven Mesh Rendered by Mental Ray

Features:

The Driven meshes are actually Maya meshes and can be rendered by any type of renderer or plugins

directly in Maya! Such as Mental Ray®, V-Ray®, Renderman for Maya®

Interactive display geometries, OpenGL or viewport 2.0

In not far future, these meshes can be applied Blend Shapes feature

Page 285: MiarmyManualForV2.0

Miarmy 2.0 Manual

285 ©2011-2013 Basefount

Optimizing Mesh Drive before Implementation

As you see, Mesh Drive indeed creates geometries (Maya Mesh Node) in scene, so it can be very slow if your

character is complex or number is too large. It is actually a render feature instead of animation feature so we

provide the following suggestions for optimizing your crowd scene:

Linux is highly recommended

This feature is very memory consuming, please use the machine with big mount of memory (more than

4G, and recommend 8G+)

Make Agent Cache before using mesh drive

Make your mesh simpler if you have large number of agents

Keep down the geometry number for each single agents (each agents may contain several geometries)

Change the start and end agent ID for partial display agent geometries

Warning: this feature would be relatively slow in Maya 2011 Windows version, but faster in Maya

2012, and the fastest on Linux System.

Generate (Duplicate) Mesh

In this process, our script will duplicate all of the geometries for each type of agent, and optimize them, and

then duplicate for each placed agent with the random geometry rules. All the process is automatically.

Mesh Drive Feature GUI

Steps breakdown:

In the first step, system will duplicate the Geometry_<AgentName> group for each type of agent and rename

them (add MDG_MDG_ prefix), then put them out of Miarmy_Contents. We called them “template groups”. The

structure inside of this group is naturally same as the Geometry_<AgentName>

Page 286: MiarmyManualForV2.0

Miarmy 2.0 Manual

286 ©2011-2013 Basefount

The geometry group in Miarmy Contents to be duplicated

Step 1: Duplicate a copy out and rename optimization automatically

In the second step, system will automatically delete the all of the history and intermediate shape nodes for all of

the geometries in the “template groups”.

Step 2: the grey ones, the trash intermediate shape nodes need to be deleted

In the third step, system will use random geometry rule to duplicate geometries for each one of agents, and

group them into a new group MDGGrp_<AgentName>. You may notice the geometries are arranged sparsely

without any hierarchy because they are the already selected ones by the random geometry rules.

Page 287: MiarmyManualForV2.0

Miarmy 2.0 Manual

287 ©2011-2013 Basefount

Step 3: duplicate meshes for each of agent obey the random rule we talked able in previously

In the last step, system will pair geometries in agent memory <AgentName> and MDGGrp_<AgentName>, please

check out the Pairing session below

Pairing

In this session, system will pair the geometry pointers in agent node to the mesh nodes in scene. After this

process, system will not have to re-search the geometries from crowded scene for agents again in time iteration.

And the speed will be much faster. Technically, it is a process establishes a map relationship between the

memory of agent and the scene meshes.

Please take a look at the picture below. After this process, the pointers in memory of agent will point to the real

meshes in scene.

Agent -> Maya Geometries Memory Mapping

Page 288: MiarmyManualForV2.0

Miarmy 2.0 Manual

288 ©2011-2013 Basefount

Enable Mesh Drive

If the mapping relationship has been established, each time the agent pose been updated, the meshes in scene

will be deformed by the Miarmy agent.

Left: dynamic + force field, Right: viewport 2.0

Render by Renderman For rendering image, we dedicated provide a render plugin for previewing image, rendering image sequence or

exporting RIB file. This plugin is based on 3delight API, so you need install “3Delight Studio Pro” before using

these features.

Download from the following link and only 64bit:

http://www.3delight.com/en/index.php?page=3DSP_download

3Delight Configuration

Before using Renderman plugin, you need install 3delight correctly. You can easily check whether your 3delight

correct by click Miarmy > 3delight Setup > Check Renderer Status. If the result is not fine, please reinstall

3delight and reinstall Miarmy can solve this

Result is fine

The check render status script will check the following things:

1. Whether The 3Delight.dll in Maya bin is correct version

Page 289: MiarmyManualForV2.0

Miarmy 2.0 Manual

289 ©2011-2013 Basefount

2. Whether install 3Deligth

3. Whether install correct version of 3Delight

4. Check shader path

5. Check whether shaders has been compiled

6. Check setup DL_DISPLAYS_PATH

Manually Setup Renderer (Windows)

If you are familiar with the windows system, you can please setup your render by following steps, it should be

make your image can be rendered out.

Close Maya

Re install 3delight 10 64bit firstly

Copy the 3Delight.dll from 3delight bin folder (e.g. F:\Program Files\3Delight\bin) to the Maya bin folder

(e.g. F:\Program Files\Autodesk\Maya2012\bin)

Open Maya and load Miarmy

Click Miarmy > 3delight Setup > Compile Shaders

Pipeline

The render pipeline is fairly simple and clear. There is an internal loop based on all the agents in scene, the

original agent will match to the agent in current iteration, and then export the geometries from original agents

to the engine, finally we will send the scene information like the geometries, lights, shaders and so on to the

render engine. The engine will render out the image based on the scene description info.

Page 290: MiarmyManualForV2.0

Miarmy 2.0 Manual

290 ©2011-2013 Basefount

Internal render pipeline

How to Render

If the renderer setup correctly, you can create something and light them up then click Miarmy > Render Preview

(i-display). Once the stuff rendered out, it proof that your renderer is ready for duty.

The simple render test

Render Agents

For rendering agents, we need firstly make sure the original agent have geometries been skinned on it. And the

Geometry_<Agent Type> group contains these geometries.

Original Agent with geometries skinned on its joints

And you need place the agents out from place node(s).

Page 291: MiarmyManualForV2.0

Miarmy 2.0 Manual

291 ©2011-2013 Basefount

Test render

Random Geometries Rule

We already know that the render engine need fetch the geometries in Original Agents. We can easily re-arrange

the structure of these geometries in Geometry_<agent type> group for achieving randomizing.

There are 3 rules for making the geometries random:

1. The geometries directly under the Geometry_<agent type> will be always rendered.

2. And if there are several sub groups, and these sub groups are children of a root group, and this root

group is directly under the Geometry_<agent type>. We will choose all the geometries in one of sub

groups even there still have hierarchy in sub group. Notice, there may be no geometry in sub group.

3. If the geometries under a child group of Geometry_<agent type>, one of these geometries will be

rendered.

Page 292: MiarmyManualForV2.0

Miarmy 2.0 Manual

292 ©2011-2013 Basefount

Random rules example. One of the items in green bound will be selected.

Please check out the above picture,

1. The items in the first orange bound will obey rule 1

The system will choose one of the geometries from the green bound. For example, “head_Mesh2”,

“l_arm_Mesh”, “l_shoe_Mesh”, “r_arm_Mesh” and “r_shoe_Mesh” will be all selected.

2. The items in the second and third orange bound will obey rule 2

The system will choose one of the groups in green bound, and then fetch all the geometries out from

that group. If that group doesn’t have geometry, the system will not fetch anything, whereas if that

group has further sub hierarchy, the system will fetch all the geometries from all sub hierarchy, for

example, in “set1” will be chosen, and all the geometries in “set1” and sub hierarchy will be all selected.

3. The items in the fourth orange bound will obey rule 3

The system will choose one of the geometries in green bound. For example, the “shirt_Mesh1” will be

selected.

Notice the cap, pants and t-shirt geometries

Page 293: MiarmyManualForV2.0

Miarmy 2.0 Manual

293 ©2011-2013 Basefount

Texture Naming Convention and Random Textures

We can randomize the textures just by the texture name. If you make your texture names by the following rules,

system will random texture for your geometry automatically without any further setup.

Correct naming convention for automatic random texture:

<Texture Name>_<padding>.<format>

1. Need at least an underscore before numbering

2. Only single padding number

3. Sequential numbering

If your texture names are correct, you just need fill the first texture name in the Image Name attribute.

Example: if you assign “pants_color_1.tif” in your Image Name attribute, the system can automatically parse out

the Green name in the following example.

Assign image name in texture file node

pants_color_1.tif

pants_color_2.tif

pants_color_3.tif

pants_color_4.tif

pants_color_1.tif

pants_color_2.tif

pants_color_0.tif (cannot read, not sequential)

pants_color_4.tif (cannot read, not sequential)

pants_color_1.tif

pants_color_2.tif

pants_color_03.tif (cannot read, not right numbering)

pants_color_04.tif (cannot read, not right numbering)

Incorrect naming:

Page 294: MiarmyManualForV2.0

Miarmy 2.0 Manual

294 ©2011-2013 Basefount

pant_color1.tif (no underscore, cannot reach)

pant_color0001.tif (no underscore, cannot reach)

pant_color_001.tif (non-single padding, cannot reach)

Once we parse out all the possible textures, for example, from “pants_color_1.tif”, we found “pants_color_2.tif”,

“pants_color_3.tif” and “pants_color_4.tif”. Then, the system can automatically random select one of it based

on the agent. For example, “pants_color_2.tif” will be selected. And the “pants_color_2.tif” will be sent to the

render engine.

Random textures

Page 295: MiarmyManualForV2.0

Miarmy 2.0 Manual

295 ©2011-2013 Basefount

Render Global

Once you know how to render the image out, you can adjust the attributes in Render Global for fine-tune the

image quality.

Render global

Texture generate and path accessible

Due to that the Renderman need generate the .tex file for each of texture, please make sure the directory you

put your textures is writeable. Or you need pre-compile the “.tex” file and put these file on sever. Please notice

the following figure. You may notice each texture file has a “.tex” file counterpart.

Page 296: MiarmyManualForV2.0

Miarmy 2.0 Manual

296 ©2011-2013 Basefount

The .tex file in the same folder of texture

Multi cam render

Our system will automatically render image from all renderable cameras, if you want to render stereo multi can,

please just setup in Maya Render settings.

If you have several renderer cams, the Renderable Camera in Miarmy Render Global will change to “All Render

Cams (Stereo & Multi) automatically. And you don’t need to setup them again here.

Render multi cam

Preset shaders

You can directly use Maya shader and its instinct features to render the scene, our render plugin will

automatically translate the Maya shader to Renderman shader parameters, then render image out. Just like

3Delight for Maya or Pixar’s Renderman for Maya.

We only support 3 types of preset shader of Maya. They are Lamber, Blinn and Phong. You can use Miarmy >

Rendr Preview (i-display) for directly rendering image out.

Lamber / Blinn / Phong rendered by 3delight preset shader

Page 297: MiarmyManualForV2.0

Miarmy 2.0 Manual

297 ©2011-2013 Basefount

Preset shader supports the following feature, and all of them don’t need you setup, just give them Maya Shader:

Only need setup Maya shader

Note: If you render image by Miarmy > Render Preview (i-display), the preview image will be the first pass in

Miarmy Render Global. Whereas if you render images by batch Miarmy > Render Extra > Render batch to Image

Files, the render plugin will render all the images in each pass.

For example like the following picture, if you check Shadow and Occlusion passes, and when you preview render,

only shadow pass will be rendered out for current frame. And if you render image batch to files, all the images

for every frames and every passes will be rendered to specified path.

Render passes in Miarmy Render Global

Beauty Pass

Our system directly support these shader features:

Page 298: MiarmyManualForV2.0

Miarmy 2.0 Manual

298 ©2011-2013 Basefount

The preset shader feature

Displacement Map

Miarmy render plugin doesn’t support bump map. Instead, it supports displacement map. The only thing need

to do is link a Maya displacement material to the shading group node. Because Renderman based on micro

polygon, the displacement map is faster and better then bump.

Creating displacement material

Page 299: MiarmyManualForV2.0

Miarmy 2.0 Manual

299 ©2011-2013 Basefount

Fill the displacement map

Displacement map

Displacement Map Intensity

You can directly change the alpha gain parameters for tweaking displacement intensity:

Page 300: MiarmyManualForV2.0

Miarmy 2.0 Manual

300 ©2011-2013 Basefount

Displacement Bound

If you are using high intensive displacement, there may be some render error on it like the following left picture.

For solving this, you need add a displacement bound attribute to the geometry. Miarmy > Render Extra > Add

Displacement Bound Attribute

Shadow Pass

You need enable depth shadow map in light attributes

(left) maya viewport (right) Shadow pass

Render Ambient Occlusion:

The occlusion quality can be setup in Render Global OCC samples

Page 301: MiarmyManualForV2.0

Miarmy 2.0 Manual

301 ©2011-2013 Basefount

Occlusion pass

Depth Pass

Controlled by near and far clips

Depth shader controlled by camera near and far clip. (Left) frustum (right) render result

The shader located in 3delight shader path. They are:

McdBumpy.sdl

McdDOF.sdl

McdGatherAO.sdl

McdSpotlightInv.sdl

McdTxtPlastic.sdl

And the source codes are located in Miarmy installation place.

Page 302: MiarmyManualForV2.0

Miarmy 2.0 Manual

302 ©2011-2013 Basefount

Self-defined Renderman Shader

You can create Renderman shader shell and link them to external renderman shader. In current version, we only

support

RM shader shell

Click “Browse” to select shader,

Expand “Extra Attributes” for displaying the attribute of the shader

Click “Update RIB” for updating the “Shader String”.

Click “Reload” for clear all attributes and set to default.

The emboss shader example

Page 303: MiarmyManualForV2.0

Miarmy 2.0 Manual

303 ©2011-2013 Basefount

The render result from “brick” shader with different parameters

Displacement Map is the same as surface map, but it need connect to “Displacement mat.” attribute.

Connect a McdRMDispMat shader to node

Displacement map and render result

Page 304: MiarmyManualForV2.0

Miarmy 2.0 Manual

304 ©2011-2013 Basefount

Prman Rib Export, support .slo for custom Shader

Since version 1.5, the rib exporting can directly support prman’s “.slo” shader,

Fill .slo and our system can hook them for you

Know Issue

Sometimes in some platforms, the node attribute editor for displaying shaders attributes is not updating

correctly, we still cannot find out why but there is 2 solutions can bypass it:

This attribute may disappear, so you cannot modify the data in shader

We found these attributes are existed but just not display correctly,

Solution 1 is duplicate the attribute tab by clicking “Copy Tab”

Click copy tab and clone a new tab the new tab

Solution 2 is adjust the attribute in channel box (but cannot change the string type of attributes)

Page 305: MiarmyManualForV2.0

Miarmy 2.0 Manual

305 ©2011-2013 Basefount

Adjust the attributes in channel box

Light Usage & Shadow

Lights

Miarmy support 4 types of lights for lighting.

But only support Spot light for shadowing.

Available lights

Shadow

Need enable shadow Map and resolution should be 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, and

8192.

Page 306: MiarmyManualForV2.0

Miarmy 2.0 Manual

306 ©2011-2013 Basefount

Need enable shadow Map and resolution should be some specific value

Ray trace shadow

Since version 1.5, our build-in render plugin support Ray trace render, this method can save time and hard disk

spaces for exporting shadow map, and much easier to setting up.

Currently, we are only support “directional light” of ray-trace shadow . And you have to enable the “Use

Ray Trace Shadows” to turn the shadow on, while the “Shadow Rays” can control the sampling value of render

man light shader.

And the final result is much better;

3 types of ray trace method

Ray Trace Shadow All: render all diffuse and shadows

Page 307: MiarmyManualForV2.0

Miarmy 2.0 Manual

307 ©2011-2013 Basefount

Ray Trace Shadow Agent: only render the shadow on agents

Ray Trance Shadow Terrain (render only terrain shadows)

Page 308: MiarmyManualForV2.0

Miarmy 2.0 Manual

308 ©2011-2013 Basefount

Motion Blur

There are 3 types of motion blur in Miarmy renderman plugin

Camera motion blur: blur when camera moving

Transform motion blur: blur entire agent by its root movement

Deformation motion blur: blur based on the deformation of the geometries

Deformation motion blur have more accurate and better result whereas transform motion blur is faster, usually

you need choose one of them but don’t enable them both.

The first is a camera attribute and you can enable it in render setting page:

Notice: motion blur only can work with agent has cache

Page 309: MiarmyManualForV2.0

Miarmy 2.0 Manual

309 ©2011-2013 Basefount

3 types of motion blur in Miarmy Render Global

Camera motion blur (camera is rotating)

Transform motion blur (blur entire agent)

Deformation motion blur (blur only deforming parts)

Page 310: MiarmyManualForV2.0

Miarmy 2.0 Manual

310 ©2011-2013 Basefount

You can change the motion blur quality by Pixel Sample attributes in render global

Pixel Sample results

Renderman Procedural Primitives

Reason

The reason of using procedural primitives is pretty simple: save space of hard disk.

Under the hood

Traditional Renderman RIB file will contain the all geometry details in file for rendering the scene, each single

geometry will be included in each frame of RIB, sometime this will using huge amount of hard disk, for example

you have 10000 agents with 100000 piece of geometry it’s impossible store them in hard disk directly.

Procedural primitive is a feature can insert these geometries information in render time and discard them

automatically after rendering. So it will save your hard disk, but not accelerate your render.

The Pipeline

1. We firstly export some information on hard drive, we call them agent assets. The agent assets actually

are some information of “Pre Bind” pose and geometries.

2. Then export RIB file with special block instead of geometry block (means, the RIB will not contain

geometry information any more)

3. When rendering, system will call a McdRunProgram to read that special block in RIB and generate right

geometry info and replace it with the geometry block.

Page 311: MiarmyManualForV2.0

Miarmy 2.0 Manual

311 ©2011-2013 Basefount

Left: transitional rib approach, Right: procedural primitive approach

Agent Assets Content

The agent assets will be automatically export to hard disk when export RIB and its location will be the same as

the RIB

They are 3 types of files

1. Agent Main File:

a. Agent bone number

b. Bone names and structure

c. World inverse matrices of each bone

2. Original Geometry Files:

a. The rib file of original geometry

3. Weight List files:

a. Each line contains current point weight list (bone id and bone weight)

b. (the number of lines equals to point number)

Page 312: MiarmyManualForV2.0

Miarmy 2.0 Manual

312 ©2011-2013 Basefount

Agent Assets Structure

Each scene contains several agent types, each type have severl geometries.

The colorful words mean folder and white names mean files

Rib Tags

Format:

Procedural "RunProgram" [ "<RunProgram Folder>/McdRunProgram" "MiarmySession: <agent assets

folder>/ProcPrimAssets <agent type id> <geometry type id> <motion blur> <shutter open> <shutter close>

<pose data[12] * number of bone> ] [<xmin>, <xmax>, <ymin>, <ymax>,<zmin>,<zmax>(bounding box info)]

The bone without weighting, we will not export their pose, instead, we put an asterisk there “*”, one “*”

standard for 12 zeroes, this can save much hard disk space.

Example (with motion blur and 4 bones, 2 no weighting)

Procedural "RunProgram" [ "D:/Users/Yeah YANG/Documents/Visual Studio

2008/Projects/McdRunProgram/x64/Release/McdRunProgram" "MiarmySession: d:/pp/abc/ProcPrimAssets/ 0 0 1

0.000 0.500 0.83873 0.00000 -0.54454 0.00000 1.00000 0.00000 0.54454 0.00000 0.83873 0.34956 0.00000 4.77319 -

0.54429 0.00000 -0.83889 0.00000 1.00000 0.00000 0.83889 0.00000 -0.54429 1.18829 0.00000 4.22864 * * 0.83873

0.00000 -0.54454 0.00000 1.00000 0.00000 0.54454 0.00000 0.83873 0.69913 0.00000 4.54638 -0.54429 0.00000 -0.83889

0.00000 1.00000 0.00000 0.83889 0.00000 -0.54429 1.53786 0.00000 4.00183 " ] [ -1.0337217 2.0822851 -2.220446e-16

2.220446e-16 3.163023 6.1564216 ]

Page 313: MiarmyManualForV2.0

Miarmy 2.0 Manual

313 ©2011-2013 Basefount

The “McdRunProgram” under the Hood

The “McdRunProgram” is a Renderman plugin can read the agent assets and rig tags, then generate the

geometry, and put the result in memory in render runtime.

This program actually implements a very simple skinning algorithm to bind the agent geometry and calculate the

right position of each point and right direction of each normal (Note: if using sub-division mesh, no normal need

to be calculated). Then put the results to stream (in memory)

Source Code

The “McdRunProgram” is an open source program written by Basefount Team and exclusively open for our

formal testers and customers. If you need, please contact us.

Note:

The preview render is using procedural primitive automatically and will not generate agent assets

If you render image from Maya directly, it will automatically use procedural primitive and will not

generate agent assets files.

Renderman Extra Rib Attribute (internal or custom)

We provided 2 extra types of render attributes:

1. Arbitrary string attribute

2. Build-in attribute

Arbitrary String Attributes:

Select any geometry and click Miarmy > Render Extra > Add/Del Custom Attributes > Add Custom String

Attribute,

There will be a new attribute (string type) added on your selected object

Page 314: MiarmyManualForV2.0

Miarmy 2.0 Manual

314 ©2011-2013 Basefount

Fill whatever you want and split the string by “ ” (blank Sign)

Then, the output rib will hook the attribute you specified (notice the blue font)

------------------------ rib example --------------------------

AttributeBegin # {

Attribute "identifier" "name" [ "|pSphereShape1" ]

Attribute "user" "uniform string creatureType" [ "lion" ]

Attribute "user" "uniform string creaturePart" [ "head" ]

Attribute "displacementbound" "sphere" [ 1 ]

ShadingInterpolation "smooth"

Surface "McdTxtPlastic"

"Ks" [ 0 ]

"Kd" [ 0.8 ]

"Ka" [ 1 ]

---------------------------------------------------------------

Build-in Attribute

There are also some attribute will write to rib if user nee them:

Build-in Renderman attributes

Agent Index: the index of agent, (0, 1, 2, 3…<Number of Agents>)

Body Index: the index of body in each agent

Agent ID: an unique id between 0~1 randomly assigned to agent, each frame is stable

Body ID: an unique id between 0~1 randomly assigned to body, each frame is stable

Points Velocity: write each point velocity to primitive attributes (only motion blur)

Page 315: MiarmyManualForV2.0

Miarmy 2.0 Manual

315 ©2011-2013 Basefount

Rib preview for build-in attributes

Rib preview for points’ velocity

Hierarchical Subdivision Mesh

We can export hierarchical subdivision mesh after version 1.5, when we add the subd flag to polygon mesh.

There will be an extra attribute “asHiSubd” for turn this subd to hierarchical subdivision mesh.

This kind of subd can solve some problems when the edge has shrunk:

Hierarchical subdivision mesh

Page 316: MiarmyManualForV2.0

Miarmy 2.0 Manual

316 ©2011-2013 Basefount

Command Line (Batch) Exporting RIBs

With the similar operations we can export Rib file to hard disk by the command:

1. The scene can be export RIB normally

2. Setup the exporting path and file name correctly

3. Pre-test some frames and check is that RIB file can be generated properly.

Setup the rib exporting path and name properly (Render Global)

Re-direct your start position into the Maya bin and Run command “McdBatchExportRib”

Platform Command Line

Windows Mayabatch “d:/test.ma” –command “McdBatchExportRib”

Linux Maya –batch –file “/usr/test.ma” –command “McdBatchExportRib”

If everything all right, the RIB (.rib) file will be created in specified folder.

Misc New Layers:

Page 317: MiarmyManualForV2.0

Miarmy 2.0 Manual

317 ©2011-2013 Basefount

Color pass

RGB Light Pass (can re-light)

Page 318: MiarmyManualForV2.0

Miarmy 2.0 Manual

318 ©2011-2013 Basefount

Normal pass render (can re-light)

Split render

Reason

When the scene contains several thousand agents and each agent contains several geometries, our machine

may meet the bottleneck. At this time, we need separate the render job to several parts and finish each part one

by one and finally combine the results. We do this using split render.

Under the hood

Split render is actually going to split screen to different parts and render each parts one by one, and each part

will output a picture. Then, we need combine them in post-production software. The splitX and splitY attributes

are used to specify how you need split the render screen.

The calculation is based on bounding box of the agent, in original agent.

The agent with break dynamic bones (such like the solider dropped the sword ) will be rendered in

every split part

For example in following 2 pictures, we split the screen 3 by 3 to 9 parts, and our renderer will render each part

of them.

Page 319: MiarmyManualForV2.0

Miarmy 2.0 Manual

319 ©2011-2013 Basefount

Split the render screen 3 by 3 to 9 parts

Split screen and separate the agents

Render Result

The render result naming convention will be:

<Frame Name>_<pass>__<part X>_<part Y>_.<Frame Number>

The image can be rendered out fast also without any bottle neck:

The result of split render

Page 320: MiarmyManualForV2.0

Miarmy 2.0 Manual

320 ©2011-2013 Basefount

Procedural Primitives

Reason

The reason of using procedural primitives is pretty simple: save space of hard disk.

Under the hood

Traditional Renderman RIB file contains the all geometry details in file for rendering the scene, each single

geometry will be included in each frame of RIB, sometime this will using huge amount of hard disk, for example

you have 10000 agents with 100000 piece of geometry it’s almost impossible store them in hard disk directly.

Procedural primitive is a feature can insert these geometries information before rendering in memory and

discard them automatically after rendering. So it will save your hard disk, but not accelerate your render.

The Pipeline

4. We firstly export some information on hard drive, we call them agent assets. The agent assets actually

are some information of “Pre Bind” pose and geometries.

5. Then export RIB file with special block instead of geometry block (means, the RIB will not contain

geometry information any more)

6. When rendering, system will call a McdRunProgram to read that special block in RIB and generate right

geometry info and replace it with the geometry block.

Left: transitional rib approach, Right: procedural primitive approach

Page 321: MiarmyManualForV2.0

Miarmy 2.0 Manual

321 ©2011-2013 Basefount

Agent Assets Content

The agent assets will be automatically export to hard disk when export RIB and its location will be the same as

the RIB

They are 3 types of files

4. Agent Main File:

a. Agent bone number

b. Bone names and structure

c. World inverse matrices of each bone

5. Original Geometry Files:

a. The rib file of original geometry

6. Weight List files:

a. Each line contains current point weight list (bone id and bone weight)

b. (the number of lines equals to point number)

Agent Assets Structure

Each scene contains several agent types, each type have severl geometries.

The colorful words mean folder and white names mean files

Page 322: MiarmyManualForV2.0

Miarmy 2.0 Manual

322 ©2011-2013 Basefount

Rib Tags

Format:

Procedural "RunProgram" [ "<RunProgram Folder>/McdRunProgram" "MiarmySession: <agent assets

folder>/ProcPrimAssets <agent type id> <geometry type id> <motion blur> <shutter open> <shutter close>

<pose data[12] * number of bone> ] [<xmin>, <xmax>, <ymin>, <ymax>,<zmin>,<zmax>(bounding box info)]

Example (with motion blur and 2 pose):

Procedural "RunProgram" [ "D:/Users/Yeah YANG/Documents/Visual Studio

2008/Projects/McdRunProgram/x64/Release/McdRunProgram" "MiarmySession: d:/pp/abc/ProcPrimAssets/ 0 0 1

0.000 0.500 0.83873 0.00000 -0.54454 0.00000 1.00000 0.00000 0.54454 0.00000 0.83873 0.34956 0.00000 4.77319 -

0.54429 0.00000 -0.83889 0.00000 1.00000 0.00000 0.83889 0.00000 -0.54429 1.18829 0.00000 4.22864 0.83873 0.00000 -

0.54454 0.00000 1.00000 0.00000 0.54454 0.00000 0.83873 0.69913 0.00000 4.54638 -0.54429 0.00000 -0.83889 0.00000

1.00000 0.00000 0.83889 0.00000 -0.54429 1.53786 0.00000 4.00183 " ] [ -1.0337217 2.0822851 -2.220446e-16

2.220446e-16 3.163023 6.1564216 ]

The “McdRunProgram” under the Hood

The “McdRunProgram” is a Renderman plugin can read the agent assets and rig tags, then generate the

geometry, and put the result in memory in render runtime.

This program actually implements a very simple skinning algorithm to bind the agent geometry and calculate the

right position of each point and right direction of each normal (Note: if using sub-division mesh, no normal need

to be calculated). Then put the results to stream (in memory)

Source Code

The “McdRunProgram” is an open source program written by Basefount Team and exclusively open for our

formal testers and customers. If you need, please write contact us.

Note:

The preview render is using procedural primitive automatically and will not generate agent assets

If you render image from Maya directly, it will automatically use procedural primitive and will not

generate agent assets files.

Page 323: MiarmyManualForV2.0

Miarmy 2.0 Manual

323 ©2011-2013 Basefount

Subdivision Mesh

Subdivision mesh is an powerful feature of Renderman, our render plugin support it!

Once you mark a subd flag on geometry, our renderer will take this geometry subdivision mesh instead of

polygon mesh. For adding subd flag to geometry, you need simply click Miarmy > Render Extra > Add Subd

Attributes. You may notice the hard edge on mesh will disappear and the antialiasing is perfect.

(left) Maya viewport (mid) polygon mesh (righ) subd mesh

Extra attributes

As Subd On

The object will be rendered as subdivision mesh instead of polygon mesh

Interpolate Boundary On

If enable, the subdivision mesh should interpolate all boundary faces to their edges

(left) Maya viewport (mid) disable interpolate boundary (righ) enable interpolate boundary

Page 324: MiarmyManualForV2.0

Miarmy 2.0 Manual

324 ©2011-2013 Basefount

Matte

You can add background color matte to some objects for skip there render but still leave the alpha channel there.

You can simply click Miarmy > Render Extra > Add Matte Attribute.

(left) maya viewport (mid) render result (right) alpha channel

Fetch Agent Render Information from Miarmy to Your Own Pipeline

Fetch Joint Information

By menu Item

Select any agent, and click Debug Tools > Agent Match, you original agent will align/match to the agent, no

matter cloth or broken joint part, animation or dynamical, the result should be perfect matched.

Click Debug Tools > Agent Return for put your Original Agent to initial pose.

Match “Original Agent” to “agent”, then you can fetch joints info from Original Agent

Page 325: MiarmyManualForV2.0

Miarmy 2.0 Manual

325 ©2011-2013 Basefount

By MEL/Python Command

The agent match process can be done by script,

1. Select any one of agents

2. Run “McdAgentMatchCmd -mm 1;” MEL script for matching Original Agent to selected agent

Put the Original Agent back to origin:

1. Run “McdAgentMatchCmd -mm 0;” MEL script for putting all Original Agent to origin and T-Pose

Fetch geometry information

By MEL/Python command

Run “McdGetRenderGeoCmd -rec 0;” MEL command.

The system will return an array which contents are:

<agent name1><geo1><geo2>…<geoN><’#’><agent name2><geo1><geo1><geo2>…<geoN><’#’>…

For example:

# Result: [u'McdAgent1', u'head_Mesh2Shape', u'l_arm_MeshShape', u'l_shoe_MeshShape',

u'r_arm_MeshShape', u'r_shoe_MeshShape', u'l_leg_MeshShape', u'r_leg_MeshShape', u'shorts_Mesh5Shape',

u'shirt_Mesh1Shape', u'#', u'McdAgent2', u'head_Mesh2Shape', u'l_arm_MeshShape', u'l_shoe_MeshShape',

u'r_arm_MeshShape', u'r_shoe_MeshShape', u'capShape', u'l_leg_MeshShape', u'r_leg_MeshShape',

u'shorts_Mesh5Shape', u'tshirt_MeshShape', u'#', u'McdAgent3', u'head_Mesh2Shape', u'l_arm_MeshShape',

u'l_shoe_MeshShape', u'r_arm_MeshShape', u'r_shoe_MeshShape', u'pantsShape', u'tshirt_MeshShape', u'#',

u'McdAgent4', u'head_Mesh2Shape', u'l_arm_MeshShape', u'l_shoe_MeshShape', u'r_arm_MeshShape',

u'r_shoe_MeshShape', u'capShape', u'pantsShape', u'shirt_Mesh1Shape', u'#', u'McdAgent5',

u'head_Mesh2Shape'

Command Line (Batch) Exporting RIBs

With the similar operations we can export Rib file to hard disk by the command:

4. The scene can be export RIB normally

5. Setup the exporting path and file name correctly

6. Pre-test some frames and check is that RIB file can be generated properly.

Page 326: MiarmyManualForV2.0

Miarmy 2.0 Manual

326 ©2011-2013 Basefount

Setup the rib exporting path and name properly (Render Global)

Re-direct your start position into the Maya bin and Run command “McdBatchExportRib”

Platform Command Line

Windows Mayabatch “d:/test.ma” –command “McdBatchExportRib”

Linux Maya –batch –file “/usr/test.ma” –command “McdBatchExportRib”

If everything all right, the RIB (.rib) file will be created in specified folder.

Render by Mesh Drive

The Old Mesh Drive 2.0 (Obsoleted)

Mesh drive 2.0 is a feature from version 1.5 ~ 1.5.8 and now is obsoleted.

The History of Mesh Drive

The evolution from Mesh drive 1.0 to mesh drive 2.0, now is mesh drive 3.0

Mesh Drive 1.0 (Still Available) Mesh Drive 2.0 (Obsoleted)

Need place agent No need place agent

Need Duplicate Mesh Need Duplicate Mesh

Need Calculate Agent to Joints Direct Drive Joints from Cache (faster)

Need Agent Cache Need Joints Cache

NEW: Mesh Drive 3.0

For more fast and stable batch render, we provide a better mesh drive render methods, the new feature of

Mesh Drive 3.0:

1. Put to render farm directly without commands, just like a normal Maya file. (site license needed)

2. With Render layer or re-assigned shader information save-able.

3. Save about than 40~50% memory (need save and reopen file)

4. 3~5 Times Faster than Drive Mesh 2.0 when drive mesh

5. Can export Alembic Cache, Maya Geometry Cache directly & correctly

Page 327: MiarmyManualForV2.0

Miarmy 2.0 Manual

327 ©2011-2013 Basefount

6. Save scene directly, even with tons thousands of geometries, no hard disk needed (Dynamic loaded

Miarmy Cache)

Compare between Mesh Drive 2.0 and 3.0

Mesh Drive 2.0 Mesh Drive 3.0

Cannot save geometry Directly Save

Not support Render Layer Support Render Layer

Not support Re-assign shader to geo Freely re-assign shader to any geometry

3~5x speed improvement

Save 40%~50% memory (need save & reopen)

Render farm need command call Directly put file to render farm

Cannot correctly export Alembic Correctly export Alembic and Maya Geo Cache

To be continued…

Under the hood

Cache

The new mesh drive 3.0 will export 2 kinds of very small files for storing the scene information and use them to

drive the mesh. They are:

1. The joint data of each original agent, we call them “Miarmy Bone Cache” (the extension name is “mbc”).

This is different from Miarmy Agent Cache, agent cache is storing the agent bone data whereas the

Miarmy Bone Cache store the Original agent bone data for each agent.

The Miarmy Bone Cache will be one frame one file.

2. A file contain the scene agent types, we call the agent type list file. Only need one file for a scene.

Drive pipeline

1. Before driving, our system will firstly duplicate (or generate) the geometries for each agent base on the

agent type list file.

2. Then we will create a node dedicated for controlling the driving session, this node will store the

information of pairing for accelerate the driving process.

3. When the system driving the meshes, it will read the Miarmy Bone Cache for a specific frame and use

original agent to drive meshes.

Mesh Drive Node

The mesh drive node control everything, the mesh drive node are controlled by time node, it will find and read

the cache, calculate the geometry shape, then plug that shape to “inMesh” of duplicated shape

The DG connection should be the following 2 pictures:

Page 328: MiarmyManualForV2.0

Miarmy 2.0 Manual

328 ©2011-2013 Basefount

And the whole scene should be like this, there is only one Mesh Drive node in scene:

One mesh drive node rule them all

Render Usage

Preparing in Maya

1. Place agents

2. Make agent cache and enable cache.

3. Setup Cache files store path in Miarmy > Render Global > Other Renders Tab

Output agent bone cache folder (.mbc)

Page 329: MiarmyManualForV2.0

Miarmy 2.0 Manual

329 ©2011-2013 Basefount

4. Make bone cache and agent type list file together by Miarmy > Other Renders > Mesh Drive 3.0 >

Export Cache

5. Save your scene! Make sure the batch render can run.

At this time you can choose whether render in Maya or directly render in batch mode. (Submit to render farm)

Method 1: Render in Maya

1. Need de-place agent firstly. (delete all agents)

2. Make sure your original agent is there in scene.

3. Duplicate Meshes by Miarmy > Other Renders > Mesh Drive 3.0 > Duplicate Meshes and Randomize

Texture

4. It will start to duplicating and them automatically random texture, usually, we need select “Duplicate

Random”

2 method for randomize texture

5. After that, your meshes will be there in origin of scene

Duplicated agents meshes

6. Enable Mesh Drive by Miarmy > Other Renders > Mesh Drive 3.0 > Enable Drive Mesh

7. Open your script editor to watch the progress

Progress will show in script editor

Page 330: MiarmyManualForV2.0

Miarmy 2.0 Manual

330 ©2011-2013 Basefount

8. At this time when you change the time line, it will update your scene

Driven meshes

9. Render that use any type of renderer, motion blur all is OK!

Render results

Method 2: Render in Batch Mode

This feature can render scene without open Maya and also you can submit this render job to Render Farm. If you

want to do render farm setup, you need site-license of Miarmy. All renderer support

Since the mesh drive 3.0, we can directly save the scene out and submit your render job to the render farm

without any setup

And then you can render it by command line:

Page 331: MiarmyManualForV2.0

Miarmy 2.0 Manual

331 ©2011-2013 Basefount

Maya command-line batch render

Render it in Maya interface:

Maya interface batch render

Export Usage

Except rendering, the Mesh Drive 3.0 is also a good exporting tool.

Due to the internal data transfer method improvement than 2.0, the Mesh Drive 3.0 can export geometry to

Alembic and Maya Geometry Caches directly and correctly, or others.

Export Alembic

Select all geometries and export with Maya exporter

Export V-Ray Mesh

Select all/some geometries and export with V-Ray exporter

User Miarmy > Other Renderers > Mesh Drive Exporter > Export Mesh As V-Ray vrmesh (Single Frames)

/ (All Frames)

Export Mental Ray Proxy

Select all/some geometries and export with Maya exporter

User Miarmy > Other Renderers > Mesh Drive Exporter > Export Mesh As Mental Ray Proxy (Single

Frames) / (All Frames)

Page 332: MiarmyManualForV2.0

Miarmy 2.0 Manual

332 ©2011-2013 Basefount

Benchmark

Test Machine

8GB DDR3 RAM

Intel i7 Core

Agent bones & Meshes

About 20 bones

7-11 geometries randomly

1600-1800 points need drive

Result

For 5000 agents:

1 second to build joint cache per frame, 6MB/Frame hard disk space

30 seconds to duplicate meshes, up to 1.9GB Memory (RAM)

10 second to drive mesh, up to 3.5GB Memory (RAM)

1.5 minutes to render (production quality 1280* 720)

Memory spend is about 5GB

batch mode is faster and save about 330 MB memory

save and re-open your scene can save about 30% memory

For 8000 agents:

3 second to build joint cache per frame, 10MB/Frame hard disk space

1 minute to duplicate meshes, up to 2.9GB Memory (RAM)

30 seconds to drive mesh, up to 4.5GB Memory (RAM)

3 minutes to render (production quality 1280* 720)

Memory spend is about 6.8GB

batch mode is faster and save about 350 MB memory

save and re-open your scene can save about 30% memory

Memory Usage:

The 8GB can hold at most 8000 agents in one Maya scene which contains about 64000 geometries.

Fortunately, the RAM is very cheap, 16GB RAM need about 100USD only.

Conclusion & Suggestions

Mesh drive is memory depending feature, the more memory you have, you got faster to render, so

increase memory if you want to use this method to render

Page 333: MiarmyManualForV2.0

Miarmy 2.0 Manual

333 ©2011-2013 Basefount

The speed of Mesh drive is depending on the number of points, so if your scene contains a lot of agents,

please make your geometries simpler, it will be much faster.

Render By Arnold

Since version 1.5, Miarmy support Solid Angle® Arnold Render™ (http://www.solidangle.com) with Procedural

Primitive DSO approach. The McdArnoldDSO (written by Basefount) is Open Source to our customers and the

confirmed beta users.

General Introduction

Our tool can export all the agents render information out to an Arnold “.ass” file to the disk you specified. Then,

we can create one Arnold StandIn object in Maya and link that “ass” file against with this StandIn object. After

setup some parameters, we can directly use Arnold for Maya (mtoa.mll) render plugin to render them out.

Arnold Procedural Primitive

Notice: this part is the explanation of Procedural Primitive under the hood. It can make users understand

better. You can skip this part and directly go to part “the tools” and “the pipeline” if you just want to render

image.

Reason

The reason of using procedural primitives is pretty simple: save hard disk space.

Under the hood

Regular Arnold ASS file contains the all geometries detail (points, normal etc…) in file for rendering the scene,

each single geometry will be included in each frame of RIB, sometime this will using huge amount of hard disk,

for example you have 10000 agents with 100000 piece of geometry with 200 frames, it’s almost impossible store

them in hard disk directly.

Procedural primitive DSO is a feature can insert these geometries information in render time and discard them

automatically after rendering. So it will save your hard disk, but in some case, it will not accelerate your render.

The Pipeline

7. We firstly export some information to hard drive, we call them agent assets. The agent assets actually

are some information of “Pre Bind” pose and original geometries etc...

8. Then export ASS file with special block instead of geometry block (means, the ASS files will not contain

geometry information any more)

Page 334: MiarmyManualForV2.0

Miarmy 2.0 Manual

334 ©2011-2013 Basefount

9. When rendering, system will call a McdArnoldDSO to read that special block in ASS and generate right

geometry info and replace it with the geometry block.

Left: traditional ass approach, Right: procedural primitive approach

Agent Assets Content

The agent assets will be automatically export to hard disk when export ASS and its location will be the same as

the ASS files. You can setup it at Miarmy > Render Global > Other Renderers Tab

Setup paths in Render Global

They are 3 types of assets files:

Page 335: MiarmyManualForV2.0

Miarmy 2.0 Manual

335 ©2011-2013 Basefount

7. Agent Main File:

a. Agent bone number

b. Bone names and structure

c. World inverse matrices of each bone

8. Original Geometry Files:

a. The element of original geometry (nsides, vidxs, nidxs, uvidxs, vlist, nlist, uvlist)

9. Weight List files:

a. Each line contains current point weight list (bone id and bone weight)

b. (the number of lines equals to point number)

Agent Assets Structure

Each scene contains several agent types, each type have severl geometries.

The colorful words mean folder and white names mean files

Accelerate Middle Data

The DSO program will read the text file, get each string line and parse them into data based on every piece of

mesh. But the process of string parsing in C++ is very slow, for accelerating them, we store some binary data file

intermediately to the middle file folder, this can save huge amount of time when rendering. It can bypass the

string reading and parsing process.

If your middle file path is not writable in render time, the render cannot be accelerated.

And if your middle file is correct and writable, you can see some files generated in the middle file folder

Page 336: MiarmyManualForV2.0

Miarmy 2.0 Manual

336 ©2011-2013 Basefount

Middle Data Format

The middle data is named as “miarmy_arnold_mid_data_<agent type id>_<geom id>, and in each one of middle

data file, it contain one type of geometry of agent.

For example: miarmy_arnold_mid_data_1_3

This middle data is no extension name and it is the binary format data,

Arnold render intermediate accelerate data

The format inside Middle Data is ordered as the following sequence:

<Number of bones> (size: 1)

<Bone Original Poses> (size: bone number * 12)

ASS Tags

Format:

procedural

{

name <object name>

min <xmin>, <xmax>, <ymin> (bounding box info)

max <ymax>,<zmin>,<zmax>

dso "<DSO Folder>/McdArnoldDSO.dll"

declare G_assetsPath constant STRING

declare G_middlePath constant STRING

declare G_agentID constant INT

Page 337: MiarmyManualForV2.0

Miarmy 2.0 Manual

337 ©2011-2013 Basefount

declare G_geoID constant INT

declare G_poly0_subd1 constant INT

declare G_motionBlur constant INT

declare G_motionShutter constant FLOAT

declare G_poseData constant STRING

G_assetsPath "<assets path>"

G_middlePath "<render acceleration middle file path>"

G_agentID <agent id>

G_geoID <geometry id>

G_poly0_subd1 <0 is polygon, 1 is subdivision mesh>

G_motionBlur <0: not motion blur, 1: with motion blur>

G_motionShutter <motion shutter, default 1>

G_poseData "<pose data[12] * number of bone> "

shader <shading group name>.dagSetMembers

}

Example:

procedural

{

name pSphereShape10

min -4.552 -0.237 -4.552

max 4.552 9.314 4.552

dso "D:/Users/Yeah YANG/Documents/Visual Studio 2008/Projects/McdArnoldDSO/x64/Release/McdArnoldDSO.dll"

declare G_assetsPath constant STRING

declare G_middlePath constant STRING

declare G_agentID constant INT

declare G_geoID constant INT

declare G_poly0_subd1 constant INT

declare G_motionBlur constant INT

declare G_motionShutter constant FLOAT

declare G_poseData constant STRING

G_assetsPath "d:/abc/arnold/ProcPrimAssets/"

G_middlePath "d:/abc/arnold/TempMiddleFiles/"

G_agentID 1

G_geoID 0

G_poly0_subd1 0

Page 338: MiarmyManualForV2.0

Miarmy 2.0 Manual

338 ©2011-2013 Basefount

G_motionBlur 0

G_motionShutter 1.000

G_poseData "0.00020 0.68235 -0.73102 -0.00008 0.73102 0.68235 1.00000 -0.00008 0.00020 0.00000 0.00000 0.00000 -

0.00002 0.88383 0.46780 0.00080 0.46780 -0.88383 -1.00000 0.00035 -0.00072 0.00130 4.41827 -4.73345 -0.00079 -

0.30211 0.95327 0.00012 0.95327 0.30211 -1.00000 0.00035 -0.00072 0.00120 8.24556 -2.70769 0.99999 -0.00044

0.00100 0.00044 1.00000 -0.00029 -0.00100 0.00029 0.99999 -0.00370 6.39036 3.14616 "

shader initialShadingGroup.dagSetMembers

}

The “McdArnoldDSO” under the Hood

The “McdArnoldDSO” is an Arnold plugin (.dll in Windows) can read the agent assets and rig tags, then generate

the geometry, and put the result in memory in render runtime.

This program actually implements a very simple skinning algorithm to bind the agent geometry and calculate the

right position of each point and right direction of each normal (Note: if using sub-division mesh, no normal need

to be calculated). Then put the results to (in memory)

Source Code

The “McdArnoldDSO” is an open source program written by Basefount Team and exclusively open for our formal

testers and customers. If you need, please write contact us.

Note:

The preview render is using procedural primitive automatically and will not generate agent assets

If you render image from Maya directly, it will automatically use procedural primitive and will not

generate agent assets files.

Page 339: MiarmyManualForV2.0

Miarmy 2.0 Manual

339 ©2011-2013 Basefount

The tools

The mental ray features

We provide some tools for achieve this MR proxy render:

Setup Current Frame: export only current frame render info out

Setup Scene Sequence: export every frame in time line

Export Shader Ass Files: only export shader information on all geometries of Original Agents

The Pipeline

Export ASS

Before render we need export agent geometry to ASS file by the “Setup Current Frame” or “Setup Scene

sequence” tool, please notice that if we want to export all frames sequence, the agent cache should be made

before exporting.

After exporting, you should be able to see some files been exported to the folder specified in Render Global.

Exporting assets and render contents

Motion Blur

For render motion blur, you just need enable the motion blur in Arnold Native Settings, and make sure the

Shutter Size is 1 (because we cannot support float point frame motion blur)

Page 340: MiarmyManualForV2.0

Miarmy 2.0 Manual

340 ©2011-2013 Basefount

Setup Motion Blur directly in Arnold Global

Create Standin & Setup

After exporting, you need create an Arnold standin object and do some setup, please notice, only 1 standin

object need to be created. For different frame, you can animate the “frame” attribute on that standin object

whereas the frame sequence will be changed to “#”sign in Path field.

The .ass files in export directory

Standin setup

Page 341: MiarmyManualForV2.0

Miarmy 2.0 Manual

341 ©2011-2013 Basefount

Render By Mental Ray

General Introduction

Our tool can export all the agents render information out to a Mental Ray “.mi” file to the disk you specified.

Then, we can create one Mental Ray proxy objects in Maya and link that “.mi” file against with this Mental Ray

Proxy object.

Know the Limits at this time:

Cannot using namespace referencing pipeline

Cannot randomize texture

Cannot Render Motion Blur

The tools

The mental ray features

We provide some tools for achieve this MR proxy render:

Setup Current Frame: export only current frame render info out and port the proxy in maya

Setup Scene Sequence: export every frame in time line

Export Shader MI Files: only export shader information on all geometries of Original Agents

What is Mental Ray Proxy Object, Please Refer:

http://download.autodesk.com/global/docs/maya2013/en_us/index.html?url=files/GUID-BA0141FB-

972F-4DA4-AEAC-20B82048D52F.htm,topicNumber=d30e654067

Page 342: MiarmyManualForV2.0

Miarmy 2.0 Manual

342 ©2011-2013 Basefount

Replace MI Shader to Current Setup: replace shader only but not export geometries again

Link existed MI Sequence: create proxy planes in Maya and port the render into Maya

Clear MI Files: delete all the exported stuff in the target folder

Enable Update Render View: register a render pre MEL to export current frame before click the render

button

Disable Update Render View: unregister the render pre MEL command

Render Pipeline and Assets Organization:

Preparing

Before exporting MR proxy, we need specify which place will put the assets, and this folder should be existed in

your hard disk / server, please setup this in Render Global

Specify the MR exporting path in Render Global

Our system export the geometry and material data to disk firstly then using proxy object porting them back to

Maya for render.

1. Export material on all original geometries (check the following picture)

2. Iterate frame and export geometries data (in this process, system will rename the geometries)

3. Combine all the geometries data from step 2 and to a single file (check the following picture)

4. Generate a dedicated proxy file

5. Import MR Proxy based on the file created from step 4, and we host the proxy file on a piece of plane.

6. We will key frame the visibility of the plane from step 5. (check the following picture)

Page 343: MiarmyManualForV2.0

Miarmy 2.0 Manual

343 ©2011-2013 Basefount

Exporting results

Then our MEL will port the proxy file in miProxy folder and hook each of them to different polygonal plane. For

example there are 7 frames, and there will be 7 planes. Also our MEL will automatically key frame these planes

on their visibility channels make them only show up in right frame,

Proxy file need port to Maya

Page 344: MiarmyManualForV2.0

Miarmy 2.0 Manual

344 ©2011-2013 Basefount

The plane object hide/unhide each frame

At this time, when you click render button, the render will be automatically done in Maya:

Render preview

Replace Shader without Exporting Geometries Again

Once we export proxy, the material will be export and hook up the geometry also, so if we want to render our

geometries with others shaders (such as Occlusion or normal), we need export the materials and replace these

information in MI files.

Notice: replacing is only available for sequence exporting.

Replace Principle, Miarmy now only support:

multi materials to single material replacing (Lamber1, phone1, lamber3 etc => occlusion shader)

Page 345: MiarmyManualForV2.0

Miarmy 2.0 Manual

345 ©2011-2013 Basefount

single material to single material replacing (Occlusion shader => normal shader)

So we suggestion exporting the color/beauty pass out and save as the file to different version for replacing

shader and render others passes

Replace Shader Pipeline and Assets

1. Export all Shaders of all geometries to another shader file

2. Re-generate a bunch of small proxy file hook new generated material MI files

3. Replace that files in Maya proxy host plane

New exported materials and proxy files

Page 346: MiarmyManualForV2.0

Miarmy 2.0 Manual

346 ©2011-2013 Basefount

Render result

Render By V-Ray

V-Ray archive Support

Miarmy can export V-Ray Mesh file (.vrmesh) and port them back to maya for V-Ray Rendering. The whole

process is based on the build-in MEL command from V-Ray itself.

Preparation

Firstly, you have to install V-Ray for Maya correctly “vrayformaya.mll”

Secondly, the agent cache should be created and drive agent correctly.

Then, the export folder and file name should be specified in Render Global

Specify the V-Ray Mesh folder and file name

Page 347: MiarmyManualForV2.0

Miarmy 2.0 Manual

347 ©2011-2013 Basefount

Pipeline & Assets

We export V-Ray mesh by each agent for a time range. More specifically, each agent will exported to one V-Ray

Mesh file contains frame in timeline.

1. Drive agent by “single cache system” which use agent cache but drive only one agent

2. For each agent, we export selected objects for a range of time

The assets of V-Ray proxy is very simple, just a vrmesh file in target folder (specified in Render Global)

V-Ray Proxy assets

Under the hood

The proxy file will be automatically porting scene after creating, the MEL provided by V-Ray itself can

automatically link the shader for you.

V-Ray proxy shape nodes

Page 348: MiarmyManualForV2.0

Miarmy 2.0 Manual

348 ©2011-2013 Basefount

One proxy shape is linking to a single vrmesh file, but it can hold more than one meshes. Each mesh can link

against a shader, like the picture show below, it controlled by V-Ray material node

The structure of V-Ray mesh file

V-Ray proxy material node

Page 349: MiarmyManualForV2.0

Miarmy 2.0 Manual

349 ©2011-2013 Basefount

The render result

Replace Shader

We can replace shader for the V-Ray proxy without re exporting geometry again. Just select any shader and click

Miarmy > Other Renderers > V-Ray > Replace Shader

Replace Principle, Miarmy now only support:

multi materials to single material replacing (Lamber1, phone1, lamber3 etc -> occlusion shader)

single material to single material replacing (Occlusion shader -> normal shader)

So we suggestion exporting the color/beauty pass out and save as the file to different version for replacing

shader and render others passes

(Left) select shader (right) replace result

Page 350: MiarmyManualForV2.0

Miarmy 2.0 Manual

350 ©2011-2013 Basefount

Alembic Cache (Geometry Cache)

Alembic Cache Export

Alembic cache is a new and small geometry cache file format developed by Locus Film and Sony Imageworks.

Maya 2012 SAP and Later version of Maya support this directly. The extension name of this kind of cache is

“.abc”. In addition, this kind of cache can be read by Houdini and others 3D package in future.

For more information, please refer http://www.alembic.io/updates.html

Miarmy can export alembic cache for each agent in a range of time, more specifically, we export cache for:

One agent one “.abc” file,

Each “.abc” file contains many geometries

Each “.abc” file is a range of time, so the result “.abc” file will be the same number of agents

Before making Alembic Cache, we MUST create “agent cache” firstly. Because the system will read some

information from agent cache when creating Alembic Cache

Then we need specify where the .abc cache we want to put in. We need specify this in “Miarmy > Render

Global > Other Renderers Tab > Alembic Cache Setup”

Setup Alembic Cache Path and Name

Export cache

Page 351: MiarmyManualForV2.0

Miarmy 2.0 Manual

351 ©2011-2013 Basefount

Usage:

Create Alembic Cache: create alembic cache for all agents in scene (auto pass hidden one)

Import Alembic Cache: auto import all alembic cache based on the name exporting and the frame of

timeline

After exporting

Then, import the cache in scene, it can playback well:

Importing Alembic cache

Export FBX (See Character Cache)

Page 352: MiarmyManualForV2.0

Miarmy 2.0 Manual

352 ©2011-2013 Basefount

Bake Bone + Geometry

Bake to Bone Animation

User can easily bake agent to Maya joint characters using Miarmy Bake tool, this bake tool will firstly duplicate

the joints structure for each agent and them bake each one of them based on the agent animation.

Note: this tool need do the agent cache firstly.

This tool is useful when: sometimes we need refine the animation or geometry for specific actor in shot, and

want to bake them back to “real” character in Maya, and add some deformers or rigs or even fur/hair.

Bake tool GUI

Usage:

Bake Agents to Maya Actor (All): bake all agents in scene

Bake Agents to Maya Actor (Select): bake only selected agents

Baking result

Directly Get Simulation Data Using MEL/Python

Before Miarmy 1.5, you need read agent joint data through “agent match” and read data from original agent.

It’s really slow for production, now we provide a new approach which can read the data directly from agent:

Page 353: MiarmyManualForV2.0

Miarmy 2.0 Manual

353 ©2011-2013 Basefount

Please select the agent you want to read, then:

Run a Maya command “McdAgentMatchCmd -mm 3;” And this MEL will return an array,

For the returned array, the first and second element are <Agent ID> and <Agent TypeID>, with the agent type id

you can use it to find which agent group

Then the following data for each joint:

<tx> <ty><tz><rx><ry><rz><sx><st><sz><Custom Data Number><1st Custom Data>…<Nth Custom Data>

<tx> <ty><tz><rx><ry><rz><sx><st><sz><Custom Data Number><1st Custom Data>…<Nth Custom Data>

……

<tx> <ty><tz><rx><ry><rz><sx><st><sz><Custom Data Number><1st Custom Data>…<Nth Custom Data>

The “red” element is dynamically, means its number is based on “Custom Data Number”

The joint order is based on maya order:

The order of data in returned array is the same as Maya hierarchy

Page 354: MiarmyManualForV2.0

Miarmy 2.0 Manual

354 ©2011-2013 Basefount

Know the limitation:

Please notice, all the fetched data are represented in rotation order “XYZ” because our original agent is built in all XYZ order, if you want to change, please refer the following c++ code, it can help get the rotation value of others orders.

void McdSimpleCommand::rotOrderTest(){ // execute: 22 // for example: // we set 60, 60, 60 in XYZ order // we want to get rotate of XZY order: MTransformationMatrix::RotationOrder rotOrder = MTransformationMatrix::kXZY; double rotBuild[3] = { 60.0 * TO_RAD,

60.0 * TO_RAD, 60.0 * TO_RAD};

MTransformationMatrix testTMat; // we set 60 60 60 in XYZ order testTMat.setRotation(rotBuild, MTransformationMatrix::kXYZ); testTMat.reorderRotation(rotOrder); // reorder it to XZY double rotFetch[3]; testTMat.getRotation(rotFetch, rotOrder); // fetch out result in XZY // the result should be: // 3.694 // 73.886 // 25.665

}

Part 9 Optimization This part is a guide for optimizing and speeding up Miarmy in production.

Crowd simulation sometime is a heavy job, brings much uncomfortable frustration. So, the optimization is very

crucial for ease your job. In this guide, we are going to explain which part is low efficiency and introduce how to

avoid them or take alternative approaches. Also, we provide many useful methods may be faster or better to

achieve your same result. We hope this guild can help you to save a lot of your precious time.

Low Efficiency Channels Optimization

Vision

The vision channels have to parse out which agents in its range firstly and this process is exponential type of

calculation, therefore, in current version of Miarmy, vision channels are not very high efficiency.

There have some situation you may need vision:

2 armies facing together, seek enemies and fight when near

Follow a target agent or object. Avoid an agent or object.

Page 355: MiarmyManualForV2.0

Miarmy 2.0 Manual

355 ©2011-2013 Basefount

In the first situation, when 2 armies are involved in a battle, there are 2 phases. They are “Rush” and “Fight”

In the rush phase, 2 armies will rush each other, but only the front lines need higher AI for seeking enemies and

fight or collide, the rest of agents just need avoid each other. Checking out the following picture, the agents in

red bound need higher AI for seeking enemies and fight, whereas the agents in blue bound even don’t have

opportunity to fight. So we can use DDIM (Dynamic Decrease Intelligence Mechanism) to block the vision for the

agents in blue bound. It can tremendously accelerate your simulation speed.

Rush time, disable vision in blue bound

Or we can choose another solution. As the following picture shows, the pink and orange agents in frontlines will

have precise collide and fight logic, and the green and yellow agents just need using sound channels avoid each

other. This solution is better because you we can even simply the actions and Transition Map for lower AI agents.

And simply transition map can save your time.

Page 356: MiarmyManualForV2.0

Miarmy 2.0 Manual

356 ©2011-2013 Basefount

Rush time, pink and orange is higher AI agents whereas green and yellow agents has lower AI

In “Fight” Phase, the agents are near each other we can just use sound channels for detecting and aiming to

enemy and controlling fight. Here you can bypass the vision channel directly.

Battle in progressing, can totally disable vision

In the second situation, when the agents are following or avoiding something, we highly recommend make

agents to follow/avoid target using spot or zone. Following/avoiding spot or zone will be much faster than the

solutions with vision channel.

Page 357: MiarmyManualForV2.0

Miarmy 2.0 Manual

357 ©2011-2013 Basefount

Follow spot by spot channels

Future Solution: We are trying to use CUDA to make the calculation parallel in future, and we are still trying to

using more robust agent filter feature to speed up the vision calculation.

Collide Family Channel & Pre-build RBD Object

All the collide-family channels (like “collide”, “collideAny” and so on) will make the system create pre-build RBD

objects in agent memory because the collide-family channels are based on the PhysX RBD object.

5000 Agents in Maya by default (1.5 sec per frame calculate, sound + spot follow)

Page 358: MiarmyManualForV2.0

Miarmy 2.0 Manual

358 ©2011-2013 Basefount

5000 Agents in maya with collide-family channels (about 3 extra seconds for updating kinematic RBD in agent memory);

Yellow boxes are the pre-build RBD display by PhysX Debug Node

Collide Any Channel

The “collideAny” channel will check every bone of current agent, whereas the “collide” channel will only check

the flagged bones. So, if the agent contains 100 bones and 10 of them are flagged, “collideAny” channel will

spend 10 times of time than “collide” channel to calculate result.

“collideAt” channel has the fastest speed, because it only check one bone.“collideBy” channel has the same

efficiency with the “collide” channel.

Bounding Box Display Sometimes when there are too many agents your scene and the viewport is difficult to orbit, you can switch to

bounding box display.

(Left) bounding box display (right) agent segment display

Page 359: MiarmyManualForV2.0

Miarmy 2.0 Manual

359 ©2011-2013 Basefount

Solver Space If you make sure the agents in different area or floors will not interactive each other forever, you’d better

separate them in different solver space, it can save lot of time to calculate and easier to management.

If your agents are in different vehicles and the vehicles are moving each other, such like several battleships, you

should group them in different solver space.

Create solver space and put place node inside

Easy Transition Sometimes, using easy transition can same lot time for you.

Pre-vis

Simple shot, agents have each solo action, factory operator, walking crowd, etc…

Agents are far from camera will not been noticed by audience

Optimizing Crowd Dynamics With properly setup, Miarmy is able to support more than 5000 agents enable dynamics at the same time.

Using Spot or Zone Trigger Dynamic

Sometimes we need use a kinematic object like some cars/rocks to collide crowd agents. We suggest that you

use the zone/spot channels for activating dynamics instead of collide channels. Like the picture below, in the

“car” scenario. The green kinematic primitive is a child of that blue zone geometry plane. We use the “zone.in”

channel trigger dynamics active then the dynamics agents will naturally collide with the moving kinematic

primitive.

Use “zone.in” channel to trigger dynamics

Page 360: MiarmyManualForV2.0

Miarmy 2.0 Manual

360 ©2011-2013 Basefount

With the same theory, in the “rock” scenario, you need use “spot.d” or “bound.in” for triggering enable

dynamics, and there is a sphere kinematic primitive been a child of bound node.

Use “bound.in” channel to trigger dynamics

Mute Dynamics

On each agent, there is a “muteDynamic” attribute on it. Once we turn this on, the agent will never enable

dynamics and will not join the collision detection, the pre-build RBD object will never been created. In some

cases, using this feature properly, it will save tremendously amount of memory for you as well as speed your

simulation up.

Mute dynamics for the agent din blue bound and inverse placement

Page 361: MiarmyManualForV2.0

Miarmy 2.0 Manual

361 ©2011-2013 Basefount

For example, in the above picture, the car (green kinematic primitive) is hitting into the crowd agents. Some

agents (in the yellow bound range) will be enable dynamics and hit away. For improving the reality, we need

check collision for the nearby agents (in the blue bound range) hitting by the coming dynamic agents. If the

agents (in blue bound) hit by dynamic agents, the dynamics will be enabled. As we know, the agents will collide-

family channels will created pre-build RBD Object in memory. However, there are still lots of agent we don’t

want them to become dynamic ones, because they are far from the accident. We want to disable dynamic them

totally forever for saving memory and time. We need select them and enable “mute dynamic” attribute.

However, the attribute changes cannot be saved with scene, if the agents have been deleted and placed out

again, these attribute will change back. So, you need enable “muteDynamics” for these agents first and use

“inverse placement” to store these data to a new place node.

Aggregate Optimization

Aggregate is the latest feature of PhysX, it’s a mechanism can speed up the collision detection tremendously.

The More agents in scene, the more times you save.

In physical simulation, the rag dolls are consisted of a group of rigid bodies and dynamic constrains. The collision

detection in regular circumstance is based on each one of rigid body. Let’s make a very simple example:

There are 2 agents, each one contains 10 bones. If PhysX engine checks collide for them, they will check each

bone whether have collide others bone, so there should be 10 by 10 (divide 2) possible pair of collide need to

(10 * 10 / 2 = 50 times) check. But sometimes if there are several hundreds of agents, this process needs to be

simplified.

PhysX offer an aggregate mechanism:

Aggregate have 2 main features can speed up for above process:

Grouping for agent level: group all bones of one agent to an aggregate and assign it a bounding box, the

agent is the first level, and the bodies inside are second level. When checking collision, the rigid objects

will test that bounding box in first level, if collide against bounding box, it will go into for checking inner

bodies in second level.

Disable self-collision: all rigid bodies in one aggregate can disable collide each other and just leave the

dynamic constrains control the dynamics

In Miarmy since version 1.5, the aggregate will be default and automatically created when agents enable

dynamics (Notice: only available for the agents have less than 128 bones)

Let’s take a look at the following example:

When then rigid body check collide, it will firstly test the red bounding box then test the inner rigid bodies, the

bounding box is able to fit the size automatically.

Page 362: MiarmyManualForV2.0

Miarmy 2.0 Manual

362 ©2011-2013 Basefount

The arm in yellow circle will check bounding box and it collide one bonding box, then only check collide with the

bodies in bounding box.

The arm in green circle will only check collide with the bounding box, no further possible collide, just ignore it

The red bounding boxes are aggregates; it can dynamically fit the size

By default we disable the self-collide in aggregate. You need turn that on if you need it, in Physics Global

Page 363: MiarmyManualForV2.0

Miarmy 2.0 Manual

363 ©2011-2013 Basefount

Part 10 Expanding Guide This part is Undergoing, to be continued…

Scripts

Build your own logic Preset

Build your own channel Preset

Build your own automatic original agent setup pipeline

Build your own automatic action creation pipeline

Particle Express for Hybrid Dynamics Effects

Command Line Tasks

Many task of Miarmy can be done in batch mode or command line. That is means we can do our job without

open Maya, and this can save much time and memory of loading Maya editor and drawing OpenGL stuffs etc.

Also these command line task can be assigned to simulation/render farm and let the machines to do that

without human resource.

Command Line (Batch) for Developer

The users know MEL and Python can easily modify/create command line operations for any task run in batch

mode and extend the Miarmy capabilities.

Let us introduce how it works:

1. It need a MEL command which name is the same as the procedure name

Page 364: MiarmyManualForV2.0

Miarmy 2.0 Manual

364 ©2011-2013 Basefount

The MEL file start the command, the proc name same as file name

2. The McdBatchAgentCache is a wrapper will call McdBatchAgentCacheDoIt python command.

Initialize the python command in McdInitMiarmy.mel

3. In McdBatchAgentCacheDoIt() python command, we do what we need:

a. Place agent

b. Set to start frame

c. Playback everyframe

d. Do the task (exporting cache, rib, etc…)

4. Please check the script: “McdBatchAgentCacheDoIt.py”

At <Miarmy Directory>\Basefount\Miarmy1.5\maya\scripts

Page 365: MiarmyManualForV2.0

Miarmy 2.0 Manual

365 ©2011-2013 Basefount

API

Write your own Field Node

Render Fur

Use Miarmy Engine Drive Maya Character

Miarmy Reference

Callback Functions

After Load Miarmy

After loading Miarmy, system will run a script jot which name is “McdInitMiarmy”. If you don’t want to

automatically run this script, you need delete the contents from this file in you Miarmy installation place.

Before Save

Before saving, system will unhide original agent group nodes and all place nodes.

After Save

After saving, if agents have been placed out, system will hide original agent group nodes and all place

nodes.

Page 366: MiarmyManualForV2.0

Miarmy 2.0 Manual

366 ©2011-2013 Basefount

Selection Change

Update python window for selected relative nodes, for example you are editing decision, and once the

selected object changed, and if new select one is decision node ,the python GUI will be updated.

If your new selected object is agent, system will mark feedback agent to engine and recalculate, then

results will be put to Brain Viewer and Transition Map.

Before Duplicate

If there is any agent, place and road node in your duplicate list, they will be unselected before

duplicating and system will prompt out.

Reserved MEL Command There are some MEL commands which reserved:

Cloth The cloth feature of the NVIDIA PhysX SDK allows for simulation of items made from cloth, such as flags, clothing,

etc. This is accomplished by providing a mesh that is used to define a set of particles (vertices). The topology of

the mesh allows the SDK to construct constraints between the particles that mimic how cloth can bend and

stretch. In addition, cloth particles can be pinned to shapes and global positions, such as attaching a flag to a

pole.

Page 367: MiarmyManualForV2.0

Miarmy 2.0 Manual

367 ©2011-2013 Basefount

There are two main types of cloth constraints:

Stretching - applied to maintain distance between each particle that is connected by an edge in a cloth

mesh. The strength of this constraint is assigned using the SDK; specifying a small stretching constraint

factor allows the particles to move apart more easily and gives the impression of more stretchy cloth,

such as lycra. Specifying a larger constraint factor makes the cloth stiffer, like denim.

Bending - applied to maintain the angle along an edge in a cloth mesh, either by constraining the angle

directly or by constraining the distance between the pair of particles on either side of the edge (see the

diagram below). An example of a material that would use a low bending constraint for simulation is

cotton, while a substance such as paper or cardboard would use a high bending constraint.

Channel Reference List

Input Channels

Sound: see details in Part 5 sound session

sound.x

relative directions to others agent in horizontal

[-180, 180]

sound.y relative directions to others agent in vertical [-180, 180]

sound.d distances between others agent [0,

Page 368: MiarmyManualForV2.0

Miarmy 2.0 Manual

368 ©2011-2013 Basefount

sound]

sound.ox relative orientations to others agents in horizontal

[-180, 180]

sound.oy relative orientations to others agents in vertical

[-180, 180]

sound.f frequencies of agents in sound range [0, inf)

Vision: see details in Part 5 vision session

vision.x

relative directions to others agent in horizontal

[-180, 180]

vision.y relative directions to others agent in vertical [-180, 180]

vision.z distances between other agents (maya unit) [0, inf)

vision.h color ids of agents in vision range [-1, inf)

Road (indexing enable) See details in Part 5 Road

road.flow angle between agent Z-axis and the flow field

[-180, 180]

road.x agent position in the road [-1, 1]

road.ox angle between agent Z-axis and the road [-180, 180]

road[id].flow angle between agent Z-axis and the flow field <id>

[-180, 180]

road[id].x agent position in the road of which index is <id>

[-1, 1]

road[id].ox angle between Z-axis and the road whose index is <id>

[-180, 180]

lean Channels

lean.x

the projection of agent x axis to y axis of agent space

[-1, 1]

lean.y the projection of agent y axis to y axis of agent space

[-1, 1]

lean.z the projection of agent z axis to y axis of agent space

[-1, 1]

Terrain Channel

ground

test the distance to the terrain beanth the agent

(-inf, inf)

ground.dx test the degree between agent's x axis and terrain (tilt left/right)

[-90, 90]

ground.dz test the degree between agent's z axis and terrain (uphill or downhill)

[-90, 90]

Page 369: MiarmyManualForV2.0

Miarmy 2.0 Manual

369 ©2011-2013 Basefount

<bone>:ground test the distance to the terrain beanth the agent bone which name is <bone>

(-inf, inf)

Geometry Channels

geo.hi:<mesh>

similar as "ground" channel but test polygon mesh

(-inf, inf)

geo.dx:<mesh> similar as "ground.dx" but test polygon mesh [-90, 90]

geo.dz:<mesh> similar as "ground.dz" but test polygon mesh [-90, 90]

Move or Rotate Speed

tx move speed of translate x, per second (-inf, inf)

ty move speed of translate y, per second (-inf, inf)

tz move speed of translate z, per second (-inf, inf)

rx change rate of roate x in degree, per second (-inf, inf)

ry change rate of roate y in degree, per second (-inf, inf)

rz change rate of roate z in degree, per second (-inf, inf)

Moving speed

speed return the moving speed of agent [0, inf)

bound channels

bound.in whether in bound (-inf, 1]

bound[<id>].in whether in bound which id is <id> (-inf, 1]

Spot channels

spot.d the distances to the all spots [0, +inf)

spot.x the horizongtal degree related to all spots (-180, 180)

spot.y the verticle degree related to all spots (-180, 180)

spot[<id>].d the distances to the all spots which id are <id> (-inf, inf)

spot[<id>].x the horizongtal degree related to all spots which id are <id>

(-inf, inf)

spot[<id>].y the verticle degree related to all spots which id are <id>

(-inf, inf)

Zone (indexing enable)

zone.x

relative positions represented by angle in horizontal

[-180, 180]

zone.y relative positions represented by angle in vertical

[-180, 180]

Page 370: MiarmyManualForV2.0

Miarmy 2.0 Manual

370 ©2011-2013 Basefount

zone.in whether in area of zone 0 or 1

zone.hi height relative with zone (-inf, inf)

zone.d3d distances from agent to closest points [0, inf)

zone.d (or .d2d) distances from agent to closest points in XZ plane

[0, inf)

zone[id].x same as zone.x, only can feel zone whose index is <id>

[-180, 180]

zone[id].y same as zone.y, only can feel zone whose index is <id>

[-180, 180]

zone[id].in same as zone.in, only can feel zone whose index is <id>

0 or 1

zone[id].hi same as zong.hi, only can feel zone whose index is <id>

(-inf, inf)

zone[id].d3d same as zone.d3d, only can feel zone whose index is <id>

[0, inf)

zone[id].d (or .d2d) same as zone.d, only can feel zone whose index is <id>

[0, inf)

Follow Master

master.d the distance to the target point [0, +inf)

master.x the horizontal degree related to target point [-180, 180]

master.y the vertical degree related to target point [-180, 180]

Formation Target Point

ftp.d the distance to the master [0, +inf)

ftp.x the horizontal degree related to master

[-180, 180]

ftp.y the vertical degree related to master

[-180, 180]

Wind (work with composition of force field)

wind.ox

orientaion relative with composition of wind in horizontal space

[-180, 180]

wind.oy orientaion relative with composition of wind in vertical space

[-180, 180]

wind.a amplitude of composition of wind [0, inf)

Maya Field (work with composition of force field)

Page 371: MiarmyManualForV2.0

Miarmy 2.0 Manual

371 ©2011-2013 Basefount

field.ox orientaion relative with composition of fluid field in horizontal space

[-180, 180]

field.oy orientaion relative with composition of fluid field in vertical space

[-180, 180]

field.a amplitude of composition of fluid field [0, inf)

Maya fluid (work with composition of force field)

fluid.a amplitude of composition of fluid field

fluid.ox orientaion relative with composition of fluid field in horizontal space

[-180, 180]

fluid.oy orientaion relative with composition of fluid field in vertical space

[-180, 180]

MEL/Python Script

maya.mel:<mel cmd> run and test result of MEL command (-inf, +inf)

maya.py:<python cmd> run and test result of Python command (-inf, +inf)

Collision Detection

riCollide

check collide for flagged bone (reserve info if collide)

0 or 1

riCollideAt:<bone> check collide for bone whose name is <bone> (reserve info if collide)

0 or 1

riCollideBy:<bone> check whether the flagged bones collide by bone whose name is <bone> (reserve info if collide)

0 or 1

collide check collide for flagged bone 0 or 1

collideAt:<bone> check collide for bone whose name is <bone> 0 or 1

collideBy:<bone> check whether the flagged bones collide by bone whose name is <bone>

0 or 1

RBD Emitter

rbdCollide check RBD emitter emited object contact agent body

0 or 1

Noise

noise.id

return a random number based on the id of agent

(0, 1)

noise.id(<seed>) return a random number based on the id of agent, random again by seed

(0, 1)

Page 372: MiarmyManualForV2.0

Miarmy 2.0 Manual

372 ©2011-2013 Basefount

noise.g gradiently change a noise value (0, 1)

noise.g(<seed>) gradiently change a noise value (0, 1)

noise.time return a random number based on the time (0, 1)

noise.time(<seed>) return a random number based on the time and random again by seed

(0, 1)

noise.time(<seed>, <frequence>) return a random number based on the time and random again by seed and frequency

(0, 1)

noise_agent.time return a random number based on the time and agent id

(0, 1)

noise_agent.time(<seed>) return a random number based on the time and agent id , then random again by seed

(0, 1)

noise_agent.time(<seed>, <frequence>) return a random number based on the time and agent id , then random again by seed and frequency

(0, 1)

Sine Function

sin_all() return sine result based on time range [-1, 1]

sin_all(<freq>)

return sine result based on time range, use <freq> control the cycle period

[-1, 1]

sin_agent()

return sine result based on time range, offset random sine phase by agent id

[-1, 1]

sin_agent(<freq>)

return sine result based on time range, offset random sine phase by agent id, <freq> change period

[-1, 1]

Timer Channels

timer from 0 increase by second, and return 0 if reach 1

(0, 1)

timer(<sd>) from 0.x increase by second, and return 0 if reach 1

(0, 1)

timer(<sd>, <freq>) from 0.x increase by <freq> * second, and return 0 if reach 1

(0, 1)

timer.bf from 0 increase by second, when reach to 1, decrease by second. Back and forth

(0, 1)

timer.bf(<sd>) from 0.x increase by second, when reach to 1, decrease by second. Back and forth

(0, 1)

timer.bf(<sd>, <freq>) from 0.x increase by second * <freq>, when reach to 1, decrease by second. Back and forth

(0, 1)

timer_agent same as timer, random start value by agent id (0, 1)

timer_agent(<sd>) same as timer(<sd>), random start value by agent id

(0, 1)

Page 373: MiarmyManualForV2.0

Miarmy 2.0 Manual

373 ©2011-2013 Basefount

timer_agent(<sd>, <freq>) same as timer(<sd>, <freq>), random start value by agent id

(0, 1)

timer_agent.bf same as timer.bf, random start value by agent id

(0, 1)

timer_agent.bf(<sd>) same as timer.bf(<sd>), random start value by agent id

(0, 1)

timer_agent.bf(<sd>, <freq>) same as timer.bf(<sd>, <freq>), random start value by agent id

(0, 1)

id

id.agent return agent id [0, +inf)

id.type return agent type id [0, +inf)

id.place return place node id which place this agent [0, +inf)

id.inPlace return agent id in place node [0, +inf)

Self-Variable

hp get hp value from agent memory (-inf, inf)

mp get hp value from agent memory (-inf, inf)

Scene Info

frame get current frame [0, inf)

goFrame get frame number since simulation start [0, inf)

Action

<actionName>

return true if the current playback action is <actionName>

0 or 1

actionGroup:<Group> return true if the current playback action belongs to action group <Group>

0 or 1

Traffic Channels

traffic.x

the distance from the internal path of crossroad

[0, +inf)

traffic.ox the degree ralated to internal path of crossroad

(-180, 180)

traffic.green whether meet green light in crossroad light zone

0 or 1

traffic.enter whether enter of exit the crossroad 0 or 1

Output Channels

Sound

Page 374: MiarmyManualForV2.0

Miarmy 2.0 Manual

374 ©2011-2013 Basefount

sound.f set the frequency of agent sound

sound.a set the range of agent sound

Vision color set color of agent (if -1, others cannnot see it)

Move or Rotate Speed

tx move speed of translate x, per second (-inf, inf)

ty move speed of translate y, per second (-inf, inf)

tz move speed of translate z, per second (-inf, inf)

rx change rate of roate x in degree, per second (-inf, inf)

ry change rate of roate y in degree, per second (-inf, inf)

rz change rate of roate z in degree, per second (-inf, inf)

Aiming

<bone>:aim<axis><upVector><space>(<percent>)-><target>

percent aim to target, see aiming session (0, 1)

<bone>:aim<axis><upVector><space>-><target> 100% aim to target, see aiming session (0, 1)

Self-Variable

hp

set hp value or hp change rate (in change rate mode)

(-inf, inf)

mp set mp value or mp change rate (in change rate mode)

(-inf, inf)

hp.set set hp value (in both mode) (-inf, inf)

mp.set set mp value (in both mode) (-inf, inf)

DDIM 1.0 (Dynamically Decrease Intelligence Mechanism 1.0)

vision.mute

disable vision for itself and also let others cannot see this agent

[1]

sound.mute disable sound for itself and also let others cannot feel this agent by sound

[1]

Ragdoll

dynamics.active enable full body ragdoll [1]

dynamics.active.force enable full body ragdoll and apply a pulse force from collide reserved info

[0, inf)

Page 375: MiarmyManualForV2.0

Miarmy 2.0 Manual

375 ©2011-2013 Basefount

bodyDynamics.active enable body dynamics with root bone kinematic control

[1]

<boneName>:dynamics.active enable dynamic from boneName [1]

<boneName>:dynamics.detach enable dynamic from boneName and break joint

[1]

Action

<actionName> trigger actioin [0, inf)

<actionName>:rate modify action rate if this action playing back [0, inf)

*:rate modify all action rate in scene playback speed rate

[0, 1]

actionGroup:<group> trigger one of action in action group <grou> randomly

[0, 1]

actionGroupSelect:<group> select one in action group <group>, and playback selected one all the time, play cycle

[0, 1]

actionGroupRate:<group> change the playback speed rate for all actions in action group <group>

[0, inf)

actionBlend

blend-><actionName>

Blend <actionName> to the linked actioin in Transition Map

[0, inf)

blend->blendGroup:<group> Blend each action which belongs to <group> to each linked action in Transition Map

[0, inf)

Bone Offset

<boneName>:tx set the translate X in bone offset (-inf, inf)

<boneName>:ty set the translate Y in bone offset (-inf, inf)

<boneName>:tz set the translate Z in bone offset (-inf, inf)

<boneName>:rx set the rotate X in bone offset (-inf, inf)

<boneName>:ry set the rotate Y in bone offset (-inf, inf)

<boneName>:rz set the rotate Z in bone offset (-inf, inf)

MEL/Python Script

maya.mel:<mel cmd> run MEL command [0, +inf)

maya.py:<python cmd> run Python command [0, +inf)

Action Pair Sync

tell tell other what action this agent perform [0, +inf)

hear hear and perform the sync action [0, +inf)

Page 376: MiarmyManualForV2.0

Miarmy 2.0 Manual

376 ©2011-2013 Basefount

tell:<channel> tell other what action this agent perform, channle is X

[0, +inf)

hear:<channel> hear and perform the sync action, only can hear agent channel is X

[0, +inf)

parenting

parent:<object>

parent agent to the object which name is <object>

0 or 1

parent:0 parent agent to the world space 0 or 1

IK Channels

<boneName>:ik.xOffset move the ik end effector <boneName> along x axis by offset

(-inf, inf)

<boneName>:ik.yOffset move the ik end effector <boneName> along y axis by offset

(-inf, inf)

<boneName>:ik.zOffset move the ik end effector <boneName> along z axis by offset

(-inf, inf)

<boneName>:ik.tx set the ik end effector on <boneName> translate X to a value

(-inf, inf)

<boneName>:ik.ty set the ik end effector on <boneName> translate Y to a value

(-inf, inf)

<boneName>:ik.tz set the ik end effector on <boneName> translate Z to a value

(-inf, inf)