3 ms·
Should be noted that `fract(x)` is importantly only equivalent to `x - floor(x)` when x >= 0. Which it was in this case, but often negative values are also poss
by Sharlin 8d ago
Should be noted that `fract(x)` is importantly only equivalent to `x - floor(x)` when x >= 0. Which it was in this case, but often negative values are also possible/expected and the latter should be used instead. This is an easy mistake to make.
- SomeonesAccount 8d ago*former Good catch. OP should probably update the article
- Sharlin 8d agoNo, the latter. To make a lattice, we usually want to decompose x to floor(x) and whatever's left over, which is x - floor(x) and always nonnegative. fract(x) gives the leftover of trunc(x) instead and is negative when x is negative, and it's usually a logic error for a lerp variable to be outside [0, 1]. In this case, it creates artifacts along the coordinate axes.
- deleted 8d ago[deleted]