3 ms·
Interesting approach. I'd be shocked if an algorithm based on two polar transforms, plus resampling, was ever faster than more traditional raycasting based algo
by kevingadd 14y ago
Interesting approach. I'd be shocked if an algorithm based on two polar transforms, plus resampling, was ever faster than more traditional raycasting based algorithms (see http://www.redblobgames.com/articles/visibility/ http://www.redblobgames.com/articles/visibility/ for one detailed example) - especially given that you can do the raycasting algorithm entirely in hardware now on pretty much any machine, including the resampling.
Maybe you could do the polar transforms in a pixel shader to make up the difference? The transform also seems to introduce a not-insignificant amount of error, which is unfortunate if you want to use visibility data for AI (in which case you want full precision at whatever your target resolution is).
- JasonSage 14y agoObviously a hardware accelerated implementation would be ideal if not required, which is why I was going to first implement this in a shader, if possible. The artifacts you mention are sort-of inherent in shadow maps, and depend on the resolution of shadow map you are working with. The demonstration I did had a lot of error, but you can see at the bottom some examples of higher resolution test cases which have significantly less error.
- kevingadd 14y agoIf you use a raycasting method, you can rasterize a shadow map with exactly the amount of precision you need and not have any artifacts (for 2d, of course - for 3d the necessary amount of precision is hard to calculate and sometimes prohibitive). My old game Chimaera ( http://www.luminance.org/chimaera.html http://www.luminance.org/chimaera.html ) did this - lightmap rendered at full screen resolution (1-1 mapping) in full precision, with an on-demand raycasting solution for offscreen pixels. A raycasting method also allows you to cache the shadow data for static geometry and static light sources, which can be a big win for complex scenes. (I think maybe you could cache the polar data, but it wouldn't be as easy since you can't just translate by x&y like you can with a normal 2D perspective?)
- JasonSage 14y agoFor line of sight you couldn't cache, no, but for static lighting you certainly could.