Previously a production blog for my final year project ( you can still find the old posts of WIP images) YOu have stumbled across a collection of knick knacks and tutorials for 3D CG...
Wednesday, October 28, 2009
Monday, October 26, 2009
Tuesday, October 20, 2009
Sunday, October 18, 2009
Outlining the Shirt
- It may help later on if you create these curves in a single direction (clockwise or counter-clockwise).
- These curves form a closed loop. They are not attached to each other but rather where one curve ends, another begins (a little Zen philosophy for Maya). Figure 2 shows exactly how many curves you need to create (twenty-six).
- If you created the curve end to end without any breaks, just insert a few knots here and there and detach them.
- If you're wondering about the cuts on the sides of the torso, don't worry. They are there for creating a dart in the cloth.
- Why there are so many curves? Its because we need to create seams later on and creating seams uses the curves the cloth object is created with, not the cloth itself.
2. Select all the curves and duplicate them. With the new set of curves still selected, pull them forward about 2 units (Translate Z=2). This set will be used to create the front of the shirt. Add another curve to make the collar opening and delete the curves that cross the collar.
3. Select the curves for the backside and put them in a layer and hide them for now and name the layer backside_curves. Select the front curves and put them in a layer called frontside_curves.
1. Next we're going to create the panels. Each panel must be created with a closed loop but cannot use the same curve twice. Duplicate the curve between the sleeve and the armpit (Figure 4). Select the four curves that make up the sleeve and in the Cloth menu select Create Panel (Figure 5).
2. After you create the panel, name it panel_FR_sleeve. The channel box lists only one attribute called Resolution Factor for the panel_FR_sleeve. Keep this guy in mind later on when we deal with cloth resolution issues.
3. Continue on creating panels and naming each one. Remember not to use a curve that was used previously for another panel. If you're not sure if a curve was already used, select it. If a panel turns pink, then that means that curve is being used for that panel and you need to duplicate the curve (Figure 6). Once you have finished creating all five panels (panel_FR_sleeve, panel_FR_armpit, panel_F_torso, panel_FL_sleeve, panel_FL_armpit) you should have something that looks like Figure 7.
- If for some reason you need to change the shape of the curves, you'll need to disable the solver for all panels (Simulation > Disable Solver) and move around the Control Vertices.
- When you're done adjusting the curves, be sure to enable the solver again (Simulation > Enable Solver).
4. Select all the panels and put them in a layer called panels and hide it for now.
5. Unhide the backside_curves layer and hide the frontside_curves layer and repeat steps 4-7. Name each panel with the panel_B... instead of panel_F.... I use these naming conventions for back (B) and front (F).
- If for some reason you need to move the garment(s) around, you'll need to disable the solver (Simulation > Disable Solver). Select the curves, not the cloth object, and move it to its new co-planar location. When you're done moving the curves, enable solver again (Simulation > Enable Solver).
- You can also move the garment by selecting the Cloth Mesh (right-click the garment) and move as needed. Once you have finished moving/sculpting the garment, hit Simulation > Save as Initial Cloth State. This second technique is very useful if you're trying to costume fit a round location (belly, beasts, etc.).
3. Our next task is to connect all these individual cloth objects into one piece. This is done by creating seams. Seams are created by selecting the curves that are next to each other as I mentioned earlier in step 1. Select the two curves (that are sitting on top of each other) between the FR_sleeve and the FR_armpit and hit Create Seam. Name each seam as you create them (seam_FR_sleeve, seam_FR_armpit, seam_FL_sleeve, seam_FL_armpit).
- If you run into problems with the seam causing the cloth to connect badly, you may have to go back and recreate the panel from scratch. Try selecting each curve in a clockwise or counter-clockwise motion and recreate the panel, garment and everything else normally.
- Sometimes you may need to seam the garments together in different orders for the cloth to be completed seamed together. Experiment with different seaming orders and note your results.
4. Now we should be ready to close up those darts. Select the two curves that make up the ‘hole’ and Create Seam.
5. Next select each curve on the front and back sets and create seams between them to close off the cloth object. This step will take a few tries depending on the order you seam it shut. Once completed, your shirt should look something like Figure 10. Name the cloth object Shirt.
6. Next I should talk about creasing the seams. Each seam has two attributes: Crease Angle and Crease Stiffness. Crease Angle creates the look of two pieces of cloth sewn together. The values to use for Crease Angle should be between –180 and 180. Adjusting the Crease Angle lets you control more likes on the cloth object like lapels. Crease Stiffness tells the seam how much to resist being pulled flat. For the darts on both front and back, I used a Crease Stiffness value of 0.5. For the sleeve seams I used the Crease Angle of 45 and Crease Stiffness of 1.
7. Change the cpStitcher's Base Resolution to 400.
1. Next create a simple poly body to use a collision object for the Shirt. Refer to Figure 11. Name the polygonal object Cloth_collide. With the Cloth_collide object still select, go Cloth > Create Collision Object. Set the Collision offset to 0.15 and Collision Depth to 0.4.
- These numbers will vary from model to model but the general rule of thumb is that the Collision Offset should be half or less of what the value is for Collision Depth.
- Collision Offset is the distance the cloth must stay away from the collision object. Collision Offset is affected by size of the model. So if you have a small character (10 units or so) you should decrease the default value (which is 1). Collision Offset is not affected by the Solver Scale however.
- Collision Depth is the distance the cloth object can penetrate the collision object and still be repelled but once its past this it won’t try to repel the cloth object.
- Collision Priority (use with multiple collision objects) determines which collision object takes priority in simulations. So if you have a character with a long skirt attempting to sit in a chair, you can tell the cloth which collision object has collision priority of which one not to penetrate.
- Important note: The surface normals of the collision object should be facing out. If any of the collision object normals are facing inwards, it will pull the cloth in.
2. On the shirt, there is an attribute called cpSolver1. In cpSolver1, change the following attributes: Solver Scale = 10 and Relax Frame Length = 1. Relax Frame Length makes the cloth act more rubber-like or gives it bounce.
3. Now we’re ready for the big simulation. Rip off the Simulation panel and leave it open as a floating menu because you'll be going back and forth with testing and running simulation after simulation to get that shirt to fall just right. Go to Simulation and hit Start Simulation. This will start the solver and drape the shirt across the Cloth_collide object. Once the shirt has fallen to a position that looks pretty good, hit Stop Simulation. From here on, you’ll have to tweak the numbers to get the desired results. Every time you make an adjustment to the Shirt or Cloth_collide object, you should delete your Cache (Simulation > Delete Cache). Once you find a simulation that drapes pretty well, hit the Save as Initial Cloth State. This will keep the shirt in the solved pose from here on out.
4. Once you have the shirt simulated just the way you like, you should animate the Cloth_collide object to test the shirt completely. Animate the Cloth_collide object forward, back, up, down and some twisting motions (in other words, all the motions you body may do).
- For a more thorough test of the shirt and Cloth_collide object, add more divisions to the Cloth_collide object, create a skeleton to act like the spine and smooth bind the Cloth_collide object. Animate the Cloth_collide object with torso twists, forward/backward spine bends and left/right spine bends.
- The curves used to create the panels should not to be connected.
- Closed loop curves does not mean attached. That simply means the end vertices are sitting on each other. Where one ends, another begins.
- Maya will not solve properly if you don’t have your playback speed set for every frame. This is not an issue if you just use Start Simulation instead of hitting the play button.
- Start out your Base Resolution low (300 or so) and work your way up.
- If you have a few vertices that continue ‘jump’, it may be a resolution issue. Up the resolution 25-50 increments at a time to see if that corrects the jumpy vertices. If not, Disable Solver, right-click the shirt and translate the vertices away from the area they are having issues with. Hit Update Cloth State. Enable Solver, Delete Cache and start another simulation.
- If you have a hard time locating the offending vertices, in the cpSolver attribute, turn on Output Statistics and Maya will output the return values of each simulation in the Script Editor history.
- To reduce the vertices from popping, try adjusting the Velocity Cutoff Min attribute between 0 and 2. If necessary, you can keyframe this attribute during animation to help with the popping.
- To set keyframes without scrubbing through the simulation, use the middle mouse button and click on the keyframe where you want to key.
- Figure 12 shows the results of the darts we included in the sides of the shirt.
- Another fun tool is the Paint Cloth Properties Tool. From this menu, you can paint a greyscale value to almost every attribute available to cloth. I’m not going to cover those in this tutorial because there are so many choices to choose from and combinations to get the exact feel that you want. Just remember, painting these properties will add to your simulation time.
- One attribute that I do paint is the bendAngle attribute with a weight between 0.1 and 0.23. This will cause some interesting wrinkles. It takes a little practice (and a lot of patience) to learn how to paint a wrinkle.
- Be sure to save your cloth cache also (Attribute Editor > cpSolver1).
- You can also adjust the Velocity Cutoff Min, Velocity Cutoff Max and Velocity Dampening. These three attributes tell the shirt how fast to react to the overall motion of the shirt. Maya comes with a few samples of shirt setups (value settings for various cloth types) in extras/cloth/properties directory.
Wednesday, October 14, 2009
Monday, October 12, 2009
Final Lighting Test from maya with color correction in Photoshop, comped in the 2d fire with sparks and smoke (have yet to create the emitters for smoke and sparks :P)
An ambient Green eerie Light bouncing around the room which is primarily lit by a fierce fire pit. Think the Great Hall in Beowulf.
Friday, October 9, 2009
Wednesday, October 7, 2009
Tuesday, October 6, 2009
Thursday, October 1, 2009
Monday, September 28, 2009
Friday, September 25, 2009
Creating A Velvet Shader
Hello, this is a tutorial on how to create a velvet shader within maya, although this shader can be primarily used to simulate velvet, it also has other use's too, which we will go into later. This tutorial also introduces the user to the Sampler Info node, of which we will be utilising the facing ratio, again, more later. I've created this simple model, you can create your own model, it's similar to a cushion.
In order for us to see things a bit more clearly that our end result will be working I have added some small additions such as wrinkles that will hopefully gather light like velvet would, we will see this happening later. For now, depending on you preference, smooth your object using either Modify > Convert > Polygons To Subdiv and then press 3 on the keyboard for smooth display, or Polygons > Smooth (This will probably be defaulted at smoothing level 1, so apply it again to ensure a nice smooth looking object), you should now have something like this, see below : -
Next step, now open up your Hypershade, and create a new Lambert material, I normally like to name my materials, so I've named it Velvet_LambertM, as seen below : -
Red is usually a colour I associate velvet with, so open up your new materials options and click on the colour box and then change the colour to the following red, RGB = R 255, G 60, B 0 : -
Now, just so we can compare an original and a working version of our velvet shader, let's create another 'cushion', and move it across slightly so we can see it better, select your original object, press CTRL + D to duplicate it and then move it slightly to you right as your looking at the screen, see below : -
During this tutorial, I will be just using the FRONT view for doing renders, the original object I built has already been placed in such a way that it will catch the light quite nicely, so for now, do a quick test render, you should get something like this :-
Ok, that's fine for now, now we need to assign a new shader to the second cushion, the one that we will actually be working on to create the velvet look, open up your Hypershade, select your Velvet_LambertM shader, then outside of the box, right click and select EDIT > DUPLICATE > SHADING NETWORK, you should now have a second material called, Velvet_LambertM1 : -
Let's get straight into the rest now, open up your new material, and in it's options, click on the Incandescence options box : -
Once you've done that, within your 2D Textures area, select the RAMP node : -
Edit the ramp so that it look like this, you select the boxes on the right side to delete a colour entry list and you select the circles on the left side to create one or edit it's current colour, so delete the middle ramp colour entry and then edit the colours : -
Next, change the Type of Ramp to a U Ramp, this option essentially makes sure our ramp runs on the U part of the UV space of our object : -
Next, change the interpolation to Exponential Down, this option essentially favours the colour at the top of the ramp towards the bottom, i.e. the black will show more than the red in this current ramp : -
Now, to ensure a nice falloff for our velvet shader, we need to set up a much lighter colour of our red, I've made this version which is slightly off red, and kind of reaching into the pinks and oranges, obviously this would need to change if your object was a different colour, i.e blue velvet would require a nice sky blue cyan type colour for it's falloff, notice I have also moved the bottom colour entry list up slightly, you do the same : -
The colours I used for my falloff were, RGB = R 255, G 135, B 100 : -
Now the most important bit of the shader, the Sampler Info node, so again, open up your Hypershade, then scroll down to the utilities tab or alternatively do what I do and change where it says 'CREATE MATERIAL' to 'CREATE ALL NODES', and then just scroll down to where the sampler info node is, now middle mouse drag the sampler info node onto you work area as below : -
Then middle mouse drag the sampler info node directly on top of the ramp as shown : -
The Connection Editor should now open up automatically, the sampler info node will be on the left and the ramp will be on the right, find the facing ratio within the sampler info options (the facing ratio is calculated between the surface normals and the viewing angle) : -
Now, finally, do another a test render from the Front View, you should now have something like the figure below, which looks very nice and simulates a good looking soft velvety look, which is what we were trying to achieve : -
You can download the final scene file here, which includes the velvet shader : -
As you can see in these other examples, you do do any colours you wish, as long as you follow the rule of making sure you change the second colour entry in the ramp to match the colour you are creating a velvet shader for, for people who are wanting to take this further, you can add extra things like a very fine procedural bump to catch the light even more and look even more like velvet, it's up to you to experiment. I sometime use this type of shader for lot's of everyday objects, clothing, skin and cartoony looking objects, as it's just a nice shader in general, if you experiment further with the sampler info node you can also create effects like x-rays and electron microscope imagery. Well, that's it for now.Thanks for reading and I hope you find this tutorial useful.