caewok / fvtt-token-visibility

Advanced token visibility rules for Foundry VTT
MIT License
4 stars 8 forks source link

Tiles and vision/cover #41

Closed gurgugnao closed 10 months ago

gurgugnao commented 1 year ago

Hello, I noticed just now that tiles boundaries are counted in the 3D algorithm to block vision or add cover, although the rectangular boundaries of the tile are virtual. Is it possible to add an option to exclude them? Thanks!

caewok commented 1 year ago

Yes, probably. I can probably at least exclude outer portions of tiles that are transparent. (I don't think I could simply exclude all transparent tile pixels in the 3d algorithm b/c that algorithm constructs polygons from the tiles. I would need to move everything to a WebGL shader if I wanted a more sophisticated version, which would be hard plus it might end up slowing things down as data would need to move back-and-forth between the GPU and the CPU.) I will take a shot at it.

gurgugnao commented 1 year ago

Thank you for the prompt answer! I understand your reasoning, but why do not remove (or add an option to do it) the tiles directly from the algorithm and just use walls to construct polygons?

caewok commented 10 months ago

It will only treat tiles as blocking if they are overhead tiles. So you do have some ability to ignore tiles already.

If you want the tile to block but you want to track the actual tile outline, that can be done by treating the tile as a polygon and not a rectangle. It takes some processing to do, although Foundry tends to cache the tile pixels so that helps quite a bit.

Upcoming v0.6.0 can switch to webGL to handle the transparent portions of tiles. I also intend in v0.6 to better handle tile outlines