How could I make this sort of texture using nodes as opposed to assigning materials to faces?
Specifically, I would like to be able to scale this in a Node Group.
Blender Stack Exchange is a question and answer site for people who use Blender to create 3D graphics, animations, or games. It only takes a minute to sign up.Sign up to join this community
Shady's Answer works only in this scene and not only in all,So you will have to edit values per scene.
And that's why I prefer using some math Instead.
To get information about our object we will use the texture coordinates node,and use Generated coordinates.
Suppose you want the strips to be vertically,then you should use the Z axis only of the coordinates and that is by using Separate XYZ node.
Now let's do the math,I will first multiply the Z axis by a variable integer which is equal to the number of black or white strips.
Then I will Modulo the result by 1,Which means I repeat the gradient every 1,and since we multiplied the axis by "say 5" then we will repeat 5 times.
Now we have a number of gradients,I will limit them to be either white or black using Greater than node.
Which will produce the following result:
I can group it and expose the variable,and we got our node group:
An alternative solution allowing to have regular strips or barcode like strips.
Here is the node group setup :
In red is a separate XYZ because we will rely on X value and don't use the Y value : this will give vertical strips. If you want to have horizontal or other, just change the input vector with a mapping, for instance.
The green part is for the barcode (left to right) :
The blue part is for the regular strips (left to right) :
In yellow a mix node which takes into account the mode we want : 0 for barcode like strips and 1 for regular strips.
Good question! I prefer to use a Checker Texture and a Vector > Mapping node.
Note the small Scale: > X: value. It is what turns the Checker Texture into stripes. Also note that I used Generated Texture Coordinates. This works for most simple objects and eliminates tiresome UV Mapping. This node setup produces the following result when applied to a plane.
Note the orientation suggested by the three axes in the bottom lefthand corner of the 3D Viewport. In a different orientation, you may have to toy with the Scale: > Y: or Scale: > Z: values. Also note that as you increase the Checker Texture > Scale: value, you may have to decrease the affected Mapping > Scale: value.
Unfortunately, the Mapping > Scale: values cannot be accessed inside a NodeGroup.