Introduction to Vehicle Rigging and Custom UI Creation for 3D Art

advanced 3d art and animation n.w
1 / 18
Embed
Share

Explore the world of advanced 3D art and animation with lessons on vehicle rigging, Python scripting for custom UI design, Maya expressions for light animation, and rigging wheels and shock absorbers. Dive into creating a textured ground plane and wheels for dynamic motion simulation.

  • 3D art
  • Vehicle rigging
  • Maya expressions
  • Python scripting
  • Animation

Uploaded on | 1 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. Advanced 3D Art and Animation Lesson K (week 11): Introduction to Vehicle Rigging: Wheels, Shock Absorbers, Melscript Introduction to Python Scripting: Make a custom UI that makes a 3D box

  2. Intro to Maya Expressions: Let s use an Expression to animate a flickering light: 1. Open Windows > Animation Editors > Expression Editor. 2. Create a Rendering Shelf > Point light. 3. In the Attribute Editor: RightClick the PointLight Intensity value rectangle, choose Create Expression. The Expression Editor now includes a PointLightShape node in the left column, and the Intensity attribute on the right. 4. Paste this code at bottom: pointLightShape1.intensity = rand (0,1) 5. Hit [Create]. 6. Hit [7] and Play the scene to see flickering. 7. Change values for dim and bright range ends and hit [Edit]. Melscript Expressions are found on the attributes it effects. To edit this script later, select the Point Light, in the Attribute Editor RightClick the Intensity rectangle again, this time to pick Edit Expression (NOTE: Create or Edit Expression automatically opens the Expression Editor).

  3. Rigging Wheels and Shock Absorbers: The following tutorial covers an essential component of most vehicle rigs: a shock absorber. This tutorial uses: 1 Plane (ground, to control wheel bounce) 1 Torus (wheel) 1 checker-texture material (to help show motion) 1 solo Joint (to rotate the wheel) and 1 chain of 3 Joints (to manage piston dynamic) 6 Cylinders (vehicle body, axel, and two sets of shock absorber pairs) 2 Point Constraints (both with Maintain Offset, one with just the Y axis) 3 Aim Constraints (all with Up and Aim Vectors set to 0, -1, 0) For fun: 1 melScript Expression to simulate dynamic motion Notes for this lesson are derived from this excellent tutorial by Patrick Cavender, Technical Artist at Blizzard: http://www.pc-3d.com/rigging/advanced.htm

  4. Vehicle Rigging: Create Plane & Checker Material [A] Set the project to meters and create a textured ground plane and wheel to act as a reference for motion: 1. In the lower right corner click Preferences, find Settings, and set Working Units > Linear to Meter. 2. Create a Polygon Plane: Width and Height =5, Subdivisions Width and Height = 1. Name it GroundPlane. 3. In the Hypershade make a new Lambert material from the left-side Create options, name it Lambert_Ground (please never touch the original Lambert in the Materials library, above). 4. In Properties: Next to Color click the checkered square, add a Checker node. Set colors to reduce eye-fatigue. You can select the place2DTexture1 node to set tiling I left mine at the default 4 x 4. 5. Drag the Checker Lambert onto your plane, hit [6].

  5. Vehicle Rigging: Torus Wheel and AxelJoint [B] Create a Torus and Joint to act as a wheel and axel: 1. Create a Torus: radius 0.5, radius section 0.2, 0, subdivs 20. Name it Wheel, apply the same Checker material. 2. Rotate the Torus on Z = 90 degrees so it is upright. 3. Move Torus up on Y = 0.7 to stand on GroundPlane. 4. With Torus selected, apply Modify > Freeze Transforms. 5. In the Rigging module, click Skeleton > Joint Option Box. Set rotations to X, Y, Z, and close. Create a single Joint in the Viewport and hit [Enter]. If it is too small to see, use Display > Animation > Joint Size. Name it AxelJoint. 6. Place AxelJoint in the Wheel Torus center by giving it the same Translate values in the Channel Box: (0, 0.7, 0). 7. Make Wheel a child of AxelJoint: select the Torus, select the Joint, hit [p]. The Joint is the Wheel s rotation point.

  6. Vehicle Rigging: Shock Absorber Set-Up [C] Set up the shock absorber as a 3-joint chain: 1. In the Side view set camera View to X-Ray mode. 2. Create a 3-Joint chain in a 90 degree bend: {?} a) (0, 1, 0): Above AxelJoint, touches bottom inside of Wheel b) (0, 0.5, 0.5): Centered in the wheel at about 4-O Clock c) (0, 0, 0): World center, base of the wheel. NOTE: Holding [x] key while creating joints snaps them to the grid. 3. Skeleton menu > IK Handle Option Box. Be sure it is set to RotatePlane (default) and hit [OK]. Click the top chain Joint and then the bottom (the order actually does not matter: Maya knows to put the IK handle on the child of the chain). 4. In the Persp view, constrain the IK handle to the ground: select GroundPlane, [Shift]+select the IK Handle, open Constraints menu > Point Option Box, turn on Maintain Offset, hit [Apply]. 5. Select the bottom chain Joint (Not the IK handle) and [Shift]+select AxelJoint. In Constraint > Point Option Box set Constraint Axes to just Y (and leave Maintain Offset on). Hit [Apply]. This holds AxelJoint and the IK joint together while keeping AxelJoint off the ground.

  7. Vehicle Rigging: Vehicle and Axel Meshes [D] At this point, the rig is functional; we just need some attached geometry to show off the work. 1. Make a poly Cylinder (radius 0.4, height 1), name it Vehicle. 2. Move it on the Y axis = 2.2 units. 3. Apply Modify > Freeze Transforms (IMPORTANT!). 4. To make sure it cannot overlap the wheel, set limits on its Translate values in the Attribute Editor. Hit [Ctrl]+[a] and click on the Vehicle tab. Find Limit Information > Translate > Trans Limit Y to turn on at both sides, and set Min = -0.4 and Max = .4. 5. Select the top chain Joint, [Shift]+select Vehicle and hit [p] to make the IK chain a child of the Vehicle. Hit [w] to select and move the vehicle up and down to see the effects of our rigging. 6. Make a second cylinder (radius 0.1, height 1). Name it AxelBar. 7. Rotate Z = 90 and Move to (0, .7, 0) to place it in the wheel center. 8. Modify > Freeze Transforms (IMPORTANT!). 9. Select AxelBar, [Shift]+select AxelJoint, and hit [p] to make AxelBar the child of AxelJoint.

  8. Vehicle Rigging: Shock Absorber Meshes [E] Now we need to make our Shock Absorbers: 1. Create a 3rd Cylinder: (radius 0.1, height 1.5). Name it ShockA. 2. Move to (0.5, 1.4, 0) so it is placed at the end of the AxelBar. 3. DON T Freeze Transforms on this one; just make ShockA the child of AxelBar (select ShockA, [Shift]+select AxelBar, hit [p]). 4. Move ShockA s pivot to cylinder bottom. Select ShockA, hit [w], and then [d]. Hold [v] to snap to the bottom center vertex. 5. Create a 4th Cylinder: (radius 0.2, height 1.4). Name it ShockB. 6. Move to (0.5, 1.8, 0) so it is placed higher than ShockA. 7. Make ShockB a child of Vehicle: Select ShockB, [Shift]+select Vehicle, hit [p]. Use 2 Aim constraints to keep the cylinders pointing at each other: 8. Select ShockB, [Shift]+select ShockA. Open Constraints > Aim options. Set Aim Vector (1,0,0) and Up Vector (0,1,0), Constraint Axes = All. Hit [Apply]. 9. Select AxelBar, [Shift]+select Vehicle. Open Constraints > Aim. Set Aim and Up Vectors to (0,-1,0). Hit [Apply]. 10. Move Vehicle around! If the top of ShockA escapes ShockB when ShockB gets hyper-extended, you can move the ring of vertices at the top of ShockA upwards in the Vertex component mode.

  9. Vehicle Rigging: Duplicate Shocks and Save [F] Duplicate the Shock Absorbers: 1. Select both Shock cylinders, Edit > Duplicate Special Option box, choose Copy (turn off Instance), hit [Apply]. 2. Move the duplicates to the other side of AxelBar (Translate X = -0.5). 3. Apply Aim Constraint: Select ShockB1, [Shift]+select ShockA1. Open Constraints > Aim options. Set Aim and Up Vectors to (0,-1,0), Constraint Axes = All. Hit [Apply]. [G] The full rig is complete! 1. Save your file: YourName_VehicleRig. 2. To animate: Select Vehicle to Move on the YZ plane for vehicle motion and GroundPlane to animate Wheel- bounces. 3. To create a quick simulation of dynamic motion, along with an animated texture on the ground and a slider to manage speed: See how to add an expression on the following slide, but first Save As to make a new copy (as this will mess with our rig): YourName_VehicleRig_Anim

  10. Vehicle Rigging: Animate Texture Offset [H] Animate the Checker texture to simulate motion: 1. In the Hypershade RightClickHold Lambert_Checker to choose Graph Network. Note the chain of nodes in the bottom Work window. 2. Select the left-most node: place2DTexture. In the Property Editor rename it "myPlace." This node controls the placement of the checkers on our objects. It includes attributes like "RotateUV" and Offset. All of these attributes are keyable. We can also attach Expressions to them. 3. Open Windows > Animation Editors > Expression Editor, add the following melScript, press [Create]: if(!`window -q -exists throttle`) {window -title "throttle" throttle; columnLayout; floatSliderGrp -label "speed" -min 0 -max 5 -v 1 -field true speedCtrl; showWindow throttle;} float $speed = `floatSliderGrp -q -v speedCtrl`; Vehicle.translateY = cos(time*5); Vehicle.translateZ = sin(time*5); Vehicle.translateX = 0; myPlace.offsetU = time*$speed;

  11. Vehicle Rigging: Final Notes After adding this Expression, set Maya s timeline to 300 frames and press Play. We may need to save the file, close and re-open it to see the effect on the ground texture. To align the checker movement, select GroundPlane and RotateY - 90 degrees (will not hurt any of our rigging). To see the Expression after creating it, re-open Window > Animation Editors > Expression Editor, select the Vehicle mesh and a Translate Attribute. This Expression can be [Deleted], re- created, or revised and hit [Edit]. Weird fix: if the AxelBar is jumping up and down instead of staying aligned with the bottoms of the ShockA s, try selecting the middle chain Joint, un-parenting it [Shift]+[p], and re-parenting it to the top chain Joint. FINAL NOTE: This texture animation is just to simulate the way shock absorbers would work on a real rig. For actual animation, we would directly keyframe the vehicle for horizontal motion and a ground plane (set to not render) to animate bumps in the road.

  12. Intro to Tech Art and Python Scripting Technical Artists provide critical services to animated film and game teams. Their job it is to facilitate artist productivity by finding solutions to time-consuming problems. Examples of Tech Artist tasks include creating UI elements with functions that handle repetitive tasks, or help create, visualize, and manage parts of a character or vehicle rig. Tech Artists also handle Rendering and Motion Capture pipeline issues and create interfaces for managing large asset databases or managing old files (like Blizzard s World of Warcraft legacy system with single-file character animation). Tech artists have to be creative in their problem- solving, and constantly learn new solutions to unknown problems! Python is typically the programming language of choice for Tech Artists, as it is robust and cross-platform/cross-software , manages JSON database calls, and is relatively easy to learn. Things experienced programmers should know about Python: Ways it is similar to other languages, like C#: Python requires importing and referencing a library for actions. Python is Object Oriented. We need to declare a thing as a variable before we can do something with it. Ways it is different: Python does not require class declaration or line endings (no semicolons at line ends). Python does not ignore extra spaces: make sure there are no spaces before /after lines.

  13. Intro to Python Scripting in Maya Using Python in Maya: Open the Maya script editor. See this button, lower right corner of interface: The top is the Listener and the bottom Script window is for entering code. To run code, select the lines in the Script window and hit the blue Play button, up top. Note the Help > Python Command Reference Choose the Python tab and type into the bottom Script window. We start by importing the maya.cmds library into a variable mc, and then reference this variable throughout by associating each command with it: mc.[commandname]. NOTE THESE USEFUL CODES: t = text w = width h = height adj = adjustable l = label (a field label, like a slider) c = command (execute a command) n = name (name an object being created) r = relative (transform) q = query (we query a field = True before saying a value or text in a field = True) def = define a function "separator" makes a line. h-value is the number of pixels of empty space above it. Tutorial notes from: http://bit.ly/2UaH6GT

  14. Intro to Python Scripting: V1 Copy/paste and run the following to see a window get created. To run, select all lines and hit the blue play button at the top of the script editor: import maya.cmds as mc renamerific = mc.window("RenamerWin1", t = "Renamer Version 1", w=200, h=200) mc.columnLayout(adj = True) mc.showWindow(renamerific) NOTE the two play controls: The single blue arrow plays the current script in the displayed window. The double arrow icon is for running all scripts, in all windows. If one is bad when you hit the double-arrow, none will play.

  15. Intro to Python Scripting: V2 Add a check on whether the window already exists, to delete it and replace it. import maya.cmds as mc if mc.window(renamerific, exists=True): mc.deleteUI(renamerific) renamerific = mc.window("RenamerWin1", t = "Renamer Ver 1r", w=200, h=200) mc.columnLayout(adj = True) mc.showWindow(renamerific) The new code is bold-faced Run the script to see the window disappear and re-appear:

  16. Intro to Python Scripting: V3 Add content for the window: Display explanation text, create an entry field and an execute button for the Renamer script (note the function definition is located after mc.showWindow): import maya.cmds as mc if mc.window(renamerific, exists=True): mc.deleteUI(renamerific) renamerific = mc.window("RenamerWin1", t = "Renamer Ver 1r", w=200, h=200) mc.columnLayout(adj = True) mc.separator(h=20) mc.text("This is a basic object renaming tool") mc.text("Select object, type new name below, hit [OK] to rename") mc.separator(h=20) boxName = mc.textFieldGrp(l = "Renamer ", editable =True) mc.button(l= "Rename Object", c="myRenamer()") mc.showWindow(renamerific) def myRenamer (): finalName = mc.textFieldGrp( boxName, q= True, text = True) mc.rename(finalName)

  17. Intro to Python Scripting: V4 For fun and to learn sliders, add text and code to generate boxes, and play: import maya.cmds as mc if mc.window(renamerific, exists=True): mc.deleteUI(renamerific) renamerific = mc.window("RenamerWin1", t = "Renamer Ver 1r", w=200, h=200) mc.columnLayout(adj = True) mc.separator(h=20) mc.text("This is a basic object renaming tool") mc.text("Select object, type new name below, hit [OK] to rename") mc.separator(h=20) boxName = mc.textFieldGrp(l = "Renamer ", editable =True) mc.button(l= "Rename Object", c="myRenamer()") mc.separator(h=20) boxW = mc.intSliderGrp(l = "Width",min =0, max =100, field =True) boxH = mc.intSliderGrp(l = "Height",min =0, max =100, field =True) boxD = mc.intSliderGrp(l = "Depth",min =0, max =100, field =True) mc.button(l = "Make a box", c="myBox()") mc.showWindow(renamerific) def myRenamer (): finalName = mc.textFieldGrp( boxName, q= True, text = True) mc.rename(finalName) def myBox(): myBoxWidth = mc.intSliderGrp(boxW , q= True, value =True) myBoxHeight = mc.intSliderGrp(boxH , q= True, value =True) myBoxDepth = mc.intSliderGrp(boxD , q= True, value =True) finalBox = mc.polyCube(w=myBoxWidth, h=myBoxHeight, d=myBoxDepth , n = "mBox") mc.move(0,myBoxHeight/2.0, finalBox, r= True)

  18. Delete History and Saving Do NOT apply DELETE HISTORY to joints only to meshes. Always apply Delete History to your Meshes BEFORE applying Skin, Blendshapes, or other nodes that will be deleted by Delete History. To guard against crashes and loss of work, please Save and Save As a new file everyhour (so you can never lose more than an hour s work): YourName_Vehicle01.mb, YourName_Vehicle02.mb, etc. Save your work to an online repository every day (Dropbox.com, Google drive) so you have a backup in case your computer fails.

Related


More Related Content