Effect Localization

Apply effects to specific objects or screen regions

What is Effect Localization?

Localization allows you to apply post-process effects to specific parts of your scene rather than the entire view. This enables creative effects like:

  • Making only certain objects glitchy while the rest is normal
  • Applying stylized effects to characters but not environment
  • Creating split-screen effects with different looks
  • Isolating effects to UI elements

Object Space Localization

Apply effects only to specific objects using the Custom Depth Stencil buffer.

Setup

  1. Select the actor(s) you want to affect
  2. In Details panel, search for "Custom Depth"
  3. Enable "Render CustomDepth Pass"
  4. Set a Custom Depth Stencil Value (1-255)
  5. In your AOS material instance, enable "Use Object Localization"
  6. Set the "Stencil Value" to match your actor's value

Stencil Values

Organize your stencil values:

  • 1-50: Main characters
  • 51-100: Enemies/NPCs
  • 101-150: Interactive objects
  • 151-200: Environmental effects
  • 201-255: UI/Special effects

Include vs Exclude Mode

  • Include: Effect ONLY applies to marked objects
  • Exclude: Effect applies to EVERYTHING EXCEPT marked objects

Use Cases

  • Damaged Enemies: Glitch effect on low-health enemies
  • Hacked Objects: Chromatic aberration on hacked items
  • Spectral Characters: Ethereal effects on ghosts
  • Shield Effects: Distortion on shielded characters

Screen Space Localization

Divide the screen into regions with different effects.

Setup

  1. Enable "Use Screen Space Localization" in material instance
  2. Define region using UV coordinates (0-1 range)
  3. Set shape: Rectangle, Circle, or custom mask
  4. Adjust feather/softness of the edge

Region Parameters

  • Center: UV coordinates of region center (X, Y)
  • Size: Width and height of region (0-1)
  • Feather: Edge softness (0 = hard edge, 1 = very soft)
  • Invert: Apply effect outside the region instead

Example Configurations

Top-Left Quarter:

Center: (0.25, 0.25)
Size: (0.5, 0.5)
Shape: Rectangle

Center Circle:

Center: (0.5, 0.5)
Size: (0.3, 0.3)
Shape: Circle
Feather: 0.2

Right Half:

Center: (0.75, 0.5)
Size: (0.5, 1.0)
Shape: Rectangle

Use Cases

  • Binoculars/Scope: Circular region in center
  • Damaged Screen: Effect in corners only
  • Split Screen: Different effect on each half
  • Vignette Alternative: Inverted circle for edge effects
  • UI Separation: Different treatment for UI regions

Depth-Based Localization

Separate foreground from background using scene depth.

How It Works

  • Uses scene depth buffer to determine distance
  • Define a depth threshold value
  • Objects closer than threshold = foreground
  • Objects farther = background

Setup

  1. Enable "Separate Background" in material instance
  2. Adjust "Depth Threshold" slider
  3. Preview to ensure correct separation
  4. Apply different effects to each layer

Use Cases

  • Atmospheric Fog: Effect increases with distance
  • Focus Effects: Blur background, keep foreground sharp
  • Cinematic Depth: Film effects on background, clean foreground
  • Weather Effects: Fog/haze on distant objects only

Niagara-Based Localization

Use Niagara particle systems to control where effects appear.

How It Works

  1. Place Niagara particle system in scene
  2. Particles define effect locations
  3. Effect renders only where particles exist
  4. Animate particles to move effects around

Setup

  1. Use provided AOS Niagara systems
  2. Configure emitter spawn location
  3. Link to corresponding effect material
  4. Adjust particle lifetime and behavior

Use Cases

  • Moving Glitches: Glitch travels across screen
  • Impact Effects: Distortion at projectile hit points
  • Energy Fields: Effect follows energy sphere
  • Temporal Rifts: Growing/shrinking effect regions

Combining Localization Types

You can combine multiple localization methods:

Example: Damaged Robot Enemy

1. Object Space: Target the robot with stencil value 50
2. Screen Space: Add screen shake effect to center region
3. Niagara: Emit sparks particles from damaged areas
4. Result: Glitch effect only on robot, intensifying
   near damage points, with screen distortion when close

Performance Impact

Localization affects performance differently:

  • Object Space: Minimal cost, uses existing stencil buffer
  • Screen Space: Low cost, simple UV math
  • Depth-Based: Very low cost, uses existing depth buffer
  • Niagara: Moderate cost, depends on particle count

Best Practices

  1. Plan Your Stencil Values: Create a chart of what values mean what
  2. Use Feathering: Hard edges can look unnatural
  3. Test Edge Cases: What happens at borders between regions?
  4. Consider Camera Movement: Effects move with screen space, not world
  5. Document Your Setup: Complex localization needs good notes
Art Of Shader - Film And Special Effects - Documentation | Athian Games