On Jan 15, 2010, at 8:54 PM, Jonathan Gibbs wrote:

Well, I'm not sure what to think. The derivatives of mod(x,y) is the same as x most of the time, but at the discontinuity? Not sure what else you could really do since the function isn't continuous...

Well, there's "math" and then there's "what's useful in shaders." In the strict mathematical sense, the derivative is undefined at the discontinuity (x==d), though you could speak of the limit as you approach from x<d versus x>d. My guess is going to match at least one of those! I'm not sure what we can do that's any smarter or more useful in a case like this.