Wednesday, June 25, 2014

Striping a Curve in Blender/Cycles

File this little tutorial under "maybe obvious to everyone else but me", but here is a way to add some interesting striped texture to your blender curves that have a bevel object.

To start we add a bezier curve and a bezier circle, then in the curve properties tab for the curve object, we add a bevel object of the curve. This ends us up with a simple tube looking object.

We can of course assign it a uniform texture, but what if we want stripes?

We could add a checker texture to start, but that does not map nicely by default.

 First turn on "Use UV for texture mapping" under the "Texture Space" panel in the curve options tab. Then add a UV texture mapping node. As you can see we are already a ways there.

Right now we can control two colors, but what if we want to control two shaders instead? Instead of feeding the checker into the color input, we will use it to control a mix shader. You can adjust the two colors of the checker shader to determine the mixing values of the checker pattern. Full white/black will give you only each shader on each square. I have kept the white/grey here for no apparent reason.

But we do not want a checker pattern, we want stripes. So to do that we will adjust the UV vectors. To do that we will break apart the UV vector into it's components. If you are not using a version of Blender with with Separate XYZ node, you can use the Separate RGB node to do the same thing.

 Next, add in Math nodes in between the X and Y components (or R&G if you are using the color nodes)

By setting the math nodes to multiply, you can see that the X component affects the checkers along the curve and the Y component affects the checkers around the curve.

So if we set X to multiply by 5 (or whatever size we like) and the Y to 0, we get nice stripes. 

Here I changed one of the mix shaders inputs to a glossy shader so we can see one type of effect we can get.

These are not the only way to mess with the position of the UVs. Try some of the other vector nodes to see what you can accomplish! Try setting keyframes on them to change the pattern over time! 

Go crazy!

As you can see here, mapping an image can also be good, with or without the striping! The Mapping Node can really make this easy as well.

Post a Comment