Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fragment output of VisibilityFilter isn't premultiplied #8473

Closed
1 of 6 tasks
dev7355608 opened this issue Nov 3, 2022 · 0 comments
Closed
1 of 6 tasks

Fragment output of VisibilityFilter isn't premultiplied #8473

dev7355608 opened this issue Nov 3, 2022 · 0 comments
Assignees
Labels
bug Functionality which is not working as intended vision Issues related to Token vision and vision modes

Comments

@dev7355608
Copy link

What happened?

explored isn't premultiplied, but gl_FragColor needs to be (blendMode is NORMAL). The explored fog is brighter than it should be at the moment.

    float reflec = perceivedBrightness(baseColor.rgb);
    vec4 explored = vec4((exploredColor * reflec) + (baseColor.rgb * exploredColor), 0.5);
    vec4 unexplored = hasFogTexture
                      ? mix(vec4(unexploredColor, 1.0), vec4(fogColor.rgb * backgroundColor, 1.0), fogColor.a)
                      : vec4(unexploredColor, 1.0);

    // Mixing components to produce fog of war
    vec4 fow = mix(unexplored, explored, max(r,v));
    gl_FragColor = mix(fow, vec4(0.0), v);

// FIX:
gl_FragColor.rgb *= gl_FragColor.a;

Also (exploredColor * reflec) + (baseColor.rgb * exploredColor) might yield values larger than 1. Shouldn't there be a min(..., vec3(1.0))?

Another minor issue: canvas.effects.visibility.filter.blendMode is undefined. VisibilityFilter doesn't define a getter for blendMode but a setter; the setter for blendMode doesn't seem to serve any purpose.

What ways of accessing Foundry can you encounter this issue in?

  • Native App (Electron)
  • Chrome
  • Firefox
  • Safari
  • Other

Reproduction Steps

Good settings to see the difference: Set fog explored and unexplored colors to #ffffff and Darkness Level to 0.5.

What core version are you reporting this for?

Version 10 Stable 4 (build 288)

Relevant log output

No response

Bug Checklist

  • The issue occurs while all Modules are disabled
@dev7355608 dev7355608 added the bug Functionality which is not working as intended label Nov 3, 2022
@aaclayton aaclayton added the vision Issues related to Token vision and vision modes label Nov 4, 2022
@aaclayton aaclayton added this to the Version 10 - Stable Patch 5 milestone Nov 4, 2022
@Feu-Secret Feu-Secret self-assigned this Nov 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Functionality which is not working as intended vision Issues related to Token vision and vision modes
Projects
No open projects
Development

No branches or pull requests

3 participants