Lens Shading Simulator
Simulate relative illumination across the sensor based on chief ray angle, microlens shift optimization, and cos⁴ fall-off. Visualize per-channel color shading.
Lens Shading Simulator
Simulate relative illumination across the sensor based on CRA, pixel design, and cos⁴ fall-off. Visualize per-channel color shading.
2D Shading Map
Radial Profile
Model scope
Use this browser tool for intuition, relative trends, and design-space exploration. Its local simplified model is not a substitute for RCWA/FDTD sign-off, silicon calibration, or vendor process data.
Learn more
Relative Illumination and CRA Shading
Even with a perfect lens, the corners of every image come out darker than the centre — it is geometry, not a defect. Light arrives at edge pixels at a steep angle while the pixel optics are tuned for straight-on rays, so corner response drops. Modern sensors compensate by shifting microlenses inward at the edges, and image processing fills in the rest.
Lens shading combines optical cos-fourth falloff, chief-ray angle mismatch, microlens offset, and color-channel angular response.
Assumptions
- Relative illumination combines chief-ray angle, cos-fourth falloff, and compact microlens-shift compensation.
- The sensor map is radially simplified and does not include lens design ray files, pupil aberrations, or per-pixel measured correction tables.
- Color shading is represented by channel-dependent angular sensitivity, not a full spectral ISP correction.
Outputs
- 2D relative-illumination map, radial falloff, corner loss in stops, channel imbalance, and compensation trend.
- A quick view of whether optical CRA, pixel pitch, or microlens shift is likely to drive corner shading.
Validation Example
- With zero CRA and no channel imbalance, the map should be nearly flat apart from any intentional falloff term.
- Increasing maximum CRA should reduce corner relative illumination and can produce stronger color shading.
Core Equations
- \(RI\): Relative Illumination
- \(\theta\): Chief Ray Angle (CRA)
This is a classical first-order model for image-plane relative illumination.
- \(h_{\text{stack}}\): Optical stack height
Refraction in the stack usually makes CRA_eff smaller than the air-side CRA.
- \(G_c(r)\): Spatial gain correction
Per-channel lens-shading correction equalizes radial response.
Model Interpretation
- Color shading appears when R/G/B angular responses are not identical.
- Microlens shift improves edge response but can reduce center tolerance if overdone.
- Production correction tables combine optical design and factory calibration.
Shading Sources
- Lens geometry creates classical $\cos^4\theta$ falloff before pixel optics are considered.
- Pixel stack angular response adds color-dependent rolloff when R/G/B filters respond differently to CRA.
- Microlens shift corrects lateral focus displacement but must match stack height and refracted CRA.
Correction Workflow
- Measure flat fields per channel, estimate radial or 2D gain maps $G_c(r)$, and apply correction before color processing.
- Separate optical shading from illumination nonuniformity and dust by using calibrated fixtures.
- Validate correction at multiple focus distances and apertures if the lens system changes CRA distribution.
Known Missing Physics
- The model does not solve full lens chief-ray distribution, pupil aberration, or sensor cover-glass refraction.
- Correction tables can amplify corner noise because they multiply weak signals.
- Real products also compensate manufacturing variation, module tilt, and color-temperature dependence.