Hacker News new | ask | show | jobs
by Sharlin 879 days ago
The value of v corresponds to how far away the intersection point is. At the horizon v=0 so the color value is just constant 0.2. The closer to the camera, the more the checker value (0 or 1) contributes. The exact values are probably chosen experimentally, but note the important property that -v*(checker/2+0.3)+0.2 is always between 0 and 1. Note also that 1 means black and 0 white here, as ultimately the value is negated at line 70.