|
Post by mystic on Jan 8, 2022 15:38:02 GMT
First off, thanks for the amazing book! I've had a lot of fun going through it.
I was just wondering if this is how the gradient from chapter 10 should look. Is it supposed to repeat?
|
|
|
Post by Jamis on Jan 8, 2022 18:29:16 GMT
Yup! That's correct. Remember that we constrain the gradient to start at "0" and end at "1", so without any scaling it'll repeat starting at every whole numbered x-coordinate (running from 0 to 1, 1 to 2, 2 to 3, etc.). If you want it to be wider, scale (and possibly translate) it in x.
|
|
|
Post by mystic on Jan 9, 2022 15:27:52 GMT
Great, thank you!
|
|
|
Post by kagonkhan on Apr 21, 2022 1:39:00 GMT
An example of how one can mirror the gradient, should anyone find it useful. if(Math.Abs(p.X - Math.Floor(p.X)) < 0.5)
return a + (b - a) * (2 * p.X - Math.Floor(2 * p.X));
else
return b + (a - b) * (2 * p.X - Math.Floor(2 * p.X));
|
|