Skip to content

Wfactor consistency of SGSR2/3pass #9

Description

@gro-ove

Thank you for such an amazing set of shaders! They work great, and are wonderfully performant. However, when integrating, I ran into a small problem, and while I found a solution on my side, I’m curious if I might be missing something.

This line:
https://github.com/SnapdragonGameStudios/snapdragon-gsr/blob/main/sgsr/v2/include/glsl_3_pass_cs/sgsr2_upscale.comp#L95

vec4 History = textureLod(PrevHistoryOutput, PrevUV, 0.0);
…
float Historyw = History.w;
float Wfactor = max(clamp(abs(Historyw), 0.0, 1.0), alphamask);
…
imageStore(HistoryOutput, ivec2(gl_GlobalInvocationID.xy), vec4(Upsampledcw.xyz, Wfactor));

Basically, Wfactor never goes down, so if alpha mask was ever set to a high value, it remains high. This also means that if an object with alpha mask has passed over the scene, high alpha mask value remains in its trail forever, as PrevUV for stationary scene would point to the same pixel the object was at in the previous frame.

For my project, I fixed it by simply adding * 0.99 to the clamping of Historyw.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions