Closed aaclayton closed 2 years ago
Nice to hear. I will slot this into our next patch version so we can update to 6.2.1 and get this closed.
Originally in GitLab by @dev7355608
Update: The upstream issue was fixed in pixi.js 6.2.1.
Originally in GitLab by @anathemamask
Just touching this to indicate that the upstream bug in Pixi is still open at this time.
Thank you all for the research into this. Marking this bug as blocked by the upstream issue https://github.com/pixijs/pixi.js/issues/6822
Originally in GitLab by @neovatar
@dev7355608 Yes, bunny test is working.
I patched my Foundry instance for now. I also subscribed https://github.com/pixijs/pixi.js/issues/6822, just tag me there if you would like me to test PIXI workarounds.
Thanks for your help <3 <3 <3
Originally in GitLab by @dev7355608
@neovatar A PIXI dev might ask for assistance in testing other workarounds if you want to help.
I suppose the best way to implement the workaround would be to test if rendering to texture doesn't work properly and only then render twice. Something like this. Does this work? It should show the triangular bunny face again.
Originally in GitLab by @neovatar
Just tried with
canvas.app.renderer.render(fog.explored, tex, undefined, transform);
canvas.app.renderer.render(fog.explored, tex, undefined, transform);
in foundry.js and that works. What is the best way to proceed?
Originally in GitLab by @neovatar
Ok. That's good to know. I assume it does work in Chrome on the same machine?
Yes, all three examples working with Chrome and Chromium.
And does this show the triangular bunny face?
Yes! :dancer:
Originally in GitLab by @dev7355608
It's very likely this issue and not even a PIXI bug but entirely Firefox's fault. The author of the issue found a workaround which is to render to the texture twice. If the last test doesn't fail then it's the same issue.
Originally in GitLab by @dev7355608
Ok. That's good to know. I assume it does work in Chrome on the same machine?
And does this show the triangular bunny face?
Originally in GitLab by @neovatar
Calling
canvas.sight.commitFog()
manually triggers the bug instantly, correct?
Yes, triggers it instantly.
All three show the same bunny, so Test 3 fails.
Originally in GitLab by @dev7355608
@neovatar I failed to mention: the token is hidden by the fog texture when you execute the script. You should be still able to select and move it if the bug is not triggered instantly. Does an error message pop up when you paste the script in the console?
Calling canvas.sight.commitFog()
manually triggers the bug instantly, correct?
It looks like that masking isn't working correctly when rendering to texture. Here are some simple test with their expected results:
Let me know if one of these test fail.
Originally in GitLab by @neovatar
Before pasting your script:
After pasting script (could not move Token):
I triggered a fog reset and:
I have setup a local FoundryVTT 0.7.9 and noticed that the bug is always triggered when commitFog() is called. It seems that in foundry.js:39175 the following call:
canvas.app.renderer.render(fog.explored, tex, undefined, transform);
seems to render the FOW texture, but all ambient lights create visible parts, like the lights are handled as revealing FOW. Once the fog/texture is rendered this way and replaces the saved texture, it gets visible on the screen and is saved.
With these lines commented out:
// Swap the staging texture to the rendered Sprite
//fog.saved.texture.destroy(true);
//fog.saved.texture = tex;
the bug does not happen and the displayed fog stays correct. So I assume that the bug happens in the way canvas.app.renderer.render(fog.explored, tex, undefined, transform);
renders the texture. So probably the "fog object" is correct, only the texture created for optimizing is "corrupt"?
Originally in GitLab by @dev7355608
@neovatar Try this:
Originally in GitLab by @neovatar
@dev7355608 I cannot access the js file you linked :(
Originally in GitLab by @dev7355608
@neovatar I created a script that should capture the exact point where it the fog gets messed up. But it forces commits every frame, so it might not trigger the bug when it fails only on first commit.
Reset fog of war and copy & paste the script in the console. Then try to trigger the bug and take a screenshot. It should stop the movement as soon as the fog is messed up.
Originally in GitLab by @neovatar
@aaclayton @dev7355608 Are there any debug options that I can set to generate more helpful logs/insights to help? I tried with CONFIG.debug.sightRays = true
, but ray casting seemed normal when the bug happened.
I also tried CONFIG.debug.fog = true
and noticed the following: The bug happens always on the first save of the fog exploration data.
SightLayer | Updating fog exploration for new explored position. 9 foundry.js:39304:37
SightLayer | Committing fog exploration to render texture. foundry.js:39158:37
SightLayer | Saving exploration progress to FogExploration document. foundry.js:39262:37
Saved Fog of War exploration progress in Scene dCaNApOgzmBWBgHf foundry.js:39342:13
All the updates of the fog are ok, but when a commit/save is triggered, it reveals the whole fog. I assume it happens somewhere in commitFog()
when the texture swapping is done.
Originally in GitLab by @dev7355608
I tried to reproduce it on my Linux machine today (same Firefox version, but Ubuntu 20.04, and AMD graphics card), but not luck so far.
Maybe it's related to #4442.
Originally in GitLab by @neovatar
I was only able to reproduce it with Firefox+Linux. So it's probably a rather arcane bug. Have you tried the Linux/Firefox 87 combo? If yes and the bug did not occur: Which graphic hardware and driver did you use? It may be nvidia related...
Hey @neovatar - I haven't ever seen this occur nor have I been able to reproduce it by following similar steps. I'll see if I can figure out a set of repro steps for this, but this is pretty strange and not something I've seen before.
Originally in GitLab by @neovatar
Environment Details
webgl.disabled = false
webgl.force-enabled = true
webgl.disable-wgl = false
layers.acceleration.disabled = false
layers.acceleration.force-enabled = true
webgl.enable-webgl2 = true
Issue Description
Movement of token may reveal FOW all areas that are closed off and contains an active light source. Without lights or if lights are switched of, the bug does not occur.
Scene: Video: