AmbientLight.fx (with dither toggle)

  • Posts: 3
3 years 3 months ago - 3 years 3 months ago #1 by SoZ
TL;DR: A version of Ganossa's AmbientLight.fx with a toggle to turn dithering off. Try it if you encounter diagonal lines running through your image.


I am completely new to ReShade and this is my first post here, so apologies in advance if I'm doing anything wrong. I've seen plenty of ReShade/SweetFX screenshots over the years but I hadn't looked into using ReShade before today. I wanted to make my screenshots a little more interesting, so I figured I would download it and give it a go.

After an hour or so of fiddling, I am very happy with the results, but the AmbientLight.fx shader was introducing a pattern of diagonal lines running through the image. Unable to find any mention of the issue on this forum, I traced the source of the pattern back to the "dither" code within the shader. Funnily enough, determining the origin of the problem gave me the keyword I had been missing to search for other posts on the topic on the forum, such as this one where Marty McFly had identified the cause of the problem previously: TOPIC: Shaders Problems

I have modified the version of AmbientLight.fx that was automatically downloaded when I installed ReShade earlier to allow dithering to be turned on and off via the AL_Dither toggle in the UI. It fixes my problem and I figured I would share the modification in case it's of use to anyone else. Hopefully there are no issues with sharing modifications to existing shaders that are already publicly available here; the forum rules weren't clear.

Regarding the dither code itself, not having used ReShade before, I am unsure whether or not it is working as intended. While it is technically a dither, the harsh pattern produced is very distracting. A more subtle pattern or random noise might produce a better result. Perhaps I'll experiment when I have more time.
The following user(s) said Thank You: Wicked Sick, Apocalypso, One3rd, andrew, Uncle Crassius, WalterDasTrevas, Exilium, Marty, Sinclair, Rudy102

Please Log in or Create an account to join the conversation.

  • Posts: 14
2 years 11 months ago #2 by One3rd
Thanks for this! That pattern had been bugging me for a while but I wasn't actually sure what was causing it. It had actually stopped me from using the AmbientLight shader in a number of situations due to this. The strange thing was it only showed up in some games and not all and I couldn't pin down why.

Please Log in or Create an account to join the conversation.

  • Posts: 21
1 year 3 weeks ago #3 by Diego0920

Please Log in or Create an account to join the conversation.

  • Posts: 67
11 months 3 weeks ago #4 by aaronth07
Thanks, testing it now.

You should consider submitting a pull request on Github, so that this can replace the normal ambient light.

Please Log in or Create an account to join the conversation.

  • Posts: 3
2 months 3 weeks ago - 2 months 3 weeks ago #5 by HekutoruMAC
Hello. After finding it by chance I updated and corrected this shader mod to make the pull possible.
If anybody wishes to confirm it is working as intended, be my guest!

Code: Pastebin

Differences between SoZ original version and my update:
AmbientLightDither2017 vs AmbientLightDither2020

Differences between current github version and my update:
AmbientLight2020 vs AmbientLightDither2020

In short, it now uses some constants from ReShadeUI.fxh and fixes the logic of dither and adaptation.
Thanks to SoZ for making your contribution public and Ganossa for the awesome shader.
The following user(s) said Thank You: Wicked Sick, Viper_Joe, Marty, aaronth07

Please Log in or Create an account to join the conversation.