Lec 10 MEL for Dynamics

Similar documents
9 Dynamics. Getting Started with Maya 491

Dynamics in Maya. Gary Monheit Alias Wavefront PHYSICALLY BASED MODELING SH1 SIGGRAPH 97 COURSE NOTES

CSE 682: Animation. Winter Jeff Walsh, Stephen Warton, Brandon Rockwell, Dustin Hoffman

Maya Lesson 3 Temple Base & Columns

FLUID PARTICLE SIMULATION

Chapter 19- Object Physics

How to create a network diagram?

12 MEL. Getting Started with Maya 631

Scale Rate by Object Size: Only available when the current Emitter Type is Surface, Curve, or Volume. If you turn on this attribute, the


To build shapes from scratch, use the tools are the far right of the top tool bar. These

Beginners Guide Maya. To be used next to Learning Maya 5 Foundation. 15 juni 2005 Clara Coepijn Raoul Franker

Character Modeling IAT 343 Lab 6. Lanz Singbeil

Transforming Objects and Components

Workshop BOND UNIVERSITY. Bachelor of Interactive Multimedia and Design. Asteroids

NCCA National Center for Computer Animation Master Project ZHUO YAO LU. MSC Computer Animation. Media School. Bournemouth University NCCA 2005

Week 03 MEL basic syntax II

Chapter 14 Particle Systems & Interactions

In this tutorial, you will create a scene with sandman dispersing in sand, as shown in in the image below.

Maya Lesson 6 Screwdriver Notes & Assessment

RHINO; AN INTRODUCTION + FAKING TRABECULAE; EndOfLine.info;

How to Create a Simple Animation Using MAYA

Design of a dynamic simulation system for VR applications

Autodesk Maya 2019 BASICS GUIDE

Evil Blink 1 EVIL BLINK

Creating animation rigs that solve problems, are fun to use, and don t cause nervous breakdowns.

Week 9: GUI Part II. User Interface, UI Layouts Controls (All examples can be found in Z:\Public\gui_II.mel) User Interface UI

A simple example. Assume we want to find the change in the rotation angles to get the end effector to G. Effect of changing s

Announcements. Ray tracer is due in five days you should have started by now or you re going to have a bad week. Missing file posted on the web page

Animated Modifiers (Morphing Teapot) Richard J Lapidus

BACHELOR OF ARTS IN 3D ANIMATION AND VISUAL EFFECTS Term-End Theory Examination December, 2015 BNM-001 : ANIMATION PRODUCTION PIPELINE

Lesson 11. Polygonal Spaceship

CGS 3220 Lecture 13 Polygonal Character Modeling

Index FEATURES LIST 2

MAYA; AN INTRODUCTION TO MAYA; EndOfLine.info;

3D Capture. 3D Capture. 3D Capture. 3D Capture. Real-world

Simulation (last lecture and this one)

Animator Friendly Rigging Part 2b

Tangents. In this tutorial we are going to take a look at how tangents can affect an animation.

Working with the Dope Sheet Editor to speed up animation and reverse time.

Jornadas sobre estrategias de generación de entornos colaborativos virtuales. What is/is not procedural?

move object resize object create a sphere create light source camera left view camera view animation tracks

User InterfaceChapter1:

SimTenero Particle Physics

Sculpting 3D Models. Glossary

An Introduction to Maya. Maya. Used in industrial design, CAD, computer games and motion picture effects. The ambition is what get

REU Modeling Course Day 1. AutoDesk Maya - Program Introduction + Getting Started

Dave s Phenomenal Maya Cheat Sheet The 7 Default Menus By Dave

NURBS Sailboat on Ocean (Modeling/Animation)

BCC Particle System Generator

Introduction to Unreal Engine Blueprints for Beginners. By Chaven R Yenketswamy

Chapter 3: Computer Animation Reminder: Descriptive animation. Procedural animation : Examples. Towards methods that generate motion?

Collision Detection. Pu Jiantao.

Unity3D. Unity3D is a powerful cross-platform 3D engine and a user friendly development environment.

Facial Animation. Chapter 7

ROSE-HULMAN INSTITUTE OF TECHNOLOGY

Blender Notes. Introduction to Digital Modelling and Animation in Design Blender Tutorial - week 1 The Blender Interface and Basic Shapes

Integrating Physics into a Modern Game Engine. Object Collision. Various types of collision for an object:

Lesson 01 Polygon Basics 17. Lesson 02 Modeling a Body 27. Lesson 03 Modeling a Head 63. Lesson 04 Polygon Texturing 87. Lesson 05 NURBS Basics 117

Working Model Tutorial for Slider Crank

Art? 2 Computer Graphics 2 The Stages of Production 4 The CG Production Workflow 8 Core Concepts 10 Basic Film Concepts 21 Summary 26

2.2 - Layouts. Bforartists Reference Manual - Copyright - This page is Public Domain

OCR Maths M2. Topic Questions from Papers. Projectiles

Game Design Unity Workshop

ROBOTSTUDIO LECTURES. Introduction to RobotStudio. What is RobotStudio? How to start it up Structured walk-through

StudioPrompter Tutorials. Prepare before you start the Tutorials. Opening and importing text files. Using the Control Bar. Using Dual Monitors

Input Nodes. Surface Input. Surface Input Nodal Motion Nodal Displacement Instance Generator Light Flocking

Cloth Simulation on the GPU. Cyril Zeller NVIDIA Corporation

Maya 2014 Introduction to Maya

Bonus Ch. 1. Subdivisional Modeling. Understanding Sub-Ds

Learning Autodesk Maya The Modeling & Animation Handbook. Free Models From Turbo Squid Value US $ Official Autodesk Training Guide

Designing the look and feel for Smoke and Neon powers The creation of a new toolset and pipeline for I:SS Pros and cons from our new workflow and

Getting Started. Moving Around in 3D

Getting Started. Double-click the SketchUp icon or click: Start All Programs SketchUp 2018 SketchUp 2018

Burning Laser. In this tutorial we are going to use particle flow to create a laser beam that shoots off sparks and leaves a burn mark on a surface!

Week 5: Assignment: Animation

3 Polygonal Modeling. Getting Started with Maya 103

Review Sheet Chapter 3

Autodesk Navisworks Freedom Quick Reference Guide

Mach4 CNC Controller Screen Editing Guide Version 1.0

BCC 3D Extruded Image Shatter Filter

Index FEATURES LIST 2

CGS 3220 Lecture 17 Subdivision Surfaces

Dynamical Simulation 1: Particle Systems and ODEs

O Hailey: Chapter 3 Bonus Materials

Outline. Introduction Surface of Revolution Hierarchical Modeling Blinn-Phong Shader Custom Shader(s)

Computer Graphics 7: Viewing in 3-D

Pong in Unity a basic Intro

Beaumont Middle School Design Project April May 2014 Carl Lee and Craig Schroeder

solidthinking User Interface

Graphical Editors used at CSC/Nada earlier. Main competitors. What is Maya? What is Maya? An Introduction to Maya. Maya

Presets are the heart of Genoma. They can be added to so you can build up a library of reusable rig parts or even complete rigs to suit your

CS 378: Computer Game Technology

Getting Started with ShowcaseChapter1:

Game Design Unity Workshop

WEEKS 1-2 MECHANISMS

Cláudia Ribeiro PHYSICS

Real Time Cloth Simulation

S206E Lecture 15, 4/27/2018, Rhino 3D, Grasshopper, Shanghai Tower modeling

Importing and Applying Motion. Ingredients. Pre-production Issues. SIGGRAPH-02 Course 28: Motion Capture: Pipeline, Applications, and Use

Transcription:

Lec 10 MEL for Dynamics Create user windows Create customize shelf command icon Create and use of expression within MEL script Create and use of particle and rigid body dynamics panelbreakup exercise (The skeleton code file can be found in G:\public\panelBreakup_ske.mel) Goal: We want to know more about the dynamics system within Maya and learn about the interaction of rigid body object (including particles). We are going to build a scene in Maya using particle collisions to act on multiple solid bodies with expressions. N.B.: In order to create interesting effects with particle, one extremely important topic is lighting and rendering issue. I skip this topic for today class and probably we will talk about it more on the next lecture as it involves lot of aspects. Rigid Body Dynamics RBD RBD object in Maya represents something that non-deformable (very hard), and their motion is based on physics law. RBD object can and will collide with each others. Maya has two types of RBD objects: Active rigid body: React to dynamics effects: force fields, collisions, and springs. Its position and rotation are totally calculated from physics law i.e. you don t have any control over except the initial position and rotation. Create an active RBD: 1. Select the object(s). 2. Soft/Rigid Bodies > Create Active Rigid Body Passive rigid body: It will collide with active RBD but it is NOT affect by other dynamics object in the scene. E.g. passive RBD is not affected with force fields. You can control its position and rotation within any frame. Create an passive RBD: 1. Select the object(s). 2. Soft/Rigid Bodies > Create Passive Rigid Body Class Exercise 1: Create a bouncing ball 1

active RBD passive RBD gravity field Exercise: Figure 1 Bouncing ball example 1. Create a NURBS sphere and a NURBS plane. 2. Make the sphere an active RBD object. 3. Make the plane a passive RBD object. 4. Add a gravity field into the scene. 5. Set a longer range for the animation frame. E.g. 100 150 frames. 6. Run the animation and see the effect. Create a rigid sphere rolling over a rough surface animation sequence. Your screen should look like the following but I expect you will build a more complex and interesting terrain. 2

Tips: 1. Creates a gravity field and make the field point to x-axis (negative or not) and y-axis (negative or not?). 2. The field strength should not very large. I.e. much less the default 9.8 value. 3. Have a long animation sequence in order to see the effect. 4. You can make an inclined plane instead. Particle and Surface Interaction Some of the most interesting animation effect within Maya is created using a combination of particle and dynamics effect. Let s start work on simple example of particle and polyplane interaction. Hand-on practice: Simple particle and surface interaction 1. Create a 4 x 4 plane using Create > Polygon Primitives > Plane. You can set the 4 x 4 option through the attribute editor or just use the option bottom when you are creating the plane. The equivalent MEL command is: polyplane weight 1 height 1 subdivisionsx 4 subdivisionsy 4 axis 0 1 0 2. Rename the plane from pplane1 to Floor. (Tips: rename pplane1 Floor or using the channel manual). 3. Change X, Y, Z scale of the plane to 6. 4. Create an Emitter with following properties: 3

5. Raise the Emitter above the plane a bit. Finish every above steps, you will have something look like: 4

6. We want to make the particle collide with the floor. Select the particle and then shift-select the Floor. Once you have them both selected, select Particles > Make Collide in the upper menu. 7. Set the time frame to 500 and run the animation. You will probably see the particles are bouncing upwards. It is not too realistic. 8. Here we have 2 more factors that we can tune. Open the Attribute Windows of the Floor and you will notice there are 2 more parameters here: - Resilience, it controls bouncing of the particles - Friction, it controls sliding of the particles. Tune the above 2 factors and make your particles bouncing left right upon the Floor instead of upwards. 9. Finally, we rotate the Floor a bit. You should have something like this: 5

However, we want the particle is falling off the edge of the plane. I.e. we need gravity. Select the particle and then add a Field (Fields > Gravity). Run the animation and see the result. 6

You can change the render attribute of the particleshape1 to spheres in the attribute editor of the particle1 object. Once you had changed it, you will have something like this: You can use a geometry object to replace the particle in your scene. It is called instancer. Create cylinder and then: 1. Select the instancer object i.e. the newly created cylinder. 2. Shift-select the particle object (with your instancer object already selected). 3. Particles > Instancer. 4. You may want to hide the original instancer object. Display > Hide > Hide Selection. Class Exercise 2: Flow of the particles Can you make another inclined plane just below the above one and run the animation and see the result? 7

Figure 2 Direction of the flow of particles Hand-on practice: Creating a NURBS plane In this exercise we want to create something as shown in Figure 1. Figure 3 Particle gun knocks away solid bodies Figure 1 shows the results of such scene. Also, we will create a small MEL window to control the direction for particle emission. 8

We begin by constructing the scene. In the Script Editor (or your favorite editor), create a NURBS plane: nurbsplane name panel p 0 0 0 ax 0 1 0 w 1 lr 1 d 3 u 1 v 1 ch1; xform worldspace scale 20 20 20 panel; xform worldspace rotation 0 0-90 panel; NURBS is actually a very useful object in Maya. We use it extensively for creating various kind of model. It is due to fact that it can be transformed and extended easily using MEL script. xform is the transformation command which let you transform Maya object using coding. Figure 4 The NURBS plane 9

These commands will create a NURBS plane in Figure 2. It will facilitate use to create the smaller dynamics planes later. The NURBS is placed in the center of the world and points normally in the positive X direction, which will be important for the collisions. Hand-on practice: Creating the Emitter Now we need to create a directional emitter called gun. In the Script Editor, we create the gun using the code: emitter -pos 25 0 0 -type direction -name gun -r 30 -spd 50 -mxd 0 -dx -1 -dy 0 -dz 0 -sp 0; particle; connectdynamic -em gun particle1; Figure 5 Emitter shooting particles at plane 10

Start the animation icon and the emitter, gun, will shoot particle to the NURBS plane. Hand-on practice: Creating Interface Window for Aim Control In here, we talk about a topic which you haven t learnt yet. We want to create a floating MEL slider in a window that we will hook up to the gun s Y rotation so that we can control the direction of the particles. Even though you haven t learnt this topic, the slider control is very natural for GUI application and the coding is very straight forward. We are going to learn MEL GUI programming starting next week. Figure 6 Gun Y rotation control window window -title "Gun Control" -width 400 -height 50; columnlayout; floatslidergrp -label "aim" -field true -minvalue -30.0 maxvalue 30.0 roty; connectcontrol roty gun.rotatey; showwindow; window title Gun control creates the name of the windows as it appears on the interface. -width and -height specify a 400 x 500 pixel window. columnlayout creates the layout of the rest of the settings called after it in a single column. floatslidergrp will make a slider and an associated floating-point field. -lable defines the name of the slider -minvalue and -maxvalue set the range of the slider roty is the name of the slider that floatslidergrp creates connectcontrol roty gun.rotatey connects the control roty to the attribute gun.rotatey, so that dragging the slider changes the attribute. showwindow displays the window in the Maya interface. Execute the above script in the Script Editor. Next, play back the scene while you move the slider back and froth to see the effect it has on the gun emitter as shown in Figure 5. 11

Figure 7 Spray of particle from rotating gun Hand-on practice: Add New Window Control to Shelf We can add the script to make the slider window we created and put it in Maya s shelf so that it can be executed with click of a button. Select the text in the Script Editor, and hold down the middle mouse button. With the button held down, drag it into the shelf in the Maya interface. Close the Gun control silder we just created, and click the new MEL icon on the shelf. The slider window will return. If you want to name the icon, as it is always a good idea to do so, use the shelf Editor, available from the pop-up menu indicated by the triangle icon at the left side of the shelf. 12

Figure 8 Installing script as MEL shelf button Hand-on practice: Convert Panel to Polygons and Break up into Pieces You can either use the MEL script or use the Maya GUI to convert the panel to polygons and break it into smaller pieces. First, let s use the Maya GUI. Select the panel in the Maya scene and then choose Modify > Convert > NURBS to Polygons > option. The scene, Figure 7, will appear. Figure 9 NURBS to Polygons option 13

Change 3D Delta to 0.13 and Type to Quads, and then click Apply. We will have nice polygonal grid with even distribution of square faces. The corresponding MEL script is: Figure 10 Polygonal grid nurbstopoly -name polypanel -polygontype 1 -delta 0.13 panel; hide panel; select -r polypanel.f["*"]; $facelist = `filterexpand -sm 34`; // get the number of faces size($facelist); polychipoff -keepfacestogether 0 polypanel.f[0:(size($facelist)+1)]; polyseparate -name smpanels polypanel; // delete the original panel delete smpanels; We use the filterexpand command with the -selectionmask 34. If you look up the Maya help for filterexpand you will find mask 34 will get you the Polygon Face which is what we want and we store all the Polygon Face s in the variable $facelist. 14

The statement polychipoff makes the Polygon Face s into individual objects. The statement polyseparate separates those faces into its own node as we are going to apply rigid dynamics on to those Polygon Face s. We don t need the original Polygon Face smpanels anymore as we just need each individual ones, staring from 1 to 16. Hand-on practice: Add Dynamics and Expressions to Pieces We will use a for loop to give each smpanels, smpanel1 to smpanel16 dynamic properties, to connect them to particle collisions, and then to expression. What we want for each of them is: 1. Make each a solid body with an initial setting to react to a particle collision. 2. Connect each with partcle1 to enable collisions with its particles. 3. Assign an expression to each piece that will turn off particle collisions once the pieces reacts to a particle striking it, and that will send the piece in positive X and negative Z to simulate a wind force. (Exercise) int $i = 0; for ($i = 1; $i <= size($facelist); $i++) { rigidbody -active -damping 1 -collisions 0 -particlecollision 1 ("smpanels" + $i); collision -r 0.2 -f 0.2 ("smpanels" + $i); connectdynamic -c ("smpanels" + $i) particle1; } The most common use of ls is to filter or match objects based on their name (using wildcards, i.e. *) or based on their type. By default ls will match any object in the scene but it can also be used to filter or list the selected objects when used in the conjunction with -selection flag. The first command in the for loop turns smpanel + $i into a rigidbody with particle collisions on, and the next command makes it a collision object. 15

The third command connects the collision object with particle1. We don t want collisions between the smpanels for the sake of speed, so we need to set collisions to 0 or off, in the rigidbody command. Finally we need to adjust the life span of particle1 so that the particles will not live forever in the scene: setattr particleshape1.lifespanmode 1; setattr particleshape1.lifespan 1.0; setattr gun.spread 0.1; cyclecheck -e off; playbackoptions -min 1 -max 300 -loop continuous; Figure 11 The particles shoot off the polygon faces Exercise 1: Adding a new slider bar Add a new silder bar to Gun control window and it will control the up and down of the emitter. Exercise 2: Convert the scripts into a function 16

Convert the above scripts into a function called panelbreakup() so that you can call the function directly after you Source Script the script again. Exercise 3*: Simulate the wind blow away effect Remember the Expression that we had talked about in the class. You can enter Expression for each frame in Maya using Expression Editor. However, we can insert expression in each frame as well using MEL script. We can insert the expression using the following command. The variable $exprstr contains the desired expression. expression -s $exprstr -o ("expression" + $i) -ae true -uc all; Exercise: The wind blows away effect is simulated using the expression: // At frame 1, enable the collision // Set the impulse in X direction to be 0 // Set the impulse in Z direction to be 0???? // If the velocity in X direction of rigid body is // less than 0, // Disable the collision // Set the impulse in X direction to be 2 // Set the impulse in Z direction to be -2???? 1. Why do we write the above in this way? Explain it according to your understanding of Expression in Maya. 2. Implement the above effect into your final panelbreakup script. Exercise 4*: Exploding Sphere Based on the particle-rbd interaction that we had learnt in this class, I want you to create an effect as: 17

After the explosion, the fragments should be blow away by a very strong wind. ** End of Lecture 10 ** 18