Class GPUVideoEffectDarkness
- Namespace
- VisioForge.Core.Types.VideoEffects
- Assembly
- VisioForge.Core.dll
GPU-accelerated darkness adjustment effect that controls overall video luminance with inverse brightness behavior using DirectX hardware acceleration.
public class GPUVideoEffectDarkness : GPUVideoEffect, IGPUVideoEffectDarkness, IGPUVideoEffectInheritance
Implements
Inherited Members
Remarks
Available in: VideoCaptureCore, MediaPlayerCore, VideoEditCore (Windows only)
GPU-accelerated version using DirectX. Significantly faster than CPU equivalent for real-time processing of high-resolution video streams.
The darkness effect uniformly adjusts the luminance of all pixels by subtracting a value from RGB color components. A value of 0 adds and subtracts nothing; the image approaches black as the value grows to 255. The effect operates per-pixel using DirectX compute shaders, enabling real-time processing with minimal CPU overhead even at 4K resolutions.
Common use cases include: creating fade-to-black transitions, simulating night or low-light scenes, darkening overexposed footage, creating silhouette effects, mood adjustment for dramatic or horror scenes, compensating for overly bright source material, preparing footage for overlay compositing, and creating vignette effects when combined with masks. The effect is particularly useful for cinematic fade effects and day-to-night transitions.
Performance characteristics: GPU acceleration provides near-zero overhead, processing full 4K frames in under 1ms on modern GPUs. The operation is memory-bandwidth limited rather than compute-limited, making it one of the most efficient video effects. Can be combined with other effects without significant performance impact. Ideal for real-time fade effects during live streaming or playback.
Technical notes: The darkness formula is effectively the inverse of brightness: while brightness adds values to RGB components, darkness subtracts them. Extreme values clip detail: as every channel drops toward black, shadows and then midtones are crushed. For animated fade effects, vary the darkness value over time. Often combined with contrast adjustment to maintain tonal separation while darkening. The effect operates in RGB space with uniform adjustment across all color channels.
Cross-reference to CPU equivalent: See VisioForge.Core.Types.VideoEffects.VideoEffectDarkness for CPU-based alternative with animation support via ValueStop property.
Constructors
GPUVideoEffectDarkness(bool, int, string, TimeSpan, TimeSpan)
Initializes a new instance of the VisioForge.Core.Types.VideoEffects.GPUVideoEffectDarkness class with specified parameters.
public GPUVideoEffectDarkness(bool enabled, int value, string name = "Darkness", TimeSpan startTime = default, TimeSpan stopTime = default)Parameters
enabledbool-
Whether the effect is enabled. Set to
trueto apply immediately,falseto create in disabled state. valueint-
Darkness adjustment value (0-255, 0 = no change). Each channel loses value / 255; 255 produces a black image.
namestring-
Optional effect name for identification and retrieval. Default is "Darkness".
startTimeTimeSpan-
Start time for timed effects. Default is zero (apply from beginning).
stopTimeTimeSpan-
Stop time for timed effects. Default is zero (apply until end).
Remarks
When both start and stop times are zero, the effect applies for the entire video duration. The effect type is automatically set to VisioForge.Core.Types.VideoEffects.GPUVideoEffectType.Darkness. For a fade to black, raise the value from 0 toward 255 over time.
Properties
Value
Gets or sets the darkness adjustment value (0-255, 0 = no change).
public int Value { get; set; }Property Value
Remarks
Controls the luminance reduction applied uniformly to all pixels: value / 255 is subtracted from each RGB channel. A value of 0 represents no change; the image approaches black as the value grows to 255.
Value ranges: 0 = No change, 1-127 = Mild to moderate darkening, 128 = Half-way to black, 200-254 = Strong darkening, 255 = Black image. High values clip detail in shadows.
Methods
GetEffectType()
Gets the specific type of this GPU video effect.
public GPUVideoEffectType GetEffectType()Returns
- GPUVideoEffectType
-
Returns VisioForge.Core.Types.VideoEffects.GPUVideoEffectType.Darkness to identify this as a GPU-accelerated darkness effect.
Remarks
Used by the video processing pipeline to select the appropriate DirectX shader for darkness adjustment processing.