Skip to content

OpticalFlow

in Lib.image.analyze

Implements an optical flow effect that generates a motion vector field, which can be used to drive particle effects. The effect requires successive image frames as input, which can be generated by using [KeepPreviousFrame]. The motion vectors are stored in the red and green channels of the result. The blue channel is used for the magnitude of the detected motion. Parameters: OutputMethod: Switch between grayscale (neutral values: R 0.5, G 0.5, B 0) or signed (with ranges from -1 to 1). Amount: Controls the magnitude of the detected motion. Lod: Specifies which MipMap level of the input textures should be sampled. This results in a blurring of the effect. ClampRange: Can be used to clamp and normalize the results, preventing values from becoming too small or excessively large. The shader implements the Lucas-Kanade flow algorithm: https://en.wikipedia.org/wiki/Lucas%E2%80%93Kanade_method It builds upon a previous shader implementation by mds2 on Shadertoy: https://www.shadertoy.com/view/XlBcRV Also check the example.

Input Parameters

Name (Relevancy & Type) Description
Image (Texture2D Required)
Image2 (Texture2D Required)
Lod (Single)
VisualizeResult (Boolean)
VisualizationScale (Single)
Amount (Single)
ClampRange (Vector2)
OutputMethod (Int32)

Outputs

Name Type
TextureOutput T3.Core.DataTypes.Texture2D