Skip to content

Getting started

Matt Dean edited this page Feb 2, 2020 · 2 revisions

BACK > Home


Welcome to kMotion!

This page explains how to get started using kMotion in your project.

Installing kMotion

kMotion is a package. Using this tool requires manual modification of your project's package manifest.

  • Open your project manifest file (MyProject/Packages/manifest.json).
  • Add "com.kink3d.motion": "https://github.com/Kink3d/kMotion.git" to the dependencies list.
  • Open or focus on Unity Editor to resolve packages.

Setting up kMotion

alt text Adding the MotionRendererFeature.

kMotion uses the Universal Render Pipeline's ScriptableRenderFeature system for rendering. To start using kMotion add a MotionRendererFeature to the active Universal Render Pipeline Renderer.

NOTE: This step is required for rendering motion vectors and/or motion blur. If you do not add a Motion Blur Volume Component to any active Volume Profile then motion blur will not be calculated or rendered. If you do not wish to use motion blur, and are just trying to access motion vectors for your own temporal effects, see Custom Temporal Effects.

Adding Motion Blur

alt text

Setting up the Volume Profile.

Motion Blur can be added to your scene by adding a Motion Blur Volume Component to any active Volume Profile. First create a new Volume Profile (Assets > Create > Volume Profile). On the profile click Add Override and select kMotion/Motion Blur. This will add a Motion Blur Volume Component to the Volume Profile. For Motion Blur to be considered active its Intensity value must be more than 0. Enable the override with the toggle on the left side of the override property and then set its value to anything higher than 0.

alt text

Applying the Volume Profile to a Volume.

Next we need to add a Volume to the scene. You can do this selecting creating a Volume object directly in the Hierarchy (Hierarchy > Create > Volume > Global Volume) or by adding a Volume component to any GameObject (Add Component > Miscellaneous > Volume). Next assign the Volume Profile you just made to the Profile property on the Volume component. When entering play mode you should now see motion blur.

Motion Blur

alt text

Motion Blur volume component.

The Motion Blur Volume Component adds motion blur to a Volume Profile. When this Volume Component is active in the scene's Volume stack it will enable rendering of motion blur. This Volume Component also contains settings for the motion blur effect. For more information see How it works.

Quality - The quality of the effect. Lower presets will result in better performance at the expense of visual quality.

Intensity - The strength of the motion blur filter. Acts as a multiplier for velocities.

Custom Temporal Effects

To use the motion vectors generated by kMotion to create custom temporal effects simply define and sample the global texture value _MotionVectorTexture. This texture is of type RGHalf, therefore only the red and green channels contain velocity data. This texture is generated at the render pass event AfterRenderingOpaques. To access velocity data you must sample the texture after this event.