Mapper & Reducer
This document is an advanced document on the Mapper and Reducer.
Last updated
This document is an advanced document on the Mapper and Reducer.
Last updated
Let's think of the motion adapter for a joint anchor template. In the mocap pipeline of MYTY Kit, The template provides rotation information composed of two vectors - LookAt and Up. Most tasks for this motion adapter simply convey the vectors' partial or whole components. For example, If we want to control the 2D rotation of the head in the XY plane, we should set the motion adapter to convey XY components of the LookAt vector to the input of the Bone2DController, which governs the head movement.
We are saying the action of the motion adapter is 'conveying.' It implies a relation between the sender and the receiver of the conveyed property, and we call this relation 'Mapping' and call the motion adapter 'Mapper.'
In the Mapper, we set up the mapping information from a component of one of the rotation vectors for the joint template rotation to a component of the Controller input. The captured rotation value will be conveyed via this predefined pipeline in runtime.
The Mapper is valid for parametric templates (ex. facial), too. We can map a template property to a component of the target Controller input.
Let's think of the case like this; 'I want to move the eye object by the averaged value of the pupils' position.' In this situation, the task of the motion adapter is not mapping anymore. The mapping implies a relation of 1:1, but we need a 2:1 relation to resolve this.
We can generalize this situation like this. ‘Do something with N values and yield a result.’ It means, we want to ‘Reduce’ the input value to a result. So we call this ‘Reducer.’
You may have a question, ‘How to reduce the inputs?’ We introduce ‘Reduce Operator’ to cover this question. Reduce Operator describes how to reduce inputs. A reducer can have one or more reducers as its output count. We provide 2 operators in default - Linear Combination and Component Product. The new operator can be added in later kit updates.
Linear Combination: Calculate the linear combination of the inputs. Weights, scale, and offset are given. This takes Vector3 as input and calculates the output component-wise.
Component Product: Calculate the product of the inputs. Exponents and scale are given.
For the anchor template, we don’t provide Reducer because we cannot figure out the usage of reducers for it. For the parametric and points template, we provide only a reducer because the mapper is a specialization of the reducer (linear combination of input with weight 1.0).
In Kit v1.0, the component-wise input for the Controller is enabled. Each adapter has a list of configurations, which specifies the input component of the target Controller. It enables a flexible setting of Controllers and motion adapters like visual scripting. An adapter can have several Controllers as an output sink.