Runtime Control

Control and animate effects during gameplay

Dynamic Effect Control

Art of Shader effects can be controlled and animated at runtime, enabling reactive visuals that respond to gameplay events.

AOSRuntime Blueprint

The AOSRuntime blueprint provides ready-to-use functions for controlling effects dynamically.

Key Functions

  • Set Effect Intensity: Change overall effect strength
  • Interpolate Parameters: Smoothly transition between values
  • Toggle Effect: Enable/disable effects instantly
  • Pulse Effect: Create pulsing intensity variations
  • Random Variation: Add randomness to parameters

Basic Blueprint Control

Changing Effect Intensity

Event BeginPlay
→ Get AOS Actor Reference
→ Set Scalar Parameter Value
  - Parameter Name: "Intensity"
  - Value: 0.5

Smooth Parameter Transition

Timeline → Update
→ Lerp (A: Start Value, B: End Value, Alpha: Timeline Alpha)
→ Set Scalar Parameter Value
  - Parameter Name: "EffectStrength"
  - Value: Lerp Result

Responding to Events

Event PlayerDamaged
→ Set Scalar Parameter Value
  - Parameter Name: "GlitchIntensity"
  - Value: 1.0
→ Delay (0.5 seconds)
→ Set Scalar Parameter Value
  - Parameter Name: "GlitchIntensity"
  - Value: 0.0

UMG Widget Controls

The included UMG widgets provide user-friendly interfaces for effect customization.

Color Wheel Widget

Dynamic color picker for adjusting color-based parameters:

  • Real-time color selection
  • Hue, saturation, value controls
  • RGB output for material parameters
  • Preset color swatches

Slider Widget

Precise control over scalar parameters:

  • Min/max range configuration
  • Step increments
  • Real-time preview
  • Value display

Preset Switcher

Toggle between saved effect configurations:

  • Store multiple material instance presets
  • Instant switching between looks
  • Blend between presets
  • User-customizable slots

Common Gameplay Integrations

Health-Based Effects

Event HealthChanged
→ Get Health Percentage (0-1)
→ Invert (1 - Health %)
→ Set Scalar Parameter Value
  - Parameter Name: "DamageGlitch"
  - Value: Inverted Health

Result: More damage = more glitch

Speed-Based Motion Blur

Event Tick
→ Get Velocity
→ Vector Length
→ Map Range (0, MaxSpeed) to (0, 1)
→ Set Scalar Parameter Value
  - Parameter Name: "MotionBlur"
  - Value: Mapped Speed

Result: Faster movement = more blur

Power-Up Visual Feedback

Event PowerUpActivated
→ Sequence
  ├→ Set Vector Parameter Value
  │   - Parameter Name: "GlowColor"
  │   - Value: PowerUp Color
  ├→ Timeline (0 to 1 over 0.2 seconds)
  │   → Set Scalar Parameter Value
  │       - Parameter Name: "GlowIntensity"
  │       - Value: Timeline Value
  └→ Wait 5 seconds
      → Timeline (1 to 0 over 0.5 seconds)
          → Set Scalar Parameter Value
              - Parameter Name: "GlowIntensity"
              - Value: Timeline Value

Result: Flash effect that fades out

Environmental Response

Event EnterWater
→ Set Vector Parameter Value
  - Parameter Name: "DistortionColor"
  - Value: (0, 0.3, 0.5) // Blue-green
→ Set Scalar Parameter Value
  - Parameter Name: "DistortionAmount"
  - Value: 0.8

Event ExitWater
→ Set Scalar Parameter Value
  - Parameter Name: "DistortionAmount"
  - Value: 0.0

Result: Underwater distortion effect

Advanced Techniques

Pulsing Effects

Create Curve Float asset with sine wave
→ Timeline using that curve
→ Loop timeline
→ Set Parameter Value to curve output

Result: Rhythmic pulsing effect

Random Glitch Spikes

Set Timer by Function Name
  - Function: "TriggerGlitch"
  - Time: Random Float (1.0, 5.0)
  - Looping: False

Function TriggerGlitch:
→ Set Scalar Parameter Value
  - Parameter Name: "Glitch"
  - Value: Random Float (0.5, 1.0)
→ Delay (Random Float 0.1, 0.3)
→ Set Scalar Parameter Value
  - Parameter Name: "Glitch"
  - Value: 0.0
→ Set Timer (restart the cycle)

Result: Unpredictable glitch spikes

Camera Shake Integration

On Impact:
→ Play Camera Shake
→ Sequence
  ├→ Set Scalar Parameter "ImpactDistortion" to 1.0
  └→ Timeline (Ease Out curve)
      → Set Scalar Parameter to Timeline Value

Result: Visual effect synced with camera shake

Performance Optimization

Dynamic Effect Enabling

Based on graphics settings:
If (Graphics Quality == Low)
  → Disable expensive effects
  → Keep only essential effects

If (Graphics Quality == High)
  → Enable all effects
  → Increase quality parameters

Distance-Based LOD

Event Tick
→ Get Distance to Player Camera
→ If distance > Threshold
  ├→ True: Reduce effect intensity
  └→ False: Full intensity

Result: Save performance on distant effects

Saving/Loading Configurations

Save Effect Settings

1. Create a struct with all effect parameters
2. Get current values from material instances
3. Save struct to SaveGame object
4. Write to disk

Load Effect Settings

1. Load SaveGame object
2. Extract effect parameter struct
3. Apply values to material instances
4. Update UI widgets if present

Debugging Runtime Effects

Print Parameter Values

Get Scalar Parameter Value
→ Print String (for debugging)
→ Verify values are updating correctly

Visual Debug Mode

Create debug widget showing:
- Current effect names
- Parameter values
- Active/inactive status
- Performance metrics

Best Practices

  1. Use Timelines: For smooth transitions, always use timeline interpolation
  2. Clamp Values: Ensure parameter values stay within valid ranges
  3. Test Edge Cases: What happens at 0% health? 100% speed?
  4. Provide User Control: Let players adjust effect intensity
  5. Consider Accessibility: Some effects can cause motion sickness
  6. Profile Performance: Monitor frame rate when effects change
  7. Use Events Wisely: Don't update every tick if not necessary
Art Of Shader - Film And Special Effects - Documentation | Athian Games