# \[5.8.3\] Instanced Stereo: MegaLights (and Volumetric Fog local lights) use the LEFT eye's light grid in the right eye

**URL:** <https://forums.unrealengine.com/t/5-8-3-instanced-stereo-megalights-and-volumetric-fog-local-lights-use-the-left-eyes-light-grid-in-the-right-eye/2842330>\
**Category:** Issues and Bug Reporting (Unreal Engine)\
**Tags:** stereo-rendering, unreal-engine\
**Created:** [October 19, 2026, 7:27am UTC](https://forums.unrealengine.com/t/5-8-3-instanced-stereo-megalights-and-volumetric-fog-local-lights-use-the-left-eyes-light-grid-in-the-right-eye/2842330 "2026-10-19T07:27:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![adjnor](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@adjnor](https://forums.unrealengine.com/u/adjnor)\
**Post date:** [October 19, 2026, 7:27am UTC](https://forums.unrealengine.com/t/5-8-3-instanced-stereo-megalights-and-volumetric-fog-local-lights-use-the-left-eyes-light-grid-in-the-right-eye/2842330/1 "2026-10-19T07:27:43Z")

</div>

### Summary

With Instanced Stereo and MegaLights enabled, local lights in the **right eye** are missing or wrong per screen tile.  
Example: a point light inside a carved pumpkin lights the pumpkin’s face and the ground in front of it in the left eye.  
In the right eye the face stays dark and the light pool on the ground is missing. Shadows and fog lighting also differ  
between the eyes. The result depends on the view, because each right-eye tile receives the light list of the same  
tile in the left eye’s image.

### What Type of Bug are you experiencing?

Rendering (Graphics / Niagara)

### Steps to Reproduce

1. Place a point light (MegaLights on) inside a closed mesh with an opening, e.g. a hollow sphere or box with a  
window cut into it. The light should only escape through the opening.
2. Instanced Stereo ON. Package and run with `-emulatestereo` (or play in a headset).
3. Compare the two halves of the window. In the right half the inside of the mesh and the light pool through the  
opening are dark or missing. Moving the view changes which right-eye areas are affected.

### Expected Result

Both eyes should match

### Observed Result

Both eyes do not match

### Affects Versions

5.8

### Platform(s)

OpenXR

### Upload an image

 ![Graveyard_UE5.8_MegaLights_rightEyeBug.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/f/1/6f1673bd3b3278f31afc70d881fa3908450e8e9d.png)

### Additional Notes

## Root cause (5.8 source)

### 1. Light grid cells (main cause)

- `LightGridInjection.cpp`: under single-pass stereo the secondary view writes its light-grid cells into the  
PRIMARY view’s `NumCulledLightsGrid` / `CulledLightDataGrid` buffers. Its cells are stored after the primary’s, at  
`ForwardLightStruct.CulledBufferOffsetISR` (= `MaxNumCells`).
- `LightGridCommon.ush` `ComputeLightGridCellIndex(..., EyeIndex)` only adds `CulledBufferOffsetISR` when  
`EyeIndex != 0`.
- These passes run separately per view, also for the secondary view, but hard-code `EyeIndex = 0`. So in the right  
eye they read the LEFT eye’s per-tile light lists:
  - `MegaLights/MegaLightsSampling.usf` (~line 316): `const uint EyeIndex = 0; // TODO`
  - `MegaLights/MegaLightsVolumeSampling.usf` (~line 270): `const uint EyeIndex = 0;`
  - `StochasticLighting/StochasticLightingTileClassification.usf` (~line 625): `const uint EyeIndex = 0;`
  - `VolumetricFog.usf` (~line 1055) and `VolumetricCloud.usf` (~line 1258): `ComputeLightGridCellIndex(..., 0)`

- The Virtual Shadow Map shaders do this correctly: they use `uint EyeIndex = View.StereoPassIndex;`  
(`VirtualShadowMapLightGrid.ush`, `VirtualShadowMapPageMarking.usf`).
- Note: with Instanced Stereo enabled, `ShaderCompiler.cpp` defines `INSTANCED_STEREO=1` for every non-ray-tracing  
shader, global compute shaders included. So these shaders do compile the `EyeIndex` branch; they just always pass 0.

### 2. Light positions (secondary cause, small error)

- `LightGridInjection.cpp` (~line 1682): the secondary view also reuses the primary’s `ForwardLightBuffer`. Its light  
positions are relative to the primary’s PreViewTranslation, with the difference stored in  
`PreViewTranslationOffsetISR`.
- `GetForwardLightData_Internal` / `GetLightViewData` in `LightGridCommon.ush` only add that offset for  
`EyeIndex != 0`. MegaLights (`GetForwardLightData(i, 0)` everywhere), `VolumetricFog.usf` and  
`TranslucentLightInjectionShaders.usf` pass 0, so right-eye lights are shifted by the eye separation.

## Suggested fix

Pass `View.StereoPassIndex` as EyeIndex in the per-view passes listed above, as the VSM shaders already do.  
Alternatively, give the secondary view its own light grid and light buffer.

## Workaround we verified

A shader header included right after `LightGridCommon.ush` in the affected shaders. It wraps  
`ComputeLightGridCellIndex`, `GetForwardLightData`, `GetLocalLightData` and the `*FromGrid` variants. When a call  
passes `EyeIndex == 0` but `View.StereoPassIndex != 0`, it adds `CulledBufferOffsetISR` / `PreViewTranslationOffsetISR`.  
This fixes the right eye in a packaged build (`-emulatestereo`) and in the headset, with no visible performance cost.

---

<div class="post-metadata">

**Author:** ![adjnor](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@adjnor](https://forums.unrealengine.com/u/adjnor)\
**Post date:** [October 19, 2026, 7:30am UTC](https://forums.unrealengine.com/t/5-8-3-instanced-stereo-megalights-and-volumetric-fog-local-lights-use-the-left-eyes-light-grid-in-the-right-eye/2842330/2 "2026-10-19T07:30:38Z")

</div>

Here is a patch made by claude to fix this issue. Please note, this is an engine-wide patch.

[UE5.8\_StereoLightFix.zip](https://forums.unrealengine.com/uploads/short-url/sEqd74vzOVbzZxuJ5ljlJ5StY8A.zip) (3.9 KB)
