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

Decrease circleVertexEpsilon in order to increase the fidelity of circle approximation. #7418

Closed
dev7355608 opened this issue Jul 2, 2022 · 2 comments
Assignees
Labels
bug Functionality which is not working as intended lighting/fog Issues related to dynamic lighting or fog of war

Comments

@dev7355608
Copy link

Environment Details

  • Foundry VTT Version: 10.272

Issue Description

The polygonal shape is clearly noticeable in the case of small light sources or with low attenuation light sources or at intersections of dark and normal light sources. Even at maximum performance mode. 0.3 would be a good value for circleVertexEpsilon.

Also I don't think it's a good idea to set circleVertexEpsilon based on the performance mode, because it affects the visibility state of tokens etc. A player with low performance mode won't see some tokens that players with higher settings do in certain situations. I can see this causing a lot of confusion. Imagine the GM (low performance mode) wondering why their player (high performance mode) are able to see and target a token that is not visible if they select the player's token.

@dev7355608 dev7355608 added the bug Functionality which is not working as intended label Jul 2, 2022
@caewok
Copy link

caewok commented Jul 2, 2022

I agree that at the moment, the density can affect visibility in rare cases. If #7259 is resolved, this may cease to be an issue because the polygon approximation would use the exact circle-poly intersections. It would be pretty rare, I think, to see visibility affected at that point unless the polygon density is set very large.

Keep in mind, setting it to 1 means a maximum 1 pixel difference between polygon edge and circle circumference.

Thinking about this a bit more... If this continues to be an issue, it is conceivable that the visibility test could check for inclusion in the actual light shape along with the LOS/FOV tests. Not sure it is worth the trouble though.

@dev7355608
Copy link
Author

To add to this: lowering the circleVertexEpsilon doesn't really do much, because of the rounding in toClipperPoints (because of the lack of upscaling/downscaling). Both of these circle are generated with circleVertexEpsilon = 0.3. The first circle is not rounded, the second is. The rounded circle is clearly not particularly smooth in comparison.

image
image

@aaclayton aaclayton added the lighting/fog Issues related to dynamic lighting or fog of war label Jul 18, 2022
@aaclayton aaclayton self-assigned this Jul 18, 2022
@aaclayton aaclayton added this to the Version 10 - Testing 1 milestone Jul 20, 2022
@aaclayton aaclayton changed the title circleVertexEpsilon is too high Decrease circleVertexEpsilon in order to increase the fidelity of circle approximation. Jul 21, 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 lighting/fog Issues related to dynamic lighting or fog of war
Projects
No open projects
Status: Done
Development

No branches or pull requests

3 participants