I am trying to learn some procedural basics. Could you tell me what the fraction math node does? Is the result similar to modulo?
Fract returns the fractional part of a floating-point value, as described by @Merlin, but its treatment of negative fractional parts is not actually the same as Blender's implementaion of Modulo.
If you want to see what a mathematical chunk of your shader tree is doing, it can be quite handy to make it generate a graph.
This plane is 8x8 units, with its origin, (so (0,0)), at its center. I've added the annotations, but you can see the function without them.
Thanks to @Rich Sedman for the very useful graphing tip.
$\begingroup$ Check out page 12 in this scrapbook below. I reconstructed Rich Sedman's node tree and experimentally played around with the settings in nodes. After that, I achieved over 16 interesting different patterns. docs.google.com/presentation/d/… $\endgroup$ Nov 26, 2019 at 13:03
$\begingroup$ Merlin, it is good to know usage of each node. I previously didn't know what modulo node was for. There are not many Blenderheads who are good at mathematics. I am relearning mathematics as a hobby. $\endgroup$ Nov 26, 2019 at 13:08
1$\begingroup$ @Merlin.. Nothing wrong with your answer, ( I UV'd it :) ) It was only after posting I remembered how often the Blender node mod had caught me out, before I made my own group to do it, and edited the answer.. In GLSL, for example,
fract(x)would be the same.. it's language dependent. A gotcha, not a bug, AFAIK. $\endgroup$– Robin Betts ♦Nov 26, 2019 at 14:14
2$\begingroup$ It's good to visualize how Blender implements these, they do not always follow mathematical principle, but will favour artistic usefulness. I have updated my answer accordingly $\endgroup$– MoogNov 26, 2019 at 14:16
1$\begingroup$ @RitaGeraghty .. some nice explorations! Recommend visiting shadertoy and having a go at translating some of those into Blender nodes, if you want a real work-out! :) $\endgroup$– Robin Betts ♦Nov 26, 2019 at 14:25
Mathematically it should return the fractional part of the number i.e the non whole-number part, but the blender implementation is artistic in it's implementation.
For non-negative numbers this is equivalent to using the modulo with a factor of 1.0
For negative numbers it is equivalent to using modulo with a factor of -1.0
The equivalent node setup of the fraction node would be: