Let me examine the rendering pipeline to explain the exact order of effects.
Based on my examination of the shader code, here's the rendering order explained like Photoshop layers (from bottom to top):
Layer Stack (Bottom → Top)
🎬 BASE LAYERS (Video/Image Content)
- Layer 1 - Main Media (bottom-most)
- Your primary video or image
- With time offset applied (if duplicate layer enabled)
- Levels Adjustment (on Layer 1)
- Input/output black/white points
- Gamma correction
- Applied per RGB channel
- Pattern Overlay (on Layer 1)
- Tiled pattern texture
- Blend modes: Normal, Multiply, Screen, Overlay, Hard Mix, etc.
- Opacity control
- Color & Tone Adjustments (on Layer 1)
- Saturation, Hue, Tone, Tint
- Per-channel (Red, Yellow, Green, Cyan, Blue, Magenta)
- Applied to the "All" channel first, then individual channels
🎞️ DUPLICATE LAYER COMPOSITE
- Layer 2 - Duplicate Video Layer (if enabled)
- Second video/webcam feed
- Sub-layers within Layer 2:
- Layer 2 Video (with its own Levels + Color/Tone)
- Layer 2 Pattern
- Stacking order: Either Pattern-on-Video or Video-on-Pattern
- Top element blend mode (e.g., Hard Mix)
- Individual opacity for top/bottom elements
- Then composited onto Layer 1 with:
- Composite blend mode
- Composite opacity
📺 SCREEN EFFECTS (Applied to composite)
- Static White Noise
- Monochromatic or color noise
- Blend modes available
- Applied BEFORE grid (so grid appears on top)
- VSync Lines
- Horizontal scan lines
- Gradient colors with alpha
- Blend modes, noise, color shift
- Applied BEFORE grid
- Mosaic Grid (top-most visual element)
- Black grid lines
- Always renders on top of everything else
- Anti-aliasing, blur, moiré reduction
🔧 SPATIAL DISTORTIONS (Applied to sampling coordinates)
These affect WHERE pixels are sampled from, not what's drawn on top:
- Screen Vibration - Distorts UV coordinates with blob-like waves
- Vertical Roll - Scrolls the image vertically in cycles