Unity Products:Amplify motion/Manual

From Amplify Creations Wiki
Jump to: navigation, search

Installation

1. Open AmplifyMotion###.unitypackage

2. After Unity loads it will display the “Importing package” window, select All and click Import

3. Amplify Motion should now be installed in your Unity project and it should have the following directory structure:

YourProject\Assets\AmplifyMotion\ YourProject\Assets\AmplifyMotion\Plugins YourProject\Assets\AmplifyMotion\Resources

Workflow Overview

1. Select and apply “Image Effects/Amplify Motion” to your main camera

TutMotion.jpg

2. Adjust “Quality Steps”, “Motion Scale” and “Max Velocity” to fit your needs

TutMotion2.jpg

3. When using overlay objects using secondary cameras (e.g. first-person shooter), simply add the camera to the list of “Overlay Cameras”. That way both the primary, and secondary cameras will get proper motion blur, as expected.

Am1.jpg

Quality Level

  • From lighter to heavier, options range from a highly optimized Mobile mode to a Standard Shader Model 2/3 or Soft Edge algorithm. The methods used are constantly being optimized and updated, the Standard mode is recommended for most cases.

Auto Register Objs

  • When toggled AM will automatically add the Amplify Motion Object script to your Assets, check section 3 (Dynamic Objects Instantiated at Runtime) for additional information.

Overlay Cameras

  • Useful for complex camera setups or FPS application with custom view-models, check section 5 (Overlay Cameras & UI) for additional information.

Culling Masks

  • As the name hints Mask usage allows users to define which Assets will display the motion effect.

Quality Steps

  • Defines the number of samples used, higher values will result in smoother blur. Do note that this value directly impacts performance, although higher values can be used we recommend using a 1-3 range.

Motion Scale

  • This value defines the scale of the actual motion effect, it’s a great way to tweak the amount of motion blur without tinkering with Velocity values.

Camera Motion Multiplier

  • By setting it to zero users can eliminate the blur generated from camera movement whilst maintaining object based motion blur. Camera blur can also be exaggerated by using higher values.

Minimum Velocity

  • This value defines the minimum velocity an object should have in order to be taken into account by the motion effect.

Maximum Velocity

  • This value defines the maximum object velocity taken into account by the motion effect. Velocity values are directly link to the amount of motion blur displayed.

Depth Threshold

  • As the name hints this value defines a Depth Threshold the motion blur effect, it’s useful when it comes to avoiding having objects leaking into the background due to camera movement. Use small increments, the value is within the 0-1 range.

Work Threads

  • Defines the number of threads dedicated to Skinned Assets such as characters or similar models. When set to zero it will use half the hardware threads available, a value of 1 should be sufficient for most cases.

System Thread Pool

  • When toggled Amplify Motion will use the Unity Thread Pool instead of its own, this is useful in order to avoid issues on specific devices such as consoles. As of version 1.5 if the AM custom thread pool fails to initialize AM will automatically fallback to the System Thread Pool.

Debug Mode

  • Toggle this option to see the motion vectors in action, it’s a great way to tweak your scene and identify possible problems.

Dynamic Objects Instantiated at Runtime

Amplify Motion works by adding a special script to all non-static objects. To enable Motion Blur on non-static objects instantiated at runtime, you have two options:

A. A static method, best performing. Scripts are added at edit time:

Add a “Image Effects/Amplify Motion Object” component to any object that has a valid MeshRenderer, SkinnedMeshRenderer or ClothRenderer.
In addition, you can disable “Auto Register Objs” in the Amplify Motion camera component to avoid any startup lag caused by searching for valid objects and adding scripts.

B. A dynamic method, more convenient. Scripts are added at runtime:

Add “Image Effects/Amplify Motion Object” component to the root object and enable “Apply To Children”. It will automatically add any children, recursively, at runtime during object initialization.
OR
Simply call AmplifyMotionEffect.Instance.Register( obj ) on each new object:

// Instantiates 10 copies of prefab each 2 units apart from each other

for ( var i : int = 0; i < 10; i++ ) {
GameObject obj = Instantiate( prefab, Vector3( i * 2f, 0, 0 ), Quaternion.identity );
AmplifyMotionEffect.Instance.Register( obj ); // same for C#

}

An easier, yet more expensive, alternative is also available. Simply call AmplifyMotionEffect.Instance.UpdateActiveObjects() after instantiating all the objects.

// Instantiates 10 copies of prefab each 2 units apart from each other

for ( var i : int = 0; i < 10; i++ )
GameObject obj = Instantiate( prefab, Vector3( i * 2f, 0, 0 ), Quaternion.identity );
AmplifyMotionEffect.Instance.UpdateActiveObjects(); // same for C#

Overlay Cameras & Excluding Assets

Overlay cameras allow you to associate additional cameras without the need to add extra AM camera components. It’s usually used for FPS games where the FOV of the game view is different from the actual weapon camera.

1. Add the visible model to a new layer, in this example we used the “Weapons” layer.

TutMotionOver1.jpg

2. To create the second camera duplicate your main camera or create a new camera and adjust the Position/Rotation and FOV manually. Attach the secondary camera to your main camera(Parent to the main camera). In the secondary camera set the Clear Flag to Depth only or Don’t clear and the Culling Mask to “Weapons” only, or any another layers that you might need to use; be sure to remove all unnecessary components.

TutMotionOver2.jpg

3. In the main camera with the Amplify Motion Effect applied, add the secondary camera to the Overlay Camera array; you can use more than one camera if necessary. Be sure to remove the “Weapons” layer from your main Camera Culling Mask options.

TutMotionOver3.jpg

If you experience motion blur related issues in your UI elements consider using a secondary camera to render all UI components separately.

1. Create a second camera, remove any unneeded components keeping only the Camera and GUI Layer component. In the camera culling mask options select only the layer(s) that contain your UI elements, in this case we selected the UI layer.

TutMotionUI1.jpg

2. In your main camera, remove the GUI Layer component and exclude the UI layer in the camera culling mask options.

TutMotionUI2.jpg

From simple 3d planes to fully animated characters, you can exclude any AM compatible asset. Be sure that excluded assets have the Amplify Motion Obj script in their component list. You can learn more about asset exclusion in the second Amplify Motion tutorial.

Technical Considerations

1. Be sure to enable the Read/Write option on Skinned and Cloth models.

2. “Motion Scale” defines the distance scale for the directional blur, disproportional/extreme values might result in inconsistent motion blur issues.

3. Transparent/Alpha-blended are not directly supported. Transparent surfaces will be blurred according to the vectors defined by the opaque or coverage/alpha-test surfaces below them.

4. At the moment the “Optimize Game Objects” option in the Rig tab of the object inspector is not supported. Since the vertex information is not made available by Unity the motion effect cannot be applied.

Rig.png

5. Cloth tearing motion blur is currently unsupported.

6. For accurate results the Amplify Motion Object component should be applied to moving/dynamic objects, regardless if they are included or excluded from the MB effect. Although lightweight each dynamic object does have an associated cost, not adding the AM Object script to slow moving objects is a completely acceptable option. Slow moving animated models such as plants or trees will work great with just Camera Blur and the performance boost will be noticeable, especially on older or weaker devices.

Do note that excluded objects should have the AM Object script applied, e.g. Skybox Model.

Threshold Value

Under specific circumstances the blur effect on dynamic objects might “bleed” into background objects resulting in visual artifacts such as the character feet example below. The threshold value is directly tied to Near & Far Camera Clip values, low Near Clip values such as 0.03 (default) or lower tend to be problematic; we recommend values of 0.10-0.20 or higher. If raising the Near Clip value is not an option for your particular project try using a lower Threshold value such as 0.001 or lower.

High Motion Scale and Max Velocity values could also be problematic on some setups, setting the Threshold value to 0 will maintain dynamic object motion blur whilst removing background Blend/Bleed blur effect.

bleed.jpg

Stuttering

Although most rigidbody blur issues can be resolved by enabling interpolation, we recommend checking the article bellow. It’s a great reference that will likely help you fix most of your issues, not only Amplify Motion related.

Timesteps and Achieving Smooth Motion in Unity

Warnings & Error handling

1. Skin/Bone related warnings: Check you model for invalid bones and make sure the “Optimize Game Objects” option in the Rig tab of the object inspector is disabled.

2. [AmplifyMotion] Invalid object type: Amplify Motion currently does not support object motion blur on Particles, only camera blur will be visible.