PrismaticFlower / shaderpatch

Improved shaders (and fun stuff for modders) for Star Wars Battlefront II (2005) - Incompatible with Classic Collection
MIT License
39 stars 2 forks source link

HDR Bloom artifacting #69

Closed DoctorAnsem closed 4 years ago

DoctorAnsem commented 5 years ago

Sometimes, when there is a bright bloom and/or a lot of it on screen, the shader bugs out and flashes black squares on them (not very eye pleasing either, we're talking epilepsy trigger kind of flashing). It's not exactly super consistent to reproduce, but lightsaber trails and smooth PBR surfaces tend to trigger it pretty often. In this instance I caught a reflection of something on the water of all things causing a big one.

2019-06-11 20_41_10#1

PrismaticFlower commented 5 years ago

Ah, I have seen this before. It's likely being caused by a couple values in the frame buffer being NaN (Not-a-Number), probably from division by zero or taking the squareroot of a negative number. NaN's have the unique property of turning anything else they touch into a NaN, hence the giant black block.

In the initial D3D11 port there were quite a few of these issues in the PBR shader (D3D9 was more lax with it's FP rules), but I had thought that I'd fixed all of them by putting clamps and the like in the appropriate places.

Do you think you could send me a (munged) map that this is occurring on? I already checked out my Mygeeto map and it isn't happening there as far as I can see. I could try just fixing it but without an example of it happening I won't be able to verify if I have fixed it or not.

DoctorAnsem commented 5 years ago

Thing is, it's not map-specific so much as I think it might be the bloom values. I noticed Mygeeto has a much more tame bloom compared to what I've used, so if testing Mygeeto with something like Threshold: 1 and Intensity: 0.75 could reproduce the bug that would be great, otherwise I'm going to need some time to isolate one of my maps. It's not exactly easy to do since I need to detach one from several gigabytes of shared files. (it's kind of a large scale project)

PrismaticFlower commented 5 years ago

It's not exactly easy to do since I need to detach one from several gigabytes of shared files.

Ah yeah, don't worry about it then for now if it's going to be hassle! I'll see if I can find a way to reproduce it myself first.

DoctorAnsem commented 4 years ago

It seems that maybe this bug isn't so much about bloom after all, but it's weird nonetheless. It caught my attention that every time the black squares happen, there is a cloth entity nearby; sometimes the cloth's cause a black box to persist for several seconds, explicitly following the entity that the cloth is attached to.