The Hidden Enemy: PWM Flicker
Every time you dim your screen, something invisible happens. Most displays don't smoothly reduce light—they blink. The backlight rapidly switches between ON and OFF thousands of times per second.
This technique is called Pulse Width Modulation (PWM).
PWM DIMMING AT 50% BRIGHTNESS
═══════════════════════════════════════════════════════════════
Backlight ████████░░░░░░░░████████░░░░░░░░████████░░░░░░░░
State │ ON │ OFF │ ON │ OFF │ ON │ OFF │
◀──────────────────────────────────────────────▶
One PWM Cycle
████ = Light ON (50% of cycle)
░░░░ = Light OFF (50% of cycle)
Perceived Brightness = 50%
Actual Light State = BLINKING
The Duty Cycle Formula
Perceived brightness from PWM is governed by a simple ratio:
| Brightness | t_on | t_off | Duty |
|---|---|---|---|
| 100% | 10ms | 0ms | 100% |
| 50% | 5ms | 5ms | 50% |
| 25% | 2.5ms | 7.5ms | 25% |
| 10% | 1ms | 9ms | 10% |
Why Lower Brightness = More Pain
PWM AT DIFFERENT BRIGHTNESS LEVELS
═══════════════════════════════════════════════════════════════
100%: ████████████████████████████████████████████████████████
(Continuous light - NO flicker!)
75%: ████████████░░░░████████████░░░░████████████░░░░████████
(Short OFF periods)
50%: ████████░░░░░░░░████████░░░░░░░░████████░░░░░░░░████████
(Equal ON/OFF)
25%: ████░░░░░░░░░░░░░░░░████░░░░░░░░░░░░░░░░████░░░░░░░░░░░░
(Long OFF periods - HIGH flicker!)
10%: ██░░░░░░░░░░░░░░░░░░░░░░░░░░░░██░░░░░░░░░░░░░░░░░░░░░░░░
(MAXIMUM flicker - DANGER ZONE!)
At 10% brightness, your eyes are in darkness 90% of the time. This strobe effect causes eye strain, headaches, and fatigue in approximately 15% of people.
The Frequency Factor
PWM FREQUENCY DANGER ZONES
═══════════════════════════════════════════════════════════════
Hz 0 100 250 500 1000 2000 3000 5000+
│ │ │ │ │ │ │ │
▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼
┌───────┬─────┬─────┬─────┬──────┬─────┬─────┬─────┐
│▓▓▓▓▓▓▓│▓▓▓▓▓│░░░░░│░░░░░│ · │ · │ · │ · │
│DANGER │RISKY│MILD │MINOR│ SAFE │SAFER│SAFEST │
└───────┴─────┴─────┴─────┴──────┴─────┴─────┴─────┘
▓▓▓ = Severe symptoms possible
░░░ = Mild fatigue possible
· = Generally imperceptible
IEEE 1789: PWM > 3000 Hz for "no effect"
The Tap Zap Solution: Gamma Dimming
THE TAP ZAP METHOD: GAMMA DIMMING
═══════════════════════════════════════════════════════════════
STEP 1: Set hardware backlight to 100%
████████████████████████████████████████████████████
(Continuous light - ZERO PWM flicker!)
STEP 2: Apply software gamma curve to reduce output
Input Value
┌────────────────────────────────────────┐
1.0│ ·········│
│ ······· │
│ ······ │
0.5│ ······ │ ← Modified
│ ······ │ Gamma
│ ···· │ (Darker)
0.0│·· │
└────────────────────────────────────────┘
0.0 0.5 1.0
Output Value
RESULT: Darker image, backlight remains CONSTANT
The Implementation
// Apply gamma filter to all displays
func applyFilter() {
let factors = calculateRGB(intensity: intensity)
let bf = brightness
for i in 0..<256 {
rt[i] = originals.red[i] * (factors.r * bf)
gt[i] = originals.green[i] * (factors.g * bf)
bt[i] = originals.blue[i] * (factors.b * bf)
}
CGSetDisplayTransferByTable(id, 256, rt, gt, bt)
}
PWM vs. Gamma: Side by Side
PWM Dimming @ 50%
- Backlight switches at ~240Hz
- 500ms darkness per second
- Eye strain for sensitive users
Gamma Dimming @ 50%
- Backlight always ON
- 0ms darkness per second
- Zero flicker for everyone
The Flicker-Free Equation
Gamma @ 100%: 0 hours of darkness
SET MAC BRIGHTNESS TO 100% FOR ZERO PWM FLICKER