Wow, haven’t posted here in a while. Glad to see my web hosting fees are going to good use! 🙂
Anyway. These days, I’m working on improving the shadow algorithm we use for our game. One of the common ways to improve the perceived quality of PCF shadows is to use a rotating Poisson Disk filter, but generating those coefficients was always a challenge. Not anymore…
In the past I’ve used the sample code from a paper called “A Spatial Data Structure for Fast Poisson-Disk Sample Generation”, but that command-line tool isn’t exactly intuitive. Still, I usually manage (after a few tries) to get a set of sampling points that work for my needs, and move on. Of course, the next time I need sample points, I don’t remember how I made the tool work and I waste my time again.
I’ve wanted to make a tool to generate Poisson disk coefficients for a long time, but never took the time to do it — the usual references found via Google aren’t exactly what I call “accessible”.
Fast-forward to last friday: I hit the jackpot, completely by accident. A remarkably simple generation algorithm (“Fast Poisson Disk Sampling in Arbitrary Dimensions”), totally easy to understand, and someone else already wrote the code in C#? Ok, I know what I’m doing this weekend. 😉
After a bit of futzing around (I haven’t done C# in a while, this was a good excuse to restart!), here are the results:
Finally, an easy way to generate those coefficients, and you can visually spot-check the resulting coverage. Don’t like the coverage? One click and you have a new set of coefficients, in ready-to-paste-in-your-shader form. How cool is that?
You can download the tool + source code here. There are no external dependencies besides the .NET 2.0 framework.
Let me know if you can find ways to improve it, or if it’s been useful to you.
PS: In case you don’t get it, “Poisson” means “Fish” in french. With apologies to Siméon-Denis Poisson…