Skip to content

Remove 8 light limit and add configurable lighting enhancements

Posting this as a MR by request. As is, OpenMW is limited to 8 lights per objects, attempts to bypass this by increasing the limit both in the shaders and LightManager proved to be futile.

Changes

  • Independence from the gllight* line of functions when 'legacy' lighting mode is disabled and force shaders are enabled (explicitly).
  • Max light along with a lighting backend setting. Support for UBO is auto-detected. A warning is printed if it is not and we fallback to using standard uniforms instead. legacy is standard ffp lighting, shaders compatibility is simple replacement of glLight with custom uniforms, and shaders uses a shared UBO. I'd like only two settings here (legacy and shaders), but compatibility and performance held me back.
  • Light fade settings. Mirrors the config for that of shadows.
  • Bounding sphere multiplier setting and light cutoff derived from radius. This makes some scenes darker, but this is an unavoidable consequence with the forward rendering technique in use. Fixes majority of lighting popping and allows for smoother transitions.
  • Minimum interior brightness setting.

Known Issues

  • Performance issues on lower end hardware when Per Pixel Lighting is being used. The impact seems to be the actual access random access of the UBO from within the fragment shader, the bottleneck does not appear to be with UBO updates (e.g. implicit synchronization). Not a concern now because of the compatibility mode.
  • Layout keyword is not reliably available, making use of std140 problematic. Move to shared layout is one alternative.
Edited by Cody Glassman

Merge request reports