Strange lighting glitch when ADS in game BF1 (2004)

Started by Zelkron, July 26, 2019, 10:36:10 PM

Previous topic - Next topic
July 26, 2019, 10:36:10 PM Last Edit: July 26, 2019, 10:39:59 PM by Zelkron
Hey there folks,

I am sorry in advance if I am posting this in the wrong area. I have just been going insane trying to figure out this one glitch that has been occurring every single time that I aim down the sights (ADS). The "glitch" is a large rectangular bright patch that appears.  My computer specs are ryzen 1600 with a 1080ti. My monitor is the Dell G-Sync s2716dg.

Any help would be greatly appreciated!!! :D

P.S. I've attached an image of the issue.

Thanks,

Zelkron

Okay first a quick (overly technical) explanation of what I think is probably going on here. (Skip ahead if you just want the fix.) So the game has a blur postprocessing effect and it works by downscaling the rendered image by a factor of 0.25 then running a box filter over that and then overlaying the result back on top of the original image.

Now the texture that the game downsamples the scene into for the blur has a constant size across all resolutions of 512 * 512. And the downsampling is done by the D3D9 method IDirect3DDevice9::StretchRect. If we take your resolution and scale it by 0.25 we get 640 * 360. This is where the problem is, the game calls IDirect3DDevice9::StretchRect telling it to take this input texture, which is 2560 * 1440, downsample it so that it becomes 640 * 360 and use this texture (which is 512 * 512) as the destination.

It's quite easy for us to spot here that the downsampled texture size doesn't fit inside the destination and it's also quite easy for D3D9 to spot and it just returns an error to the game and does nothing. Which leaves the destination texture unmodified. Now the game doesn't bother handling the error returned by D3D9 and heroically presses on!

This results in the blur effect not working correctly. In most cases it'll end up overlaying a black texture of the original one, but that 512 * 512 texture it uses to do the blur is also used as an intermediate target for other things like scope blurs and water normal maps.

Possible Fixes Begin Here

Now the solution is quite simple, we simply have to stop the game's resolution being greater than 1 / 0.25 * 512 (or put more simply, 2048) in either direction. Now you can just set your resolution to 1920 * 1080 and call it day. This will fix the problems and assuming the DPI on your display is reasonable when combined with MSAAx8 it'll look pretty good.

You could also use a custom resolution that maxed out at 2048 to get the most detail possible while avoiding the bug. (for 16:9 this would be 2048 * 1153). I could probably make a guide on how to do that if you were interested, but the difference is likely to be small and custom resolutions are in general a pain because they disable the ability to use DSR.

The proper solution would of course be to edit the exe to fix the bug or remove the blur effect but that's a lot more work to do. You can also disable the effect in a map's .fx file.