Fink IT
Published in

Fink IT

Imitation of textile texture in Maya 3D

This article is part of my series of ‘Learning 3D animation’, where I cover problems I’ve solved, learning materials I’ve used and buttons I’ve clicked. Feel welcome to join me.

Universal message

You will get a grip on MASH tool and create moving repetitive structure. You will also learn how to twist things ❤

What I want to do

I would like to achieve a sort on waving cloth model, but with clearly visible threads. Later I would like to animate disintegration of those threads, therefore I cannot simply use nCloth with bump maps, I need to go deeper.

Tryouts

As I mentioned above what I simply could do, well… first I did exactly that. Using tools I describe thoroughly in this tutorial I created nCloth with tearable surface that I then tried to break alongside grid edges to achieve thread-like rip line. It turned out too flat and too symbolic, and I need some meat in my animation. I really would like to show the structure and dimension in the textile model. A nice bump map cannot provide this effect in my opinion.

Then I discovered I could perhaps imitate a real life example. I could combine the textile from scratch — in this case, from thread. Then I would duplicate threads and create a checker-like pattern. Adding some random repetitive movement could do the work for waving.

The outcome is a little big shabby and anyone with any know-how about textile production would laugh me out, but I achieved what I needed to process further with my project and I would to share my ideas with you down here.

This tutorial will be divided to three parts:

  1. Creating a 3D thread or rope
  2. Creating pattern of the thread using Maya MASH
  3. Creating movement to the pattern — wavy-like

So, let’s do this.

3D twisted thread

To create thread I followed this tutorial by Mike Hermes. If you prefer learning from video, please feel free to do so and just skip to the next part. If you prefer the text, below is my take on his example.

We will start by creating a base for a single string. In Maya you have the option to create round plane, but it comes in packet with many faces dividing it. I would like to have a circle-like shape with no division so to do this Mike presents this little trick:

  1. Create a cylinder (pic. 1)
  2. Set cylinder’s subdivision caps to 0 (pic. 2). This will remove the subdivisions from bases.
  3. Right-click on cylinder and select Face. Now you can select all the faces (pressing shift key) except the top base of cylinder. Having that selected, press delete key.
Pictures 1 and 2
And so you end up with a circular shape

Having your circle done use ctrl + D to duplicate it three times and spread evenly on grid. The final effect should look like this:

Four circles spread

You better make sure that the circles are aligned to one another, because now we will make them blend into one shape using Mesh->Combine. Select all four shapes and choose the appropriate function in the top menu in Maya modeling.

Having selected all shapes choose Mesh > Combine

We almost have our base shape to form the thread. Now the last thing to do is to ensure that the pivot of the combined shape is exactly centred. If it’s not or you’re not sure, select it and choose Modify -> Center Pivot.

Ensure that the pivot of the shape is centred.

There you have your base for thread. We still need to go through last preparation steps. First of all, position your new shape in the very center of the grid in all orthogonal views:

Center your shape in all the grid views

One you’re done select front-Z grid. Now we are going to select curve tool and create vertical spine for our “thread”. You can find curves in Curves tab or in menu Create->CurveTools->Bezier Curve Tool (or other curve tool of your choice). Now drawing a curve is as simple as clicking on the points alongside it’s desired path and curve will spread automatically. Start drawing the curve in the center of the grid. When you’re done with creating points, just press escape. To modify curve right-click on it and select Control Vertex. Now select desired vertices and adjust them using Wegde tool (left side menu or press W).

Curve tool, drawing curve and manipulating curve

Once you are happy with your curve, we can switch again to perspective view. Now, right-click on base shape and choose Face view. While pressing shift select all four faces of the shape and then the curve. Remember, the order of selection is important. Having items selected, choose Extrude from Edit Mesh->Extrude.

While pressing shift select all four faces and then curve, then choose Extrude

Here the magic happened — the faces “grew” into tubes alongside the curve spine. This is a very handy tool when you want to create some plants and weirdly shaped branches. You can use this trick with any base shape you want.

The outcome is not yet close to the desired thread though. We need to make some adjustments. Firstly, the tubes seem not to follow the curve smoothly. That is because they are actually basic cylinders of the height equal to curve’s length. To maintain the curve’s shape, we need to increase divisions on cylinder walls. In the extrude menu, increase the divisions amount. Play with the number so that you choose high enough to achieve best result, but not higher than that — in the end, we always want to use the least number of faces possible. Once you are happy with the shape, time to add the twist. If there is no twist setting in the extrude menu, press the tiny circle in it’s right top corner. This button should expand the options menu, where you can find the twist. Check it on and now increase it’s amount. Remember, this will probably be a quite big number to create thread-like rigid twist. In my case, it was 2000. There you have it, your thread!

Play with divisions and twist to create desired rope shape

Even after creating the extrude, you can adjust the curve and base shape to modify it

Creating a pattern with thread and MASH

We are going to be creating the pattern using MASH tool in Maya. If you are not familiar with what MASH is, it is a powerful tool for creating procedural animations and modifications from objects and their multiplications. Basic MASH network comes with a Distribution node which immediately creates several copies of original object. You can add more nodes to create sophisticated, rich animations, using sound, dynamics and many distortions and variations. List of all the nodes can be found here.

To get started, select the thread object, switch the menu to FX and choose MASH->Create MASH network

As I mentioned above, you will instantly see that the network has been created with Distribution node by default. It is what we will use first. To see the node list like on image below, choose from menu MASH->MASH Editor.

MASH network by default is created with Distribution node

Now we will modify the distribution node a little bit to create two threads perpendicular to each other. To achieve this, reduce Number of Points to 2 and manipulate distance and rotation to position the threads properly. In this case we need to lower the second thread by 20 units in Z axis and rotate by 90 degrees (perpendicularly) in X axis.

Distribution settings to make threads perpendicular to each other

Next step will be to add another node that will multiply the threads in the same plane, but alongside their rotation. We will use the Replicator Node. To create a new node, you can select a plus icon in the Mash Editor or chose it from Attribute Editor like shown below.

In the Replicator change Transformation Space to Local. Then feel free to play with offset and replicants values. In this case it is 20 replicants with -1 units offset.

Replicator node settings

Now that I’m writing this tutorial I think I might should have used Orient node instead of rotation angle in Duplicate. I will check it out and edit this if results are better.

Outcome net

As you can see in the images above, the result may not be a perfect knit imitation but it certainly bears resemblance to a zoomed-in textile structure. You can edit replicants and offset to create more or less dense net.

Creating movement of the texture

We would like the texture to be waving a little like a cloth hanging on a dryer. Just to make it lighter, because as I see it, now it could be mistaken for a military facility fence. In the process I will show you how pleasant and easy MASH animation is.

If you have never done any animation in Maya check out this video by Yone Santana in example.

Let’s start with animating the bezier curve. Yes, we will add animation to the very base of the very core object of the whole structure and see what happens.

To do that, select bezier curve from the outliner. Now switch the menu to Animation and select Deform->Nonlinear->Twist. As a matter of a fact, you could choose and of those nonlinear functions listed and play with it, checking out what suits your needs best.

My animation is 200 frames long. I stay on the frame 1. In the twist menu I right-click on Start Angle and select Set Key. I repeat that for End Angle. Notice, that it highlights bright red. I go now to frame 104 (a. middle) and change both values to 360 and again click on Set Key. Then I can go to frame 200 and change both values back to 0 and yet again click on Set Key.

Animating the bezier curve
Twisting the core bezier curve

What I achieved now is thread slowly rotating back and forth around it’s core. In the whole net it adds a bit of wave, but it is still too stiff and subtle to my taste.

We would like the threads to move independently, yet in synchronisation with each other. We would also like to animation to be instantly looped if possible or at least easy to do so. To achieve that, we could use the Signal Node. Choose it from from the MASH in Attribute Editor as you did previously with Replicator. After adding this node you will notice the net has distorted a little bit too much, but do not worry, everything can be adjusted.

Signal Node default settings
Signal Node animated

Signal Node has several properties you need to pay close attention to. First preset is Signal Type. Be sure to check out different types and see whichever suits your project best. Next important factor is setting the positions. First decrease them to 0 and then check how strong you want your movement to be. In this project I tried first setting positions X and Y to 0 and Z to 1.

Additional Signal Node settings

You can choose to play with Signal Node a little more.

For instance, I didn’t like mechanical, parallel movements of the threads, I was still aiming for a bit softer effect.

Therefore I slightly increased Octaves value. The higher value the more detailed the noise gets. To learn more about octaves check the Signal documentation.

Animation got more detailed, but in the same time seemed too fast, do I substantially decreased Time Scale to slow it down.

Signal node with octave adjustment

In the gifs animation may not seem too different due to frame rate. You should however learn now how to use those settings to your own benefit.

Last step for the final effect could be to dense the net a bit to resemble real textile piece. This can come out tricky though, since there is already a lot going on in terms of animation and threads have quite a lot of faces. My machine is strong, but I still noticed a real slow down after increasing the density. If you are working on a PC with nor enough RAM and dedicated GPU, please be sure to save your project first :)

Altered settings of

To increase the density choose Replicator properties and simply increase number of replicants.

To maintain the square shape of your net, be sure to decrease the offset proportionally.

In this case, since I double the number of replicants (previously 20), I divide the offset also by 2 (previously 1 unit).

Dense textile structure

Conclusion

And that’s it! Pretty neat, isn’t it? I will play more with waves spread, because I don’t quite like the regular bumps.

You should also feel encouraged to play with MASH and extrude more to create your own effects. The possibilities are quite wast.

This article is based on a part of my engineer thesis. All the screenshot belong to me and depict my original work.

I use Maya 2018 Student Version.

--

--

Not working and you don’t know why? I don’t either. Let’s fink together.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Magda Odrowąż-Żelezik

Creative front end developer, currently excited about learning 3D graphics. Visit magdazelezik.com