Table of Contents

Class GPUVideoEffectDirectionalBlur

Namespace
VisioForge.Core.Types.VideoEffects
Assembly
VisioForge.Core.dll

GPU-accelerated directional motion blur effect that creates linear blur along a specified angle using DirectX hardware acceleration.

public class GPUVideoEffectDirectionalBlur : GPUVideoEffect, IGPUVideoEffectDirectionalBlur, IGPUVideoEffect

Inheritance

Implements

Inherited Members

Remarks

Available in: VideoCaptureCore, MediaPlayerCore, VideoEditCore (Windows only)

GPU-accelerated version using DirectX. Real-time processing with hardware acceleration for efficient directional blur on high-resolution video. Significantly faster than CPU-based blur algorithms, making it suitable for creative effects in live video production, real-time editing preview, and 4K/8K content where CPU processing would be too slow.

Directional blur simulates motion blur along a specific direction, creating streaking or smearing effects that convey movement, speed, or energy. Unlike standard blur (which blurs equally in all directions) or radial blur (which blurs from a center point), directional blur applies linear motion along a specified angle. This creates effects similar to camera panning, fast-moving objects leaving trails, or artistic interpretations of velocity and dynamics.

The GPU implementation uses optimized texture sampling along the blur direction vector. The DirectX shader samples multiple points along the specified angle for each pixel, accumulating and averaging color values to create the blur trail. The parallel execution on GPU allows many samples per pixel without performance penalty, producing smooth, high-quality directional blur at real-time framerates. The amount parameter controls sample count and spacing, while angle determines the direction vector for sampling.

Common applications:

  • Creating motion blur effects to suggest speed or movement in action sequences
  • Simulating camera pan blur for dynamic camera movements in post-production
  • Adding energy and dynamism to static scenes through directional streaking
  • Creating artistic effects with controlled blur direction for creative video projects
  • Enhancing title sequences or transitions with directional motion effects
  • Simulating wind or movement effects in visual effects composition

Technical implementation: The shader calculates a direction vector from the angle parameter and samples texture coordinates along this vector at regular intervals. The number of samples increases with the amount parameter, creating more pronounced blur. Each sample is weighted equally and accumulated, then normalized to produce the final blurred pixel. This technique, known as box filtering along a direction, produces predictable and controllable directional blur effects. The GPU's parallel texture sampling capabilities make this multi-sample approach practical for real-time use.

Performance characteristics: GPU directional blur typically processes full HD (1920x1080) at 60fps with moderate blur amounts (20-40) and at 30fps+ with heavy blur (60-100). 4K resolution maintains 30fps with moderate settings on modern graphics cards. Performance scales with blur amount as more texture samples are required per pixel. The effect requires texture memory for multi-sampling but maintains minimal GPU memory overhead. Suitable for real-time creative applications, live effects, and interactive editing with instant preview.

Parameter tuning guidelines: Start with low to moderate amounts (10-30) for subtle motion blur effects. Higher amounts (50-100) create dramatic streaking suitable for stylized or artistic effects. The angle parameter uses standard degree notation where 0° is horizontal right, 90° is vertical up, 180° is horizontal left, and 270° is vertical down. Negative angles are supported and equivalent to their positive counterparts (e.g., -90° = 270°). Adjust angle to match the intended direction of motion or desired artistic effect. Combine with other effects for complex visual results.

Constructors

GPUVideoEffectDirectionalBlur(bool, int, int, string, TimeSpan, TimeSpan)

Initializes a new instance of the VisioForge.Core.Types.VideoEffects.GPUVideoEffectDirectionalBlur class with GPU-accelerated directional blur.

public GPUVideoEffectDirectionalBlur(bool enabled, int amount, int angle, string name = "DirectionalBlur", TimeSpan startTime = default, TimeSpan stopTime = default)

Parameters

enabled bool

true to enable the GPU effect immediately; false to create the effect in a disabled state. The effect can be toggled on/off at any time without GPU resource reallocation overhead.

amount int

The blur strength and length (0-100). Higher values create longer, more pronounced blur trails. Start with 20-30 for moderate effects; use 50+ for dramatic stylized blur. 0 disables the effect.

angle int

The blur direction angle in degrees (-360 to 360). 0° is horizontal right, 90° is vertical up, 180° is horizontal left, 270° (or -90°) is vertical down. Determines the direction of motion blur.

name string

An optional name identifier for this effect instance. Default is "DirectionalBlur". Used to retrieve and control specific effect instances from the GPU effects collection. Multiple directional blur effects can be stacked with different angles for complex motion effects.

startTime TimeSpan

The time at which the effect should start being applied. Default is zero (from beginning). Useful for applying directional blur only to specific segments, such as action sequences or transitions.

stopTime TimeSpan

The time at which the effect should stop being applied. Default is zero (until end). Combined with startTime, allows time-limited directional blur for specific scenes.

Remarks

The GPU-accelerated implementation processes directional blur entirely on the GPU using DirectX compute shaders, ensuring real-time performance with minimal CPU usage. Multi-sample texture reads along the blur direction vector are executed in parallel across all pixels, achieving consistent framerates even with high blur amounts.

Requires DirectX-compatible GPU with shader model 3.0 or higher. Automatically falls back to CPU processing if GPU is unavailable, though performance will be significantly reduced. For live production or real-time creative applications, verify GPU availability before enabling this effect.

Performance tip: Blur amount significantly impacts processing time. For real-time applications at high resolutions (4K+), keep amount below 50 for optimal performance. Lower resolutions (1080p) can handle higher amounts (up to 80-100) while maintaining real-time framerates. Monitor GPU utilization if combining multiple effects.

Properties

Amount

Gets or sets the blur amount controlling the strength and length of the directional blur effect.

public int Amount { get; set; }

Property Value

int

Remarks

The amount parameter controls both the blur strength and the visual length of the blur trail:

  • 0: No blur (effect disabled, original image)
  • 1-10: Minimal blur (subtle motion suggestion, barely visible)
  • 10-30: Light blur (gentle motion blur, suitable for subtle effects)
  • 30-50: Moderate blur (noticeable motion trails, balanced effect strength)
  • 50-70: Heavy blur (strong motion blur, pronounced streaking)
  • 70-100: Extreme blur (dramatic stylized effect, maximum streak length)

Higher values increase the number of texture samples and the distance sampled along the blur direction, creating longer blur trails. Performance decreases with higher amounts due to increased texture sampling requirements. The GPU shader adjusts sample count dynamically based on this value to balance quality and speed.

Changes to this property take effect immediately in the next rendered frame, allowing real-time adjustment during preview or live production.

Angle

Gets or sets the blur angle in degrees, determining the direction of the linear blur effect.

public int Angle { get; set; }

Property Value

int

Remarks

The angle defines the direction vector along which blur is applied, using standard degree notation:

  • 0°: Horizontal blur to the right
  • 45°: Diagonal blur toward upper-right
  • 90°: Vertical blur upward
  • 135°: Diagonal blur toward upper-left
  • 180° (or -180°): Horizontal blur to the left
  • -90° (or 270°): Vertical blur downward

Negative angles are fully supported and equivalent to their positive counterparts minus 360°. For example, -90° equals 270°, both producing downward vertical blur. The valid range is -360 to 360 degrees, though values repeat every 360° (e.g., 390° is equivalent to 30°).

The angle determines the direction of motion simulation. For example, use 0° for left-to-right panning effects, 90° for bottom-to-top rising effects, or any arbitrary angle for custom directional motion. Changes to this property take effect immediately in the next rendered frame.

Methods

GetEffectType()

Gets the specific GPU effect type identifier for this directional blur effect.

public GPUVideoEffectType GetEffectType()

Returns

GPUVideoEffectType

Returns VisioForge.Core.Types.VideoEffects.GPUVideoEffectType.DirectionalBlur to identify this as a GPU-accelerated directional motion blur effect.

Remarks

This method is used by the GPU video processing pipeline to route the effect to the appropriate DirectX shader processor for hardware-accelerated directional blur with linear motion simulation.