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

VisualEffectsMaskingFilter and VisibilityFilter don't sample uVisionSampler and uRoofSampler correctly #7473

Closed
dev7355608 opened this issue Jul 11, 2022 · 4 comments
Assignees
Labels
bug Functionality which is not working as intended canvas Issues related to the PIXI canvas, rendering, and other WebGL functions. sfx Issues related to visual effects like weather

Comments

@dev7355608
Copy link

Environment Details

  • Foundry VTT Version: 10.272

Issue Description

VisualEffectsMaskingFilter and VisibilityFilter are not correctly sampling from uVisionSampler and uRoofSampler. If you add any filter to the stage (or any parent of the object the filter are attached to) and pan to the edges of the canvas while having a token selected, you see why. The filters must not use vTextureCoord, but vMaskTextureCoord as in AbstractBaseMaskFilter.

@dev7355608 dev7355608 added the bug Functionality which is not working as intended label Jul 11, 2022
@Feu-Secret
Copy link

VisualEffectsMaskingFilter and VisibilityFilter are screen sized filters.
The render textures from Vision and Roof are screen sized also.
So, from a framework point of view, I'm wondering what is messing with that when applying filters on the stage or parents.

@dev7355608
Copy link
Author

If the filter is applied to the stage or parent, the filter texture size (and position) is not the same as the as the screen necessarily. It might be smaller if the intersection of the filter area (bounds) of the filtered object is not covering the entire screen (autoFit = true). If autoFit = false, the texture might be larger than the screen, thus fails. Or if the filter has padding, the filter area doesn't match the screen size either even if filterArea is canvas.app.screen.

@dev7355608
Copy link
Author

The main problem is actually that the filter on the parent changes the source frame. The source frame can become smaller, because the bounds of the parent are intersected with the current source frame (screen size). The smaller source frame is then intersected with the filterArea (canvas.app.screen), which doesn't equal canvas.app.screen.

The reasons above are not really related to the parent filter, but potential problems for VisualEffectsMaskingFilter/VisibilityFilter themselves.

@Feu-Secret Feu-Secret added this to the Version 10 - Testing 2 milestone Jul 25, 2022
@Feu-Secret Feu-Secret self-assigned this Jul 25, 2022
@Feu-Secret Feu-Secret added sfx Issues related to visual effects like weather canvas Issues related to the PIXI canvas, rendering, and other WebGL functions. labels Jul 25, 2022
@Feu-Secret
Copy link

Overview of the changes:

  • VisualEffectsMaskingFilter and VisibilityFilter are now subclass of AbstractBaseMaskFilter and are sampling uVisionSampler and uRoofSampler with vMaskTextureCoord.
  • AbstractBaseMaskFilter has some logic removed pertaining to the fragmentShader mutation with the channel.
  • A new mixin has been created to handle the adaptability of the fragmentShader with the channel: AdaptiveFragmentChannelMixin

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 canvas Issues related to the PIXI canvas, rendering, and other WebGL functions. sfx Issues related to visual effects like weather
Projects
No open projects
Status: Done
Development

No branches or pull requests

2 participants