4
$\begingroup$

How could I make this sort of texture using nodes as opposed to assigning materials to faces?

enter image description here

Specifically, I would like to be able to scale this in a Node Group.

$\endgroup$
8
$\begingroup$

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.

Here the node tree: Node tree

Which will produce the following result:

GIF

I can group it and expose the variable,and we got our node group:

Node group

$\endgroup$
7
$\begingroup$

An alternative solution allowing to have regular strips or barcode like strips.

enter image description here

Here is the node group setup :

enter image description here

Group inputs

  • Mapping vector coordinates
  • Scale of the strips
  • Mode to switch from barcode mode (0) to regular strips (1)

Group output

  • a factor between 0 and 1. Or exactly 0 or 1 if the mode input above is 0 or 1

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) :

  • We recombine the input vector but eliminate the Y value
  • A noise texture : the noise is stretched along Y as Y is 0
  • The noise texture is scaled by the scale input
  • A greater than to obtain 0 if the value is less than 0.5 and 1 if the value is above 0.5 : that gives the strips.

The blue part is for the regular strips (left to right) :

  • A scale factor by PI (=3.14159). This previous scale factor is chosen, because we take a sinus to obtain a variation from -1 to 1
  • A multiplication by the X vector coordinate
  • The sinus
  • A greater than to obtain 0 if the value is less than 0 and 1 if the value is above 0 : that gives the strips.

In yellow a mix node which takes into account the mode we want : 0 for barcode like strips and 1 for regular strips.

$\endgroup$
2
$\begingroup$

Good question! I prefer to use a Checker Texture and a Vector > Mapping node.

enter image description here

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.

enter image description here

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.