How can I make a radial checkerboard pattern like this in the shader editor?
2 Answers
One method is to use two checker textures, one driven by a radial gradient, and the other driven by a spherical gradient, then combine the two together using a mixrgb node set to difference. Here are the results and the node setup.
If you want something besides black and white, you can pass the output from the difference node into a color ramp with two colors.
If you want more than 2 colors, you can change the two checker texture nodes to be 4 different colors, then use a 4 node color ramp to adjust as needed.
-
2$\begingroup$ Very nice :). You can actually use the Black&white output as a mask for any other color combination. $\endgroup$ Dec 20, 2021 at 9:24
-
$\begingroup$ Agreed.. but I'm still trying to get my head round the logic :) $\endgroup$– Robin Betts ♦Dec 20, 2021 at 14:53
-
3$\begingroup$ I'm seeing four colors - is this just an optical illusion thing? $\endgroup$– ArsenalDec 20, 2021 at 15:19
-
1$\begingroup$ @Arsenal Looks like there's indeed a fourth light blue shade: i.stack.imgur.com/MaB3n.png $\endgroup$ Dec 20, 2021 at 15:44
-
$\begingroup$ +Jachym Michal Thanks for the idea, I found that using a color ramp worked and updated my answer. $\endgroup$– deltarayDec 24, 2021 at 2:57
A method to get polar coordinates in general is to use the (0-1) output of a Gradient > Radial texture as X, and the Length of the XY coordinate as Y:
The blue nodes above are just to ensure X is always an even integer, and give the user a basic interface, should you want to group the cluster.