Describe the bug
The token names for GM controlled tokens under FoW show up if a player client mouse pointer hovers over a token's position or by enabled Show Token Names in View menu.
Reported by Dorpond via Discord.
Edit for additional detail:
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Expect that players would not be able to see the names of tokens that they can't actually see.
Screenshots
GM View

Player View hovering over token with mouse

Player View - View Token Names enabled

MapTool Info
Desktop (please complete the following information):
Additional context
MapTool 1.5.3 campaign - remove ".zip" ending.
VisibleUnderFogTest153.cmpgn.zip
It's a new feature to support echolocation!
(Ha, that could work as a perception type eh lol)
Seriously though, ya, should be a easy fix. This sort of bug keeps cropping up. :-(
I remember it popping up a while back and thought it even got fixed but I couldn't come up with the right search terms to find it if it really did happen.
I think the other issue was when you moved an NPC token in FoW you would see the name move around. That was an older issue I had fixed in my fork a while back.
Don't know if it's related code wise or not. It was opened in my fork by @Dorpond
I believe back around Nerp鈥檚 1.4.4.X (I think you fixed it in 1.4.4.0) we did have an issue where tokens moving around were being seen while they were under hard FOW. You did fix that, and I was extremely happy at the time, lol. Apparently I didn鈥檛 test it enough afterwords or it was introduced since then... you may want to check your Nerp鈥檚 change logs @Jamz
I would love to see this fixed but I don't really know how renderTokens() works. It's about ~750 lines long too.
I don't really understand how the tokens under the fog are not rendered. I think it has something to do with clipping, but I don't really get it. Does anyone have a clue?
It basically just take 6 or so passes. First it writes the background tokens then object, then if gm, the hidden layer then token layer. Next it renders the fog layer and then finally it grabs all the tokens that have visible over FoW and renders those.
Granted, it's been more than a year since I have been in that code and it MIGHT be smart and not render tokens under the fow but Im pretty sure it just renders and clips everything layer by layer.
I did some testing, and the bug only occurs when Map Vision is set to Off.
If you set the Map Vision to Day or Night, the labels no longer appear.
To tell the truth I'm no really sure what the expected behavior is when Vision is turned off.
Vision isn't needed to use Fog of War. Initially MapTool just had manual Fog of War removal like most other VTTs. With vision not enabled on the map it should work the same. Token names should never appear above FoW.
And the bug does show up on maps with Vision set to Day. With Vision set to night, if there are light sources by the tokens, the names also show up.
Off means no constraints on vision including VBL. Day means VBL and vision limits apply. Night means you must have light sources or vision allowing sight in the dark.
More testing. I could replicate the bug in two scenarios:
In both of these cases, the FoW is the only thing preventing us from seeing the token, in the sense that revealing the FoW (say, through the admin tool) there would immediately reveal the token to the player.
It has nothing to do with revealing FoW or auto-reveal on movement.
This is GM (left) and Player(right) views of the map with it set to Day. Note the token names are visible even though the tokens aren't.

Works fine for me when View is set to Day...

Did you enable Show Token Names from the View menu like it says in step 5?
Yes, that's why you can see "Hero" under the token
My server settings:
Also,
Or you had the mouse pointer over it. Did you disable the token's sight?
Mostly the same settings.

I bet the difference is Use Individual FoW.
Nope. Didn't change anything.
I set the same settings, with 1.5.3 and your fresh campaign file, and I still don't have the bug you mentioned when Map View is set to Day.
I'm also on Windows 10.
The campaign that was attached has the token vision set to short range. Set it to Normal.
Ok, I do get your result now.
But, if map vision is set to Day and token vision is set to Normal, then all the tokens are within visible range.
It seems to me the bug is with the FoW showing up - not with the token names. (EDIT: see #213)
Like I said above, if you have Vision set to Day then the tokens must be in sight range of the viewing token.
It seems to me the bug is with the FoW showing up - not with the token names.
No. Fog is valid until is is cleared by exposing the visible area. If the fog is hiding the token, the name should be hidden.
No. Fog is valid until is is cleared by exposing the visible area. If the fog is hiding the token, the name should be hidden.
When Map Vision is set to Day [edit: with Auto-Reveal FOW], shouldn't Fog be cleared automatically? Seems like the Fog is only cleared once the token is moved once.
Not necessarily. A lot of folks don't use Auto-Reveal and quite a few don't let players reveal. There are lots of story reasons why a token might start off in a restricted area of exposure before a full reveal is made. As Show Token Names is a client-side setting, having MT reveal the presence of tokens within the FoW before desired can screw up a GMs plans.
Not too mention it just is wrong to show token names when no token is visible.
Here is my understanding of this issue:
The code tags a token as visible or not, and if tagged visible, the name of the token is drawn.
To tag a token as visible, the code uses Vision (Off -> Always Visible) as well as vision range, VBL, etc. Typically, this work very well.
However, FOW is not taken into account for visibility. That's why if you type in your example
[canSeeToken("Eagle", "Hero")]
You'll see that the token is considered visible.
This is problematic when there is FoW over what could otherwise be seen by the token. This typically happens when Map Vision and/or Auto-Reveal on Movement are set to off, but can also occur when the FoW has not been updated to reflect modifications to a token's vision.
The solution is an additional check to see if there is FoW over a token before it is deemed visible. I don't really know how to do that, unfortunately. Also, this check will only really matter when Map Vision and/or Auto-Reveal on Movement are off, so maybe the check should be skipped in those cases.
I believe you have summed up how the code works correctly.
@JamzTheMan said this:
Next it renders the fog layer and then finally it grabs all the tokens that have visible over FoW and renders those.
Is it possible that the token names are being rendered after the fog layer or without a check for visibility? Clearly the tokens themselves are being hidden correctly so the same switch(es) that keep a token hidden when it is technically in sight but under FoW should work for them?
Is anyone working on this? I've noticed it has been in the 1.5.4 "to do" list for about 2 weeks now.
Not that I know of. I took a glance at the code in ZoneRenderer down in the label section around 3427. Didn't see any checks for whether the label would be in an exposed area or not as is done for the token itself. (See L3188 for an example)
So it's yours if you want to dig in.
Ya, I haven't had the time. Figured I would look at it if no one else did (I usually will assign it to myself in those cases).
Feel free to comment if you want to look at it otherwise...
My PR request #607 fix the token names visible over FoW for the case where either Vision is Off or Auto-Reveal on Movement is off.
Not sure if my solution is efficient but it seems to work. I do a call to zone.isTokenVisible(), which is slow because it checks for overlap with the FoW, but I don't think there is any other way to check for visibility when Vision/Auto-Reveal are off.
Tested. Change does correct the issue.
@dorpond Test when you get the chance. Will close this for now.
Most helpful comment
Is anyone working on this? I've noticed it has been in the 1.5.4 "to do" list for about 2 weeks now.