LGhassen / Scatterer

Atmospheric scattering mod for KSP
Other
195 stars 51 forks source link

Scatterer's TAA interferes with HDR in TUFX #179

Closed JonnyOThan closed 4 months ago

JonnyOThan commented 2 years ago

When scatterer's TAA is enabled, HDR in TUFX is much less effective:

Scatterer not installed; HDR & Bloom on: no scatterer, HDR and bloom on

Scatterer installed, TAA off, HDR & Bloom on: scatterer taa off, hdr   bloom on

Scatterer installed, TAA on (default), HDR & Bloom on: scatterer taa, hdr and bloom on

LGhassen commented 2 years ago

Can you just use tufx's taa in that case?

JonnyOThan commented 2 years ago

Yes, and that's what I do, but this was reported as a bug in the tufx forum thread. I might take a look if I get tired of VR stuff.

LGhassen commented 2 years ago

Ok well two things come to mind: the textures scatterer uses as flip flop buffers for TAA may not be 16bit (not sure about this I may have a switch for this), and the order operations are done may be so that the screen copy is done before bloom is applied, then antialiased results are copied to the screen after bloom is applied, removing it. I haven't checked to confirm these ideas.

JonnyOThan commented 2 years ago

My hunch is the first thing: a render target somewhere isn't being created as HDR when necessary. If I enable scatterer's TAA and turn the bloom threshold way down, the bloom still functions.

LGhassen commented 2 years ago

It appears to be the case https://github.com/LGhassen/Scatterer/blob/master/scatterer/Effects/AntiAliasing/TemporalAntiAliasing.cs#L162

Jus add an if(camera.hdr) and change argb32 to argbhalf in that case.

And btw you didn't have issues with taa in vr?

JonnyOThan commented 2 years ago

Good question, I'm pretty sure I'm only using TUFX's version of TAA which supports multiple eyes. For reference: https://github.com/LGhassen/Scatterer/blob/3124f0cbaa051d77bdfb548bcc2ee054f8b36411/scatterer/Effects/AntiAliasing/TemporalAntiAliasing.cs#L28 vs https://github.com/shadowmage45/TUFX/blob/db7c97f8dd00968a954c92a29e1677100a1c3ab9/Plugin/TUFX/PostProcessing/Effects/TemporalAntialiasing.cs#L73

LGhassen commented 2 years ago

Yeah VR was the last thing on my mind when I adapted this 😅