TLFeBOOK
TLFeBOOK
This page intentionally left blank
TLFeBOOK
TLFeBOOK
© 2004 by Thomson Course Technology PTR. All rights reserved. No part of this book may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system without written permission from Thomson Course Technology PTR, except for the inclusion of brief quotations in a review. The Premier Press and Thomson Course Technology PTR logo and related trade dress are trademarks of Thomson Course Technology PTR and may not be used without written permission. SVP, Thomson Course Technology PTR: Andy Shafran Publisher: Stacy L. Hiquet Senior Marketing Manager: Sarah O’Donnell Marketing Manager: Heather Hurley Manager of Editorial Services: Heather Talbot Senior Acquisitions Editor: Kevin Harreld Senior Editor: Mark Garvey Associate Marketing Managers: Kristin Eisenzopf and Sarah Dubois Project Editor/Copy Editor: Estelle Manticas Technical Reviewer: Colin Hodges Thomson Course Technology PTR Market Coordinator: Amanda Weaver Interior Layout Tech: William Hartman Cover Designer: Mike Tanamachi Indexer: Kelly Talbot Proofreader: Gene Redding
Softimage, SOFTIMAGE|XSI, and SOFTIMAGE|BEHAVIOR are registered trademarks of Avid Technology, Inc. in the United States. The Softimage Press and/or Official Guide are used by permission of Avid Technology, Inc. All Rights Reserved. All other trademarks are the property of their respective owners. Important: Thomson Course Technology PTR cannot provide software support. Please contact the appropriate software manufacturer’s technical support line or Web site for assistance. Thomson Course Technology PTR and the authors have attempted throughout this book to distinguish proprietary trademarks from descriptive terms by following the capitalization style used by the manufacturer. Information contained in this book has been obtained by Thomson Course Technology PTR from sources believed to be reliable. However, because of the possibility of human or mechanical error by our sources, Thomson Course Technology PTR, or others, the Publisher does not guarantee the accuracy, adequacy, or completeness of any information and is not responsible for any errors or omissions or the results obtained from use of such information. Readers should be particularly aware of the fact that the Internet is an ever-changing entity. Some facts may have changed since this book went to press. Educational facilities, companies, and organizations interested in multiple copies or licensing of this book should contact the publisher for quantity discount information. Training manuals, CD-ROMs, and portions of this book are also available individually or can be tailored for specific needs. ISBN: 1-59200-210-2 Library of Congress Catalog Card Number: 2003112957 Printed in the United States of America 04 05 06 07 08 BU 10 9 8 7 6 5 4 3 2 1
Thomson Course Technology PTR, a division of Thomson Course Technology 25 Thomson Place ■ Boston, MA 02210 ■ http://www.courseptr.com
TLFeBOOK
For Morgan and my loving family —A.G.S
For my family: Miharu, Patricia, Andrew, Jill, Tatsuya, Etsuko, and Akitsu. —M.I.
TLFeBOOK
Experience XSI 4
Foreword by Stan Winston e all know that movies are the art of illusion. Writers, directors, actors, and any number of creative individuals work hard to create a vision of the world that reflects a version of reality. For many years now I have been a part of that process, creating physical effects for movies that take audiences beyond the everyday world and into the world of the imagination.
W
But the work FX creators do, while stretching the boundaries of reality, is also guided by the principals of what is possible. When designing and manufacturing creatures and prosthetic make-ups for the movies, artists are always asking if what they envision makes sense—if it looks as if it would work in the real world. The genius comes in stretching those possibilities to their limit while still delivering effects audiences can believe in. Now the world of movie effects has taken a huge step forward. The advent and development of computer-generated visuals has created opportunities for artists to give birth to groundbreaking denizens from the imaginary realm that would have been impossible just a few years ago. The fantastic can now be blended into film with a seamlessness that defies detection.
Foreword
But for all the freedom afforded by computers, many of the basic principals of creature design still apply. Artists still have to trick the eye of the viewer by giving their creatures weight, skin, and clothing that reflect light realistically, as well as that indefinable quality of sentience that makes movie monsters so scary. In some ways, achieving these things with computers is even more difficult than with traditional methods of silicone and paint. The artist has to take any number of mundane aspects into account in replicating reality. That is why this book is necessary for anyone who wants to learn how to create computer generated visual effects using XSI. Aaron Sims, longtime physical effects designer, sculptor, painter, and puppeteer, has teamed up with Michael Isner, XSI software developer, to bring you an approach that covers the technical aspects of using XSI while focusing on creating effects that bring reality to the unreal world of computer animation. I’m sure you will find their years of experience invaluable as you make your way through the process of becoming a designer and animator, and I look forward to one day seeing your work at the movies.
vi TLFeBOOK
Experience XSI 4
Acknowledgments he personal developments that led to this book involve many people of diverse backgrounds, many of whom I’d like to thank. First, I’d like to thank my father, who inspired me with his talent. Both of my parents supported and encouraged me to pursue the career I wanted, something for which I will always be grateful. Don Ivan Punchatz, my early mentor, helped me find a direction for my work, while inspiring me to develop myself in a commercial direction. In the early 1980s Rick Baker gave me a chance to join a professional physical special effects design and production team. In my years at Rick’s Cinovation Studios, I had the opportunity to work with a number of talented people on projects that taught me every aspect of visual effects design. The transition to computer visual effects was greatly facilitated by my life-long friend, Greg Punchatz, whose knowledge and patience in answering my questions was invaluable. I’d like to thank Stan Winston for providing me with the opportunity to expand my computer design abilities. Thank you to all of the people at Stan Winston Studios for their help and support. Finally, I’d like to thank my ex-wife Morgan Sims. Her willingness to take on this project with me made the writing process a collaborative effort. Our many years together have helped me to gain perspective on the many twists and turns of my career, and my life.
T
—Aaron Sims
S
—Michael Isner
Acknowledgments
pecial thanks to my wife, Miharu Uchida, who stayed up with me countless late nights getting this book ready, and to Yotto Koga for going far beyond the call of duty helping me learn Behavior and create a chapter. My chapters involved help, support and inspiration from many in the Softimage community. Thanks to Marc Stevens, Peter Schretlen, Ronald Beirouti, Jérôme Couture-Gagnon, André Foisy, Andrew Skowronski, Simon Inwood, Justin Leach, Dilip Singh, Eric Sanford, Colin Hodges, Martin Barrette, Raffaele Scaduto-Mendola, Jason Barlow, Peter Wulsin, Bob Shafron and Steve Oedekerk.
vii TLFeBOOK
Experience XSI 4
About the Authors Aaron Sims began his career working for famed commercial illustrator Don Ivan Punchatz. After moving to Los Angeles in 1985, Aaron began designing, sculpting, and painting creatures for the movie makeup effects industry. His earlier work includes Fright Night II, Nightmare on Elm Street 5, and Stephen King’s It. In 1988, Aaron joined Rick Baker’s Cinovation Studios, Inc. He developed his skills on Gremlins 2 (Head Painter), Baby’s Day Out (Head Painter/Cosmetic Supervisor), Batman Forever (Painter/Sculptor), and Batman and Robin (Painter/Sculptor). Aaron went on to lead various projects at Cinovation, designing and sculpting the Grandma Klump prosthetic makeup on The Nutty Professor, as well as the Worm Guys and other aliens in Men in Black. As Project Supervisor on How the Grinch Stole Christmas!, Aaron sculpted and painted the Baby Grinch character, oversaw its construction, and puppeteered the character on set. He designed many of the “Who” character prosthetics as well.
About the Authors
In the late 1990s Aaron began exploring the medium of computer animation. He joined Stan Winston Studios in 2000, and began applying his unique conceptual design techniques to designing the robotic characters in AI: Artificial Intelligence. Aaron also completed digital production work on Creature Features. In 2001, he was joined by Animation Director Randall Rosa and Visual Effects Supervisor Andre Bustanoby to form SW Digital, the design division at Stan Winston Studios. SW Digital has since designed characters for Terminator 3 and completed all digital promotional trailer TRAKK for Stan Winston Creatures, the action figure and comics division of Stan Winston Studios. Aaron’s recent work includes designs for Warner Brothers’ Constantine and Sony’s Big Fish, as well as digital work and art direction on Universal’s The Cat in the Hat and Paramount Pictures’ Sky Captain and the World of Tomorrow.
viii TLFeBOOK
Experience XSI 4
Michael Isner is Head of Special Projects at Softimage and is responsible for a worldwide team of 3D production experts and engineers helping Softimage users. Michael is best known as the designer of the character component tools and programming language (CDK) inside XSI. Michael comes from a family history of engineers and technology innovators (his father once programmed the control algorithm for an entire paper mill in 4k) but strayed from the path a bit by pursuing a career in art and architecture. He eventually turned back to computers as they got faster, and he picked up 3D by taking a phone support job at Softimage. Michael’s fascination with the art and mathematics of 3D eventually led him to the demonstration team at Softimage, where he led the first content and production tests of XSI. Many of the early features of XSI, such as subdivision surfaces, Netview, and the first character tools were a result of collaboration between this demonstration team and development. Next, as the Character Animation Lead for Special Projects, Michael was best known for his invention of using quaternions to resolve character problem areas such as the spine and forearm. This research has since grown into the XSI character menu and a range of research aimed at combating complex rotation and interface problems slowing down character animation. Michael has participated in character seminars and panels worldwide and continues to be an enthusiast and friend of the film and game industry on the West Coast and Japan. Michael is a firm believer that the heart of 3D and 3D software lies in production. More information can be found at http://www.isner.com.
About the Authors ix TLFeBOOK
This page intentionally left blank
TLFeBOOK
Experience XSI 4
Contents at a Glance Introduction................................................................................xix chapter 1 The Interface ..................................................................................1 chapter 2 Designing and Modeling a Character.........................................13 chapter 3 Texturing Your Character ...........................................................45 chapter 4 Character Setup............................................................................79 chapter 5 Animating Your Character ........................................................115
chapter 7 Lighting, Rendering, and Compositing Your Character.........175 chapter 8 Making Crowds and Character Logic with Behavior ..............203 Image Gallery .............................................................................215 Index ...........................................................................................245
Contents at a Glance
chapter 6 Scripting in XSI ..........................................................................141
xi TLFeBOOK
This page intentionally left blank
TLFeBOOK
Experience XSI 4
Contents Introduction ................................................xix Why XSI?................................................................xix What’s in This Book? .............................................xix
The Top Toolbar ......................................................9 The Bottom Toolbar.................................................9 Working within the View Ports...............................10 Changing Views.............................................................10 Changing Display Methods............................................10
chapter 1 The Interface..................................................1 The Hot Key List.......................................................1 The Left-Side Toolbars .............................................4
Starting a Project and Saving a Scene.....................10 Summary ...............................................................11
The Model Toolbar .........................................................4 The Animate Toolbar ......................................................4 The Render Toolbar........................................................5 The Simulate Toolbar......................................................5 Hair Mode ......................................................................5 Weight Panel...................................................................7 Palettes and Display Types Toolbar .................................7
chapter 2 Designing and Modeling a Character ...........13 What to Think about When Designing a 3D Character ...................................................13 Modeling Overview ................................................15 Basic Modeling in XSI............................................15
The Right-Side Toolbar ............................................7
Contents
Layers .............................................................................7 Select..............................................................................7 Transform.......................................................................8 Snap ...............................................................................8 Constrain ........................................................................9 Edit ................................................................................9
Primitives and the Primitive Menu ................................15 Null16 Curve.......................................................................16 Polygon Mesh...........................................................16 Surface ....................................................................17 Implicit ...................................................................17 Primitive Models .....................................................18
xiii TLFeBOOK
Experience XSI 4
The Create Menu ..........................................................19 Creating Curves ......................................................19 Creating Surface Mesh............................................21 Creating Polygon Mesh ...........................................21 Drawing Polygons ...................................................22
Working with 3D Paint Programs to Texture Your Character.................................................68 Finalizing Your Textures in the Render Tree ..........70
Using the Modeling Tools.......................................23
Summary ...............................................................78
Proportional Modeling..................................................23 Polygon Modeling Exercise...........................................24
Modeling Your Design ...........................................29 Roughing out the Body and Head .................................29 Roughing out the Arms and Legs ..................................34
Summary ...............................................................43 chapter 3 Texturing Your Character .............................45 Texturing Overview ................................................45 Material Shader Basics .................................................46 Texturing Basics: Using the Render Tree and the Texture Layer Editor.........................................50
Contents
Texture Editor Overview.........................................56 Setting Up UV Coordinates Using the Texture Editor.....................................................................57 Adding Texture to Your Character Using the Texture Editor ........................................................62
Texturing Eyes and Nails ...............................................72 Working with Hair ........................................................74
chapter 4 Character Setup............................................79 Template-Based Character Setup............................80 Guide Proportioning ..............................................80 Rig Construction ...........................................................84 Enveloping....................................................................88 Setting up a Synoptic.....................................................90
Advanced Character Setup .....................................91 Gluing Parts Together ...................................................92 Parenting ................................................................92 Pivots.......................................................................92 Constraints .............................................................94 Expressions .............................................................95 Scripted Operators ..................................................95 Springs ....................................................................97
xiv TLFeBOOK
Experience XSI 4
Character Components..................................................97 Spine .......................................................................98 Tail ..........................................................................98 Dog Leg....................................................................99 Understanding Inverse Kinematics ................................99 Cosine Law for Two-Bone Chains ........................100 Deformations..............................................................101 Enveloping Algorithms..........................................101 Shrink Wrap ..........................................................103 Cage Deform .........................................................105 Control Splines .....................................................106 Shape.....................................................................108 Smoothing / Relaxing ...........................................110 Deforming with Hair and Springs........................110
chapter 5 Animating Your Character ..........................115 Character Animation Overview.............................115 Basic Keyframing .................................................116
Character Engineering at a Production Scale .......110
Run Cycle Animation............................................129 The Animation Editor...........................................129
Summary .............................................................114
Using Referenced Models for Animation ..............123 Using Synoptic View .............................................123 Using Marking Sets to Animate ............................124 Walk Cycle Animation ..........................................124 Using the Rig to Put the Character in a Proper Pose for Animating...............................................125
Editing Your Animation Using the Animation Editor...................................................................130
The Dopesheet.....................................................133 Storing Your Animation........................................133 Working with the Animation Mixer ......................134 Shape Animation Overview...................................136 Storing Your Shapes....................................................136
Working with Shape Animation............................139 Summary .............................................................140
Contents
Automating Character Setup with Scripting .................110 Object-Oriented Scripting ....................................111 Rigging SDK...........................................................111 Referencing ................................................................112 Libraries .....................................................................113 Custom Interface.........................................................113 Asset Management ......................................................113 Inter-Group Workflow.................................................114
What Is Keyframing?....................................................116 Some of the Tools Used for Animation.................117 Applying Keyframes.....................................................118
xv TLFeBOOK
Experience XSI 4
chapter 6 Scripting in XSI ..........................................141 Simple Scripting...................................................141 Passing a Scripting Object...........................................143 Tweaking between the Commas ..................................144 Looping ......................................................................145
Creating User Interfaces.......................................170 Making Sliders............................................................170 Formatting ..................................................................171 Logic...........................................................................172 Advanced UI................................................................173
Summary .............................................................174
Types of Containers and Lists ...............................146 Collections..................................................................146 Arrays .........................................................................148 Scripting Structure and Organization ..........................149 Functions ..............................................................149 Objects...................................................................151
Approaching Problems with Scripting..................154 A Broad Overview of Scripting Tasks...........................154 Automation...........................................................154 Organization.........................................................154 Decision-Making...................................................155
Contents
Controlling Space with Math ................................155 Vectors........................................................................156 Curves.........................................................................161 Rotations ....................................................................163
Making Geometry.................................................168
chapter 7 Lighting, Rendering, and Compositing Your Character ...........................................175 Lighting Overview.................................................175 Different Types of Lights in XSI ............................178 Setting Ambience for Your Scene ................................179 Using Volumic and Lens Flares for Lighting FX............179 Basic Light Adjustments ..............................................181 Setting Up Lights for Your Character ...........................183 Using HDR Maps....................................................185 Matching the Rotoscope to Your Lighting ............186 Using the Light Rig from Image Feature ......................189
Rendering Overview.............................................189 Different Rendering Techniques..................................190 Raytracing.............................................................190 Scanline ................................................................191 Global Illumination..............................................191 Final Gathering.....................................................191 Caustics.................................................................193
xvi TLFeBOOK
Experience XSI 4
Setting Up a Render for Your Character......................193 Rendering Different Passes .........................................194 Beauty Pass ...........................................................195 Highlight Pass .......................................................197
Compositing Overview..........................................198 Using the FX Tree to Composite Your Character..........198 FX Tree Overview ..................................................198 Bringing Passes In and Rendering the Final Composite Using the FX Tree................199
Summary .............................................................202 chapter 8 Making Crowds and Character Logic with Behavior .............................................203 Behavior Introduction..........................................203 Dropping a Cube in XSI .......................................204
Dropping a Cube in Behavior ..............................204 Loading Actors in Behavior.........................................204 Scripting in Behavior ..................................................205 Activities in Behavior ..................................................206 Creating a Simple State Machine.................................207
Making a Crowd Shot...........................................209 Preparing Actors.........................................................209 Simplified Character Strategy ......................................209 Tagging Your Character...............................................210 Scripting a Crowd Shot ...............................................211 Rendering a Crowd Shot .............................................213
Summary .............................................................214 Image Gallery.............................................215 Index..........................................................245
Contents xvii TLFeBOOK
This page intentionally left blank
TLFeBOOK
Experience XSI 4
Introduction elcome to creature development in Softimage | XSI! This book will help you understand and work with XSI 4 to create a highly detailed character in a production environment. The approach in this book is unique because it is the result of a collaboration between art and technology. As an artist, I have worked for many years in the physical effects make-up industry. My experience as a painter, sculptor, designer, and puppeteer has given me a perspective on computer animation as an artistic effort, not just a technical one. But the technical aspect of computer animation is an indispensable part of the learning process. Michael Isner, programmer and developer of many of Softimage’s unique features, will take you through some of his innovations, such as his more automated rigging process. Throughout the book, I will share with you how thinking about animation from the perspective of a filmmaker will enhance the design and animation process in ways that make it more vivid, lifelike, and compelling. Michael will provide you with a solid basis of information about the technical processes within XSI—information vital to a complete understanding of this powerful software package.
W
In addition, we have created a Web site from which you can access materials necessary for completing the exercises found in the book. The Web site can be found at: http://www.courseptr.com/ptr_downloads.cfm. Use it to follow along as you work your way through the book.
Why XSI? XSI is the next generation in digital animation software. What makes it a powerful package is its intelligently built, non-linear architecture. The powerful tool sets and user-friendly interface make it possible to be extremely creative and very precise in whatever task your job demands.
What’s in This Book? In this book, I’ll cover how I use XSI to create and animate a character, while Michael will cover rigging, scripting, and Behavior. The character we’ll show you how to build is one of my creatures from a short film I’m developing entitled Tethered Islands. This creature was created using XSI, and we’ll cover from beginning to end how to create it and bring it to life. The XSI features and techniques we’ll cover include: ◆ Designing
◆ Scripting
◆ Rendering
◆ Modeling
◆ Rigging
◆ Compositing
◆ Texturing
◆ Animating
Introduction
Softimage has been an important part of the new wave of computer design. It was used to animate the dinosaurs for Jurassic Park Parts I, II, and III. These creatures were among the first realistic CG characters developed for film. The future of Softimage is happening now. Artists all over the world are using it in new and creative ways and in many different fields, from computer games to the film industry, commercials to music videos. Learning Softimage will allow you to join a community of talented artists and computer users who are developing cutting-edge effects that are changing the face of visual media. Careers in computer effects design and animation will continue to grow in number as more and more industries realize the potential power of computers and animation software packages.
xix TLFeBOOK
Experience XSI 4 We will also cover SOFTIMAGE | BEHAVIOR, a process used to create intelligent characters that can interact with one another to form a realistic 3D animated crowd or herd. Using the character we’ve shown you how to build in earlier chapters, we will take you step by step through the process of how to use this powerful new tool. We’ll also go over scripting in a production environment. This programming function in XSI allows you to take advantage of the work you’ve done for repeated use, or to create your own programming options to cut down on time and increase productivity.
Introduction
The great thing about XSI is that it gives you many different ways do just about any task. This makes it a very flexible package, depending on the techniques you choose. No single book can cover the capability inherent in the XSI package. But once you have mastered the basics, there is no limit to what you can create. Understanding the potential of this powerful tool will allow you to learn more and more about how it works and what it offers. The possibilities are endless.
xx TLFeBOOK
Experience Experience XSI 4
chapter 1
The Interface n XSI, the interface, shown in Figure 1.1, is where you work—where you use all of the XSI tools to create anything you can imagine. XSI’s interface can be changed and rearranged to make it easier to achieve what you need. You can change the way you see the tools, or, if there’s a tool you don’t need, you can move it or hide it, making it easier to work with the ones you want to focus on. The XSI interface is user-friendly, and in this chapter we will cover how to work within this interface, giving you information on the tools and how to use them. Also, we will cover how to start a project and make a scene, as well as how to save and open a scene. This chapter will also cover the basic uses of the hot keys, which will make your workflow a lot smoother.
I
The Hot Key List
Property pages are a feature of XSI that makes the entire animation process easier. These interfaces are associated with practically any feature or function of the software, and allow you to make changes to your work by accessing the different functions that pertain to it. We’ll discuss the uses of property pages throughout the book, but you can also explore them by clicking the ? icon at the top of any page.
1. The Interface
Hot keys allow you to use your keyboard to execute commands such as Save, Delete, Zoom, Pan, Orbit your camera, and so on. Navigation in XSI is 3D, so you may need to familiarize yourself with some new commands and concepts. The hot keys, such as the O key, will orbit the camera view (or user view) to perspectives that include the top, bottom, and back of an object. The S key is a multi-purpose navigation tool (using all three mouse buttons) that allows you to track and orbit your object and also set the camera on a dolly to pan from right to left. Using the hot keys will save time and speed up your workflow. You don’t have to spend time searching through the software trying to find the commands you want. Figure 1.2 shows a list of some of the more frequently used hot keys. You can find this list at the Web site and print it out to use as a reference sheet.
1 TLFeBOOK
Experience XSI 4
2
Figure 1.1 The interface
TLFeBOOK
Experience XSI 4
Figure 1.2 Hot key list
REFERENCE General and Viewing Keys (cont) Pad + Increase Subdivision level of polygons Pad Decrease Subdivision level of polygons Ctrl+Pad + Toggle hull display for subdivisions Alt+Pad + Toggle wireframe display for subdivisions Shift+Enter Info selection Enter Open General property page for current selection Alt+Enter Open property page with all properties for current selection Selection and Editing Tools C Rotate object (L = X, M = Y, R = Z) V Translate object (L = X, M = Y, R = Z) X Scale object (L = X, M = Y, R = Z) Q Render region tool (L = draw, M = toggle on/off, R = refresh) T Tag points (also enters Point Selection mode) D Duplication tool Ctrl+D Duplicate selected (object, polygon, vertex, or edge) M Move point tool R Resize Proportional Modeling Tool (after Prop is activated) W Weight-map paint tool Ctrl-W Brush property page Esc End mode / Terminate Tool K Save keyframe on marked parameters U Raycast Polygon selection Y Rectangle Polygon selection I Edge selection E Rectangle Edge selection Ctrl+Alt+A Select all objects Ctrl+Shift+A deselect all objects Ctrl-Z Undo Ctrl-Y Redo Delete Delete selection Shift-Delete Delete all
1. The Interface
XSI HOT KEY General and Viewing Keys 1 Model Toolbar 2 Animate Toolbar 3 Render Toolbar 4 Simulate Toolbar Ctrl+2 Hair Toolbar Ctrl+3 Weight Panel Toolbar Ctrl+4 Palette Toolbar O Orbit-mode (L = free, M = horizontal, R = vertical) Z Zoom- and Pan-mode (L =pan, M = zoom in, R = zoom out) Shift+z Rectangular Zoom Tool s Multi-mode view navigator (L = pan, M = dolly R = orbit) p Dolly-mode (L = slow, M = medium, R = fast) Ctrl-S Save scene Ctrl-O Open scene 5 Browser Alt+5 Net View 6 Layer Control Alt+6 Image Clip Viewer 7 Render Tree Alt+7 Texture Editor 8 Explorer Alt+8 XSI Explorer 9 Schematic View 0 Animation Editor Alt+0 Animation Mixer A Frame all F Frame selection H Hide or Unhide selection Shift+h Unhide all Objects Ctrl+h Unhide all Polygons Shift+Spacebar Multi-select (add objects to selection) Spacebar Selection mode (L = node, M = branch, R = tree) R Reset Camera Q Render Region G Show/hide Grid
*L, M, and R denote the left, middle, and right mouse buttons, respectively.
3 TLFeBOOK
Experience XSI 4 The hot key list in Figure 1.2 does not contain all of the hot keys. To see all of the hot keys, or to create your own, refer to the Keyboard Mapping property page (see Figure 1.3), found under File at the top right-hand side of the interface. In this property page there are many options, including those for browsing all of the hot keys and making your own. To browse the hot key list, click on the View in Browser button at the top of the page. To make your own set of hot keys, click on the New button, type in a name for the key command, and then find the command from the list on the main page. After finding the command you want, you can just drag it down onto the key you wish it to be on the keyboard list. It’s just that easy.
The Left-Side Toolbars
1. The Interface
Figure 1.3 The toolbars on the left side (see Figure 1.4) of the interface are where The Keyboard Mapping property page your work modes are located. You can decide what mode you want based on what you are doing. The many different toolbars each have a unique function. You will notice that the first four toolbars have an area called Get. On each of the four toolbars the Get properties are basically the same. This makes it easy to achieve many tasks within the toolbar you are working in, from getting a light or a new camera. Many of the other sections of the toolbars are unique to the mode you are in.
4
The Model Toolbar To access the Model toolbar (see Figure 1.5), left-mouse click on the top box of the tool list on the right side of the interface (or you can press 1 on your keyboard). The Model mode is where you can create and modify a model. All of the tools you need are in this mode.
The Animate Toolbar You access the Animate mode in the same way as you do the Model mode—using the mouse (the hot key is 2). The Animate mode is where you have all the tools to rig and animate your character and edit your animation. Figure 1.6 shows the Animate toolbar. Figure 1.4 Left-side toolbars
TLFeBOOK
Experience XSI 4
Figure 1.5 The Model toolbar
Figure 1.6 The Animate toolbar
The Render Toolbar
1. The Interface
The Render mode is where you can texture your model, modify your textures and render your scene. The hot key for Render mode is 3. Figure 1.7 shows the Render toolbar.
The Simulate Toolbar Simulate mode is where you can apply particle simulations such as smoke, rain, and dust to your scene, as well as many other dynamic simulations. The hot key for Simulate mode is 4. Figure 1.8 shows the Simulate toolbar.
Hair Mode Hair mode can be accessed by clicking the scissors icon at the bottom of the lefthand side toolbars (see Figure 1.9). The Hair mode allows you to apply hair to your character and modify it by cutting it or styling it, as well as by changing the color and texture. You can also apply dynamics such as wind, gravity, or other forces.
Figure 1.7 The Render toolbar
5 TLFeBOOK
Experience XSI 4
Figure 1.10 The Weight toolbar
Figure 1.9 The Hair toolbar
Figure 1.11 The Palettes and Display Types toolbar
1. The Interface
Figure 1.8 The Simulate toolbar
6
TLFeBOOK
Experience XSI 4
Weight Panel The Weight toolbar can be accessed next to the Hair icon, which is in the shape of a brush. The Weight panel (see Figure 1.10) is used for editing the weights of your character by painting the deformer’s influence over the skin envelope (we’ll be going over this in detail in Chapter 4, “Character Setup”).
Palettes and Display Types Toolbar The Palettes and Display Types toolbar can also be accessed at the bottom left-hand side of the interface, to the right of the Weighting icon (see Figure 1.11). Palettes and Display Types are for coloring and displaying your mesh to better organize a complex scene or to view objects in a manner more to your preference.
The Right-Side Toolbar
Figure 1.12 The right-side toolbar
Figure 1.13 Example of layers
The right-side toolbar is the Main Command Area, as shown in Figure 1.12. Here is where you make layers, select, scale, rotate, translate, edit, and so on. Many of these functions can be accessed with the hot keys.
1. The Interface
Layers The Layers toolbar (see Figure 1.13), found on the top right-hand side of the interface, is where you assign layers to individual models or objects. This is a great way to organize your scene. To make a layer, just select the object you wish to be in a layer and click on New Layer. Now the object has its own layer, allowing you to hide the object or check off its rendering ability, as well as to check off the option to select the object.
Select Under the Layers toolbar on the right-side toolbar is the Select menu (see Figure 1.14). This menu includes many different options for selecting your objects or aspects of them. Selecting elements of your work is necessary for making changes, and there are many different ways to select things in XSI,
Figure 1.14 Example of selecting
7 TLFeBOOK
Experience XSI 4 allowing you great flexibility in how you can manipulate your scene. For example, you can select polygons, edges, or points, and you can select nodes in Explorer windows. You can also select objects by name in the different dialog boxes that refer to your object. And you can set limits on what objects or elements in your scene can be selected, protecting your work from unintentional changes. You can select elements in various views in XSI, and you can use a variety of tools for your selections.
Transform The Transform panel, found under the Select area, is where you can scale, rotate, or translate your object. To scale an object, just select your object and click on the three-line icon under the S icon. This will scale the object in all XYZ axes. If you just want to scale in X or Y, then click on the X or Y of the XYZ. This can be done the same way to rotate or translate. There are many other Transform options, which you can find by clicking on the Transform button. You can also transform your object in Global (entire scene) or Local (just what’s selected) space, or just in your view, by clicking on any of the buttons under the three Transforms (see Figure 1.15). The Transforms are functions that allow you to manipulate your object on three planes: x, y,x, and z.
Snap
1. The Interface
Snapping makes it possible to align components of a model or other objects when you add them or move them around your model. There are many different methods for snapping components and objects by point, curve, surface, or grid. Figure 1.16 shows some of the Snap options.
Figure 1.15 The Transform panel
Figure 1.16 The Snap panel
8 TLFeBOOK
Experience XSI 4
Constrain Constraints (see Figure 1.17) are a way of linking aspects of objects to other objects. You can link objects to the direction or position (as well as many other aspects) of another object, allowing you to manipulate elements of your scene in natural ways. You can constrain eyes to follow a null, or constrain the bones of a rig to a control object that you then use to manipulate the skeletal frame of your creature. There are many ways to constrain objects, some of which we’ll go over in detail later in the book.
Edit The Edit panel (see Figure 1.18) is used to edit objects. Here you’ll find such commands as Duplicate, Clone, Group, Instantiate, and Delete. Here you can also see all of the properties of your object or scene.
The Top Toolbar Figure 1.17 Constraints
The panel at the top of the interface, known as the Main Menu bar (shown in Figure 1.19), provides all of the primary commands. This is where you can open and save scenes and import or export models. You can access your XSI preferences, change the layout of the interface, or access the many different views, such as Schematic, Explorer, and so on. The Main Menu also provides you with all of the tools found on the left or right side toolbars. Having these tools or functions available to you in multiple locations makes your workflow smoother and more efficient.
Figure 1.19 The Main Menu bar
1. The Interface
Figure 1.20 The bottom toolbar
9
The Bottom Toolbar The bottom toolbar (see Figure 1.20) is mainly used for animating and scripting. The Timeline is visible here, as well as the Play options and Key Frame. At the very bottom is the mouse status line; this displays the current status of the three-button mouse.
Figure 1.18 The Edit panel
TLFeBOOK
Experience XSI 4
Working within the View Ports The windows within the XSI interface are known as View Ports. View Ports are where you can view your scene in different ways. Any of the View Ports can be resized to full screen by left-mouse clicking on the small box in the top-right corner of any of the View Ports; the View Ports can also be maximized horizontally or vertically by right-mouse-clicking on the box. You can also hide them or hide the other views, leaving only the one you are working on by right-mouse clicking on the leftmost top button in any window (see Figure 1.21). You can find the Visibility options for the individual View Ports by clicking on the eye icon in the top-center of the View Ports. You can find the Camera options of the view ports by clicking the camera icon next to the eye icon.
Changing Views You can also change any of the View Ports (see Figure 1.22) to any of the viewing options such as a Render Tree, Explorer, Animation Editor, and so on, by clicking the Views menu in the top-left of any of the View Ports. If you are not sure where the Views menu is, look at the Interface chart. Any window can be changed to meet your preference.
Figure 1.21 Working within View Ports
1. The Interface
Changing Display Methods
10
The display methods (such as Wireframe or Shaded; see Figure 1.23) can be changed by clicking on the Display Type menu in the top-right of any of the View Ports. Also located on the bottom of the Display Type menu are Display Options. The many options you can access here give you more control over the individual display types, for example, in Shaded mode you can enable xray mode to see within the object.
Starting a Project and Saving a Scene Any work you do in XSI will always be saved within a project. A project is a group of folders containing all of the elements of your work. Every element you build into your scene is stored in its proper project folder. When you open a project, you can access the elements of your work easily. All scenes have the filename extention .scn, making them easy to recognize. One of the big advanFigure 1.22 Changing views
TLFeBOOK
Experience XSI 4
Figure 1.23 Changing to different display methods
Figure 1.24 Starting a project and saving a scene
tages of the project organization in XSI is that it makes group work easier. Projects can be saved on a network and accessed by more than one person. The folder organization makes finding elements of a scene easy for multiple members of a team.
Watch for question marks in any property pages. Click on these icons to access additional information about the page you are using. These help take you through every aspect of the page.
Summary In this chapter you learned what the interface is and how to use it. You also examined the many different toolbars and what their functions are. You looked at how to work within the windows and change different views and different display methods. Finally, you learned how to start a project and save a scene. The more you understand the interface, the more productive your workflow will be. Using the interface chart and the hot key list as a reference page as you work should help you become more familiar with how to work within XSI.
1. The Interface
To start a project, go to File > New Project. Under Location, click on the browser button on the right to find the location where your project will be stored. After deciding on the location, click on Select. Now, under Project Name, type in a name for the project and click OK. This will make a folder with subfolders. Within the subfolders is a scene folder; this is where you will save and open your scenes (see Figure 1.24).
11 TLFeBOOK
This page intentionally left blank
TLFeBOOK
Experience Experience XSI 4
chapter 2
Designing and Modeling a Character 2. Designing and Modeling a Character
SI has made it possible to generate almost anything your imagination can conceive. All it takes to turn a simple idea into a beautiful reality is a basic understanding of the great tools that XSI provides. In this chapter, you’ll learn how to use many of the different modeling tools available in XSI and explore how to use these tools to model a character that you’ll design (see Figure 2.1).
X
Before modeling a character, you need an idea or a design. The design process for 3D characters can lead you off in many different directions—from mechanical to organic, human to animal. But no matter what direction the design may take, it’s always a good idea to design as many different views of your character as you can before jumping into the modeling process. That way, you’ll have a clear representation of your character from many angles (see Figure 2.2). Knowing what your character looks like from different angles allows you to think of your character in three dimensions, making the modeling process much easier. When the camera angle of your animation changes, you’ll already know how the character looks, say, from the front. If you’re prepared, you won’t have to work out the details in the middle of the modeling process.
What to Think about When Designing a 3D Character When designing characters to be used for 3D animation—whether for an animated film with cartoon-like characters or for a live action movie with realistic creatures—you need to start with a shape that the audience can identify with, something that looks natural, even if it’s a creature from outer space. It’s also
Figure 2.1 Character model
13 TLFeBOOK
2. Designing and Modeling a Character
Experience XSI 4
14
Figure 2.2 Example for character design of the many angles
Figure 2.3 AI design created in Softimage 3D
important to consider how you will animate your character. Will it be an aquatic character? Will it fly or walk? The best source for inspiration is nature. Nature contains everything you may need for reference—even when designing a robot character. The natural inspiration for robot designs can be seen in the mechanical perfection of insect bodies. I’ve designed many characters for the movie industry— including robots for AI (see Figure 2.3), the T3 robots (see Figure 2.4), and the worm guys in Men in Black (see Figure 2.5)—and all were inspired by nature. In nature, mathematical perfection co-exists alongside
Figure 2.4 T3 design created in XSI
Figure 2.5 Example of character designs for Men in Black
TLFeBOOK
Experience XSI 4 organic irregularity. Think of the way every feather on a bird’s wing conforms to exact design limitations. Seen side-by-side, feathers look strikingly similar; however, no two feathers are exactly alike. The overall effect of a wing is far less orderly than its separate parts. These two aspects, perfection and irregularity, combined in the right way, can create a powerful effect on the audience. The trick is to startle the audience with your originality while still making visual sense.
Modeling Overview
Before I started using any 3D software, I worked in the movie industry as a sculptor, so when I started modeling on a computer I was looking for tools that made the modeling process more like sculpting. I found that XSI has some of the most advanced modeling tools of any 3D software I’ve tried—and it’s easy to use. The XSI modeling process can consist of many different techniques, as well as many different types of geometry, including polygon meshes, subdivision surfaces, curves, surfaces, and surface meshes. In this section, you’ll see how to model using many techniques and examine the geometry as well.
Basic Modeling in XSI Let’s begin by getting familiar with some of the tools you’ll need to start the modeling process (see Figure 2.7). First, make sure that you’re working with the Model toolbar in XSI; the hot key for the Model toolbar is 1 on your keyboard.
Primitives and the Primitive Menu Before modeling anything, you should familiarize yourself with all of the different geometry options that XSI has and decide what will work for your project. Primitives are basic geometric shapes that can be helpful in starting the modeling process. Think of them as similar to the wires on which sculptors build up clay when starting a sculpture. Figure 2.7 The modeling interface
Figure 2.6 Example of modeling in clay
2. Designing and Modeling a Character
Modeling can be looked at as virtual sculpting. Instead of sculpting forms out of clay or carving them out of marble, in the 3D world you use a wireframe model, as shown in Figure 2.6. Wireframes can be visually difficult to work with. However, using a shaded mode (viewing your object with shading applied to the wireframe) helps you see your model as a 3D representation of a solid object. Working like this, you can give your model the appearance of clay and you can use the Proportional Modeling tool as a sculpting tool. I’ll go over using the Proportional Modeling tool later in the chapter.
15 TLFeBOOK
Experience XSI 4 You can access the Primitive menu by clicking Primitive in the Get section of the Model toolbar on the left side of the screen (shown in Figure 2.7). You can also access the menu simply by clicking Primitives on the menu along the top of the screen.
2. Designing and Modeling a Character
Null
16
The first primitive on the menu is Null. Nulls (shown in Figure 2.8) can’t be modeled, but they can have many functions, such as organizing objects in hierarchies or setting constraints to an object. A null is viewed as three intersecting lines, and is not visible in a rendered scene. Rendering is a process in computer animation that combines all the elements in a scene and produces the final image. You’ll learn about rendering in depth in Chapter 7, “Lighting, Rendering, and Compositing Your Character.”
Curve The next primitive on the menu is Curve. There are four options for pre-made NURBS curve shapes, shown in Figure 2.9. NURBS, or Non-Uniform Rational BSplines are a type of geometry that computers can use easily. NURBS curve shapes let you create smooth curves and surfaces with only a small number of points. Curves, like nulls, will not be visible when rendered; they can be used for many different things, such as building renderable surfaces, defining motion paths, and controling deformations. You can also draw your own curve shapes. We wil go over some of those functions in the “Creating Curves” section of this chapter.
Figure 2.8 A null image
Polygon Mesh The Polygon Mesh menu has many different shapes to choose from. Polygon meshes are probably the most useful of all of the geometry in XSI. Working with polygons is easy. With them you can make complex shapes, or add or subtract any part of the mesh. Almost anything that’s complex in shape can be made from polygons (see Figure 2.10). Polygons may look faceted, but with a click of the + key on your keyboard, the polygons become a subdivision surface that has a smooth appearance. The character we will build later in this chapter will be made of subdivision surfaces, and we will go over some of the details of subdivision surfaces, polygons, or the transformation from one to the other at that time.
Figure 2.9 Examples of different kinds of NURBS curves
TLFeBOOK
Experience XSI 4
Figure 2.11 Examples of surfaces
Surface The Surface menu (see Figure 2.11) has some of the same model shapes as the Polygon Mesh menu. The primitive surface is NURBS-based, has a smoother appearance than do polygons, and uses less geometry. You can make complex shapes with surfaces, but first you need to stitch many of them together. Stitchedtogether surfaces are known as patches, and you can think of them as a sort of quilt. Working with patches is not as quick as working with polygons, but in many instances, working with patches comprises the standard pipeline in the film industry.
Implicit Implicit objects, shown in Figure 2.12, are basic shapes that are not renderable but can be used as constraints or, more commonly, as control objects for a character rig. You can scale, rotate, and translate implicit objects, but you cannot deform them because they have no points. Figure 2.12 Examples of implicit objects
2. Designing and Modeling a Character
Figure 2.10 Examples of polygon meshes
17 TLFeBOOK
Experience XSI 4
Primitive Models Under Model on the Primitive menu, you’ll find a few basic human shape options, as shown in Figure 2.13. Body – Man and Body – Woman are polygon models that can be helpful in modeling a human form instead of starting with a cube or a sphere.
2. Designing and Modeling a Character
The next section of the Primitive Models menu, shown in Figure 2.14, lists two face options, Face – Man and Face – Woman. These face models are also polygon-based and can be a great help in modeling a head for a character. The face model also has custom sliders (see Figure 2.15) that you can use to modify the face before you start pulling points.
18
The last option on the Primitive Model menu is Character – Man, shown in Figure 2.16. The Character – Man is a full-body polygon character that is more detailed than the Primitive Body models, and gives you a custom slider with which you can modify the shapes of the character (see Figure 2.17). These sliders can also be animated. Character – Man is another great XSI model to start with when you create a character.
Figure 2.13 Example of primitive models
Figure 2.14 Example of a face
Figure 2.15 A face being modified with sliders
TLFeBOOK
Experience XSI 4
Figure 2.17 Example of the Character – Man form being changed using sliders
The Create Menu Now let’s create some basic shapes using the Create menu in the Model panel (see Figure 2.18). This is where you can begin to understand the basic idea behind each of the geometries described previously.
Creating Curves Under Create in the Model panel, click on Curve. Select Draw CV NURBS from the menu that appears. With the left mouse button, start clicking points on the curve. Draw the curve by clicking and moving the mouse, as shown in Figure 2.19. Hit Escape on your keyboard when you are satisfied with your shape.
Figure 2.18 The Create menu
Now you can modify the curve by scaling, rotating, and translating. The tools for doing so are all found on the Transform panel, located on the right side of the interface. These functions all relate to manipulating your model, whether it’s a curve or a geometry. Scaling moves the size of your object up or down, Rotate
Figure 2.19 Drawing a curve
2. Designing and Modeling a Character
Figure 2.16 Example of Character – Man
19 TLFeBOOK
Experience XSI 4
2. Designing and Modeling a Character
turns your object, and Translate moves it. The space is represented by the x (left and right), y (up and down), and z (forward and back) axes. There is an axes icon on the bottom-left of any View Port. These axes represent the 3D space in XSI and are the field where you work with your model. You can also move the points individually by hitting the M key on the keyboard (see Figure 2.20). This activates the Move tool, which will be covered in detail later. With the Move tool active and the curve selected, drag any point of the curve. You will notice how the curve follows the direction of the point in a smooth fashion. You can also select points with the T key on the keyboard, the tagging function, to scale, rotate, and translate just the points you have selected (see Figure 2.21). You can also delete the selected points with the Delete key (see Figure 2.22). You can duplicate many curves and loft them together, turning them into a surface. To do this, select the curve and hit Ctrl+D on your keyboard. This will duplicate the curve. Now translate the curve over in X Y Z away from the original, as shown in Figure 2.23. The Translate panel, on the right side of the interface, can be selected by clicking on the three small icons next to the XYZ. Make sure that you are in View mode, which you can access under the Transform panel. If you need to change your camera angle to get a better view of the curve and the distance between the curve and the camera, just hold down the O key on the keyboard—this is the camera’s orbit. Now duplicate the curve four more times, as shown in Figure 2.24. You will notice
Figure 2.21 Modifying the curve by translating points
Figure 2.20 Modifying the curve by moving points
Figure 2.22 Modifying the curve by deleting points
20 TLFeBOOK
Experience XSI 4
Figure 2.24 Duplicating curves many times
that every time you duplicate the curve, it automatically translates itself the same distance. This makes it quick and easy to space many objects apart.
Creating Surface Mesh Now that you’ve made many curves, it’s time to create a surface with these curves. First select all of the curves and click on Loft, found in the Surf. Mesh menu under Curves on the Model panel (see Figure 2.25). Once the loft is applied, it skins the curves, creating a NURBS surface. Next, a property page pops up displaying options (see Figure 2.26). Here you can increase the amount of UV spans, adding more overall detail.
Creating Polygon Mesh The Poly. Mesh menu has many of the same types of tools as the Surf. Mesh menu. If your model will eventually be polygon-based, there’s no reason to convert the NURBS object into polygons, but if you did start with NURBS, you can convert the object to polygons by using the NURBS to Mesh tool at the bottom of the Poly. Mesh Menu, as shown in Figure 2.27.
Figure 2.25 Lofting the curves
2. Designing and Modeling a Character
Figure 2.23 Duplicating curves
21 TLFeBOOK
2. Designing and Modeling a Character
Experience XSI 4
Figure 2.26 The Loft property page
Figure 2.27 Converting NURBS to polygons
Drawing Polygons To draw polygons, just hit the N key on the keyboard and with the left-mouse button click on the area where you what to start drawing. Now move the cursor to the next area, click again, and continue until you have achieved a square. Right-click to start a new polygon. (You will notice that the polygon-drawing tool has a web-like appearance; anywhere you Figure 2.28 Drawing polygons move the tool around the edge of a polygon, the polygon tool is ready to start a new one branching off of the one you have selected.) Just click in the direction you prefer and continue in this method. To stop the action just hit the Esc key on your keyboard. It’s always a good idea to draw or build your polygon models using quads instead of triangles because triangles tend to cause a creasing effect, especially when subdivided.
22 TLFeBOOK
Experience XSI 4
Using the Modeling Tools Understanding the modeling tools in XSI is very important to achieving a good workflow and mastering the art of modeling. Modeling can be a creative process or it can be challenge—it’s all in how you go about it. The tools that XSI delivers are all about making modeling a productive process, and there are many tools to choose from, depending on the type of model you are trying to achieve. For this book, the modeling process is based on characters, so we’ll concentrate on the tools that pertain to character design. We have discussed some basic tools already, and will go over a few more in this section of the chapter.
Proportional Modeling
The Proportional Modeling tool is located on the right-hand side of the interface, in the middle of the right-side toolbar as shown in Figure 2.29. The left mouse button activates the tool, and the right mouse button opens its properties, as shown in Figure 2.30.
Figure 2.29 The Proportional Modeling tool icon
2. Designing and Modeling a Character
The Proportional Modeling tool is one of the most important tools for modeling. This tool gives you the ability to simultaneously move as many points as you want on your model. It doesn’t matter if you’re working with NURBS or polygons. This tool can be made any size, and has adjustable falloff from the center of its influence. Proportional modeling is much like sculpting—you can push in or pull out any part or any amount of your model, giving it the shape you want.
Figure 2.30 Using the Proportional Modeling tool
23 TLFeBOOK
Experience XSI 4
2. Designing and Modeling a Character
Polygon Modeling Exercise
24
Let’s do a simple exercise using some of the polygon modeling tools. First get a primitive polygon sphere by selecting Model Toolbar > Get > Primitive > Polygon Mesh > Sphere (see Figure 2.31). Rotate the sphere 90° in x (the Rotate function is located in the Translate panel on the right side of the screen). Now maximize the Camera view port by clicking on the Minimize/Maximize box found at the topright of the Camera view port. By default XSI starts a new scene in Wireframe mode. To better see your object for editing, you can work in Shaded mode. In the top-right-hand corner of the view port you are working in, click on the Display type menu. If you are not sure of where the Display type menu is, refer to the interface chart found in Chapter 1.
Head Light is a great work light for modeling. This light is located in the upper-right-hand corner of any of the view ports, under the Display Type menu. Click on Display Options and scroll down to Head Light and enable it in the property page. This light will make it easy to see your model from any angle because the light will follow the camera.
Figure 2.31 Getting a polygon sphere
Now select the polygons on the tip of the sphere by clicking the U key on your keyboard then holding the left mouse button down while dragging the mouse across the sections you want to select, as shown in Figure 2.32. With the polygons selected, scale and translate them down in y (also located in the Transform panel) as shown in Figure 2.33. To make things easier when modeling, we will make one half of the sphere an instance, so that everything that is done on one side will be symmetrically matched on the other side. You could use a symmetry map (located in the Property menu on the Get toolbar) to match the sides of the sphere, but that feature only allows you to make minor shape changes by moving the points—you cannot make major edits to one side and see the change reflected on the other side. When you create an instance of your shape, your edits will affect both sides. Figure 2.32 Selecting polygons
TLFeBOOK
Experience XSI 4
Figure 2.34 Selecting the right half of a sphere
To make an instance, first select the right half of the sphere (see Figure 2.34). With the right half selected, hit the Delete button (see Figure 2.35). Make sure that your sphere is selected by clicking on it with the left mouse button. Next make it into a model by going to the Model panel and selecting Create > Model > New Model. When the new model is created, hit Ctrl+I on your keyboard. This will create an instance of your model (see Figure 2.36). Now scale this instance –1 in the x-axis of the Transform panel. To add more detail around the area that will become the mouth, as shown in Figure 2.37, use the Add Edge tool, found under Modify > Poly.Mesh > Add Edge Tool (or use the hot key \ on your keyboard). When the Add Edge tool is activated, start clicking with your left mouse button on the edge of the polygon where you want to add detail. Next, connect the points to edges on the adjacent polygons, much like in a spider’s web. When you are done, click the right mouse button to close the Add Edge tool. You can give your model a smoother appearance by turning it into a subdivision surface (see Figure 2.38). To add more detail without having to draw points and
Figure 2.35 Deleting polygons and making a model
2. Designing and Modeling a Character
Figure 2.33 Scaling and translating polygons
25 TLFeBOOK
2. Designing and Modeling a Character
Experience XSI 4
26
Figure 2.36 Making an instance and scaling it in the x-axis
Figure 2.38 Adding more detail with Local Subdivision Refinement
edges everywhere, you can use the Local Subdivision Refinement tool. To use this tool, first click the U key on the keyboard then, with your left mouse button, select the polygons where you want to add detail. Then click the right mouse button to access the polygon-editing menu. Select Local Subdivision Refinement. This tool can also be found under Modify > Poly.Mesh > Local Subdivision Refinement. Now you can see that the surface of the model is made up of many more subdivisions. Now click the + key on the number pad of your keyboard once to round out the sphere by activating Subdivision Surface. This is unlike the Local Subdivision Refinement tool, which adds a permanent mesh detail. Subdivision surfaces can be increased or decreased by using the + and - keys on the number pad.
Figure 2.37 Adding more detail with the Add Edge tool
Now let’s use the Proportional Modeling tool that you saw earlier. Activate it with the left mouse by clicking on the Prop icon on the right side of the interface. Also press the M key on the keyboard to activate the Move Point tool. You will notice that when the cursor is on top of the model, a circle is visible. This is the radius of the Proportional Modeling tool. You can change the size of the tool by holding down the R key on the keyboard while clicking on the left mouse button and moving the mouse up or down. Another way to change the size of the tool and adjust its TLFeBOOK
Experience XSI 4 falloff influence is by right-clicking on the Prop icon to open its property page. With the Proportional Modeling tool activated, shape a mouth, as shown in 2.39. With the model selected, hit the Freeze button on the lower-right side of the interface. This will freeze the operator stack, getting rid of the modeling history, and making it easier to model. Make sure to use the Freeze button anytime your modeling slows down.
Press the U key on the keyboard, then use the mouse to select the small triangle of edges where the eye would be, as shown in Figure 2.41. Now use the Translate panel to translate the small triangle in, creating the appearance of an eye socket. Click on the three axes button under the T button of the Translate panel, making sure that the view button directly under the Translate panel is clicked on. Now
Figure 2.40 Using the Slice Polygons tool to add detail
Figure 2.39 Using the Proportional Modeling tool to shape a mouth
Figure 2.41 Modeling details on the face
2. Designing and Modeling a Character
Another way to add detail to your model is to use the Slice Polygons tool, found under Modify > Poly.Mesh > Slice Polygons. When this tool is selected, a Property page pops up. Select the x Axis of the Plane Normal, and advance the Offset Percentage slider to 92.857. This will add edges to the front of the model to help define parts of the face, as shown in Figure 2.40.
27 TLFeBOOK
Experience XSI 4 orbit your camera to get a better angle for translating the selected polygons. After you are happy with your angle, you can start translating the selected polygons inward slightly. Next, using the Proportional Modeling tool, start shaping the head and face.
2. Designing and Modeling a Character
Orbit your camera to help you see different angles of your modeling process by holding down the O key on the keyboard and clicking the left mouse button.
28
After shaping the model into a face, add horns by pressing the U key and clicking with the mouse to select a polygon on top of the head, as shown in Figure 2.42. You will be drawing a curve in the shape of a horn that will be used as a guide to extrude along. Before drawing the curve, you need to activate the Snap tool. Click on the Snap tool, which is located near the bottom of the right-side toolbar. Next click on the Snap to Facets button (which looks like a sphere) next to the small grid button on the Snap panel. Now the curve you draw will snap to the surface of the model. Now orbit the camera to face the model straight on with the selected polygon on the side. This will insure that when drawing the curve only the first point will snap to the surface of the model. Next select Create > Curve > Draw CV NURBS and draw a curve in the shape of a horn, starting at the selected polygon and moving out from there (see Figure 2.43). Make sure to turn off the Snap tool after drawing the curve. If you are unhappy with the shape of the curve you can easily move the points using the M key.
Figure 2.42 Select a polygon to begin adding horns
With the model’s polygon selected and the curve drawn, you can make your horn. To do so, go to Modify > Poly.Mesh > Extrude Along Curve (see Figure 2.44). You can also right-click on the selected polygon to access this tool. Now select the curve to make the extrusion. Once the extrusion is made, a property page appears. On this page you can change the inset amount and the subdivisions. Make sure to freeze this action once complete. After you finish shaping the face using the Proportional Modeling tool, go ahead and start experimenting with the many tools found under the Modify > Poly. Mesh menu (see Figure 2.45).
Figure 2.43 Drawing a curve in the shape of a horn
TLFeBOOK
Experience XSI 4
Figure 2.45 Adding the final details
There are too many different tools on this menu to cover in one book. The best way to understand all of these tools is to just start using them. You’ll learn best if you don’t allow yourself to be intimidated by any feature or tool in XSI. To explore is to learn.
Modeling Your Design Now that you’ve learned some of the modeling tools in XSI, it’s time to start modeling a character (see Figure 2.46). Modeling characters in XSI is easy and can allow you to stretch the limits of your creativity.
2. Designing and Modeling a Character
Figure 2.44 The Extrude Along Curve tool
Roughing out the Body and Head To begin, you need to download the drawings from the Web site. There are three different drawings: side, front, and back. After downloading them, make your
Figure 2.46 A modeled character
29 TLFeBOOK
Experience XSI 4 interface look like the one shown in Figure 2.47. Make the top-right View Port a Right view, the Left view port a Front view, and the Bottom view port a User view.
2. Designing and Modeling a Character
In the Right view, expand the Display Type menu in the top right hand corner and select Rotoscope. Select New from the menu in the Rotoscope image and load the side view drawing of the character. Next, do the same in the Front view, but load the Front view drawing. Now access a primitive polygon sphere then translate and rotate it into position, as shown in the lower half of Figure 2.47.
30
Now activate the Proportional Modeling tool and start shaping the sphere into the base shape of the body as shown in Figure 2.48. After making the base body shape, it’s time to start adding a tail. Do this in the Right view by selecting Create > Curve > Draw CV NURBS and drawing a curve. Draw from the base of the body to the end of the tail, as shown in Figure 2.49. In User view, use the U key to select the polygons at the tail end of the sphere, as shown in Figure 2.50.
Figure 2.47 Using the Rotoscope view for modeling
Figure 2.48 Using the Proportional Modeling tool to start shaping the sphere
Figure 2.49 Drawing a curve for the tail
TLFeBOOK
Experience XSI 4
Figure 2.51 Extruding the tail
With the polygons selected, right-click to expand the Polygon menu, or go to Modify > Poly.Mesh > Extrude Along Curve (see Figure 2.51). Now select the curve and check the Per Not option. After the tail has been extruded, you can start to shape it. First, tag the tip of the tail by using the T key and selecting the very end of the tail. Now activate the Proportional Modeling tool and scale it down using Scaling on the Transform toolbar (see Figure 2.52). This will make the end of the tail come to a point. With the Proportional Modeling tool activated, use the M key to model the tail to match the shape of the Rotoscope image (see Figure 2.53). Next, the tail tip must be shaped. Hit the U key to reactivate the polygon selection if your model is in a different mode. Now adjust the Proportional Modeling tool to have less influence overall, then scale and translate the tip of the tail down to match the Rotoscope image (see Figure 2.54). Figure 2.52 Scaling the end of the tail
2. Designing and Modeling a Character
Figure 2.50 Selecting polygons at the tail end
31 TLFeBOOK
2. Designing and Modeling a Character
Experience XSI 4
32
Figure 2.53 Refining the shape of the tail
Figure 2.54 Scaling the tip of the tail
Draw a curve in the Right view for the neck, as shown in Figure 2.55. Select the polygons in the neck area using the U key and right-click to get the Polygon menu. Select Extrude Along Curve (see Figure 2.56). When you select Extrude Along Curve and the property page pops up, check the Per Not option in the dialog box (see Figure 2.57). Now shape the neck section you have selected into the head using the Proportional Modeling tool, as shown in Figure 2.58. Next it’s time to mirror your model so that you don’t waste time modeling both sides. First, go to the Front view and select the left half of the body with the Y key (see Figure 2.59). The Y key functions much like the U key does. They are both used for selecting polygons, but the U key can only select polygons visible from your viewpoint, while the Y key can select polygons that aren’t visible from your viewpoint. Figure 2.55 Drawing a curve for the neck
TLFeBOOK
Experience XSI 4
Figure 2.58 Shaping the head
Figure 2.57 Extruding the head
Figure 2.59 Selecting half of the character
2. Designing and Modeling a Character
Figure 2.56 Selecting polygons in the next area
33 TLFeBOOK
Experience XSI 4 Next, delete the selection, as shown in Figure 2.60. After deleting the polygons, select the remaining side and make a model out of it, as shown in Figure 2.61. The Model feature is found under Create > Model > New Model. After a new model is created, hit Ctrl+I on the keyboard. This will create an instance of your model. Now scale this instance –1 in the x-axis of the Transform panel, as shown in Figure 2.62.
2. Designing and Modeling a Character
Roughing out the Arms and Legs
34
Now let’s model the legs. Using the U key, select an area of polygons on the body from where the legs will be extruded, as shown in Figure 2.63. Draw a curve for the leg in the right view port. Make sure to translate the curve over in the Front view port to line it up with the leg as shown in Figure 2.64. Figure 2.61 Making a model
Figure 2.60 Deleting the selection
Figure 2.62 Making an instance and scaling it -1 in the x-axis
TLFeBOOK
Experience XSI 4 With the polygons selected on the body, right-click to expand the Polygon menu and select Extrude Along Curve, as shown in Figure 2.65. When the Extrude along Curve property page appears (see Figure 2.66), set the Subdivisions to 10. Use the Proportional Modeling tool to shape the legs like the Rotoscope image, as shown in Figure 2.67. Use the Front view to shape the legs to conform to the Rotoscope view of the front of the character, as shown in Figure 2.68.
Figure 2.63 Selecting polygons from where the legs will be extruded
Figure 2.64 Drawing a curve for the leg
Figure 2.65 Selecting the Extrude Along Curve option
2. Designing and Modeling a Character
Use the U key to select the area on the body from where the arm will be extruded, as shown in Figure 2.69.
35 TLFeBOOK
2. Designing and Modeling a Character
Experience XSI 4
36
Figure 2.66 The Extrude Along Curve property page
Figure 2.68 Shaping the leg from the Front view
Figure 2.67 Shaping the leg from the Right view
Figure 2.69 Selecting polygons where the arm will be extruded
TLFeBOOK
Experience XSI 4 Draw a curve for the arm in the Right view and translate it to line up with the Front view as shown in Figure 2.70. With the polygon selected on the body, use the Extrusion Along Curve tool to make the arm. Set the Subdivisions to 6, as shown in Figure 2.71.
Now find the places (like under the arms and legs) where the mesh has intersected itself and pull the mesh out, making a cleaner-looking model. This is good to do before the model gets too complex, when finding all the individual points could take a long time (see Figure 2.73).
Figure 2.70 Drawing a curve for the arm
Figure 2.71 Setting the Subdivisions
Figure 2.72 Using the Head light
2. Designing and Modeling a Character
If you haven’t done so already, enable your Head light under the Display Options menu. This will help you view your model while you are refining it (see Figure 2.72). You can also enable Show Transparent Selected Wireframe. Now when you select your model, it will be slightly transparent, so you can see where it is intersecting itself. This will make it easier to pull out points that are embedded in the mesh.
37 TLFeBOOK
2. Designing and Modeling a Character
Experience XSI 4
38
Figure 2.73 Working with transparent selected wireframe
Figure 2.74 Adding the horn
With the U key, select the top of the head, where the horn is, and extrude it out, first by hitting Ctrl+D on your keyboard, then by scaling and translating it into place (see Figure 2.74). Look at the Rotoview image to make sure that you line it up correctly. Continue duplicating and translating until you achieve the basic shape. Now subdivide the model with the + key on the number pad of your keyboard. This will increase the number of polygons that are distributed around the model, giving it a softer appearance. From here, you can start shaping the model to more closely resemble the drawing. Now that most of the basic shapes are in place, you will need to add more mesh in order to add more detail. Select the entire character by clicking the Y key and dragging the cursor across the entire model. Then right-click over the model to open the Polygon menu and select Local Subdivision Refinement. This will increase the number of polygons on the model (see Figure 2.75). Hit the spacebar; this will get you out of the polygon selection mode and back into regular selection. With the model selected, hit the Freeze button on the lower-right
Figure 2.75 Adding local subdivision refinement
TLFeBOOK
Experience XSI 4 side of the interface. This will freeze the operator stack, getting rid of the modeling history and making it easier to model. If you haven’t saved your scene, then do so at this time. Name the scene Character_model. Now, in the Rotoscope view, start lining up the mesh and the overall shape of the model to more closely match the image (see Figure 2.76).
To see the head up close, click on the small magnifying-glass icon in the Rotoscope image,and then use the mouse to pan or zoom into the head (see Figure 2.78). This will ensure that the mesh will follow the image. Then start shaping the face in the User window.
Figure 2.76 Shaping the mesh
Figure 2.77 Modeling the mouth
Figure 2.78 Zooming in the Rotoscope window
2. Designing and Modeling a Character
Pan close to the head and use the T key to select the very end of the face, where the mesh all comes together. With Proportional Modeling activated, translate your selection into the head. This will be the mouth of the character. Next, use the M key to move the points and start shaping a mouth, as shown in Figure 2.77. Make sure to watch the placement in the Rotoscope image.
39 TLFeBOOK
Experience XSI 4 Using the U key, select the polygons around where the eye socket should be, duplicate the polygons, then scale and translate them inward (see Figure 2.79). Do this a couple of times in order to add enough detail to the mesh to create the eye socket.
2. Designing and Modeling a Character
With the polygons selected, translate them into the head to make the eye socket deeper. Now duplicate the polygons, then scale them down and translate them out. Repeat this a few times to make an eyelid shape (see Figure 2.80). Use the M key to adjust the area around the eye to give it more organic shape.
40
After shaping the eyelid, duplicate the polygons and pull them into the head, making a shape where an eyeball can be placed. Get a primitive sphere and scale it down to fit inside the eyelid. This will give you the basic shape you need to conform to the eyelid. Next, start shaping the face and adding edges where you need them to create a more defined look (see Figure 2.81). Figure 2.80 Making the eyelid shape
Figure 2.79 Making the eye socket
Figure 2.81 Using a sphere for an eye to help shape the lid
TLFeBOOK
Experience XSI 4 Continue adding edges where needed and modeling the head with more definition (see Figure 2.82). Make sure that you do not add edges or polygons just anywhere—be aware of the placement of the added detail. It is very important to not overcomplicate the models you build because if you do, they’ll be too difficult to manage in animation.
When making the nails for the character, you can shape a polygon cone into the proper shape for the nails. After modeling one nail, just duplicate it and scale it to fit the others as shown in Figure 2.84. Figure 2.83 Detailing the body
Figure 2.82 Adding more detail to the face
Figure 2.84 Modeling the nails
2. Designing and Modeling a Character
Continue adding details to the rest of the body, remembering to not overcomplicate it (see Figure 2.83). Next, add fingers and toes the same way you made the horn, or use the extruding along the curve method—whichever one you feel more comfortable using. Modeling the character from this point on takes time. There are many details to add and there is no quick method for doing so; it just takes skill and patience.
41 TLFeBOOK
Experience XSI 4
2. Designing and Modeling a Character
Figure 2.85 shows some of the many angles of the character. Use them to help guide you in making the many different shapes and contours of the character. It is also a good idea to look at animal anatomy for reference when modeling a creature that has organic characteristics.
42
To model an eye, start with a polygon sphere (see Figure 2.86). Add more detail to the area around the front of the eye by using the EdgeLoop tool. Use the T key to translate the front of the sphere out slightly, giving it the appearance of a Figure 2.85 Character references corneal bulge. Next, duplicate the sphere and either hide the duplicate or translate it away for now. That one will be the outer part of the eye, and the other will be the inner part of the eye. Work on the inner eye by taking the same tagged points and translating them inward, giving the eye a concave appearance. Now add more detail around where the pupil will be. With the T key, tag those points inward, making the pupil. After making the inner eye, unhide or place the outer eye over the inner and scale it up ever so slightly, making it just a little larger then the inner eye. Open an Explorer and select the inner eye. Click Parent on the right side of the interface and hit the outer eye. Now the two parts of the eye are parented together. Once all the details of modeling the character are complete, it’s a very satisfying feeling to know that all the hard work of extruding, adding edges, and pulling points is over (see Figure 2.87). Now complete the model by getting rid of the instances side of the character by selecting it and deleting it using the Delete key on the keyboard. Next select the body only (not the eyes or nails) and go to Modify > Poly.Mesh > Symmertrize Polygons. Select the default on the property page that appears. This creates a symmetrical image in the x-axis and welds the
Figure 2.86 Making eyes
TLFeBOOK
Experience XSI 4 two sides together. Close the property page, and with the model selected, click on the Freeze button. Once your model is complete, make sure to save the scene and call it Final Model. If you didn’t finish the model or if you need a 3D model to work from, you can download the model called Character_Model from the Web site.
Summary
Figure 2.87 The final details
You also learned how to model a character from a design in this chapter. Modeling in XSI can be easy—it’s all a matter of understanding and using the tools that the software has to offer. It’s also a good idea to know exactly what you are modeling and to have plenty of reference material to work from. Follow these guidelines and you’ll be on the way to creating great characters using XSI!
2. Designing and Modeling a Character
In this chapter, you gained some experience using the many modeling tools in XSI. You learned what primitives are and how to use them and you learned about curves and how they work. You also learned how to work with the Proportional Modeling tool to model various things.
43 TLFeBOOK
This page intentionally left blank
TLFeBOOK
Experience Experience XSI 4
chapter 3
Texturing Your Character his chapter will cover the many different texturing methods and how to set up UV coordinates using the Texture Editor. We’ll also go over how to apply different shaders to your object using the Render Tree. From there we’ll show you how to layer the many different textures—such as color, bump, spec, and reflection—using the Texture Layer Editor. After that, I’ll go over some of the basics of applying hair to an object and then you’ll apply hair to the character that you’ve modeled. We’ll go over how to grow, cut, and style the hair, as well as how to change its color. Figure 3.1 shows a character that has been textured.
T
Texturing is the process of giving an object color and texture; it will make a simple model come to life when rendered. Texturing can be accomplished by first selecting your object then going to Render Toolbar > Get > Texture. From this menu you can select from the many different textures. Textures can also be added using the Render Tree. The Render Tree is a way of applying and organizing your textures; its configuration can be seen in Figure 3.2. The Render Tree makes it easy to attach many textures together on your object. Before adding a texture to an object, you must apply a material. A material is a base shader. This is what all of the textures get applied to, and it contains all the hookups for the color, bump, spec, reflection, and so on. Material is located under Get in the Render toolbar, and can also be applied in the Render Tree.
Figure 3.1 A textured character
3. Texturing Your Character
Texturing Overview
Watch for question marks in any property pages. Click on these icons to access additional information about the page you are using.
45 TLFeBOOK
3. Texturing Your Character
Experience XSI 4
Figure 3.2 Example of the Render Tree
Figure 3.3 Example of the surface shaders
Figure 3.4 Example of the Render toolbar
Material Shader Basics What are shaders? Shaders are what give a surface, light, or camera an effect, such as texture, color, or light (see Figure 3.3). There are many different types of shaders—from volume, light, and lens to surface, environment, and textures. A material shader is basically a surface shader that applies different color effects, such as diffuse, which scatters the light; ambient, which shows color even where the light isn’t shining directly; and specular, which shines where the light is shining on the surface of the object. Additional effects include transparency and reflection. These materials have hookups where textures and many other effects attach. You can do all of these things in the Render Tree. You can make your own custom shaders and save them to be applied to other objects. You can make a library of shaders or apply pre-made shaders (of which XSI has many). To apply basic materials, look under the Render Toolbar > Get > Materials. Here you can find many diferent types of materials. Remember that in order to access any of these tools, you must have already selected the object you want to work with. To better understand how to apply a material, start with a sphere (Get > Primitive > Surface > Sphere), as shown in Figure 3.4. Make sure that you’re in the Render toolbar, which is shown in Figure 3.5; the hot key for the Render toolbar is 3 on the keyboard. Or you can select the sphere at the top of the toolbar.
46 TLFeBOOK
Experience XSI 4
Figure 3.6 Changing the view to Shaded
Maximize the user window by clicking in the small box next to the word Layers at the top right. Now click on the word Wireframe, which is located to the left of the minimize/maximize box in the top right corner of any view port; this will expand a scroll-down menu. Select Shaded, as shown in Figure 3.6. Now when you change the material and its values, it will be visible in Shaded mode, also known as OpenGL. Make sure that the sphere is still selected by clicking on it. You can tell that it is selected when the wireframe is white. Next, get a material under Get > Material > Phong, as shown in Figure 3.7. After the phong material is applied, you can change its values. To do so, adjust the sliders next to the colored boxes on the Illumination tab of the Material dialog box or type in the value you want in the field next to the sliders (see Figure 3.8). The sliders make it quick and easy to see the changes, but by typing in the RGB values, you can get a more accurate color. Under Diffuse, change the R value to 1 and the G and B values to 0. This will make the diffuse color of the object red.
Figure 3.7 Getting a phong material
3. Texturing Your Character
Figure 3.5 Getting a primitive sphere
47 TLFeBOOK
3. Texturing Your Character
Experience XSI 4
Figure 3.8 Changing the values of the phong material
Figure 3.9 Example of transparency applied to an object
Next, change Ambient to the same values as Diffuse. Now change the Specular values of R to 1, B to 0.890, and G to 0.535. This will give the highlights a more yellow value. Specular is the material’s highlights, and changing the Specular Decay values will make the highlighted area larger or smaller. With the sphere selected, click on the Transparency/Reflection tab and change all of the Transparency RGBA values to roughly 0.521 (see Figure 3.9). To change all of the values simultaneously, hold down the Ctrl button on your keyboard while you click the A value and drag with the mouse. This action can be performed on any of the sliders in XSI. With the wireframe visible, you will notice that the sphere has become more transparent. The Index of Refraction, at the bottom of Transparency, will give the object a distorted look like the refraction of water or glass, as shown in Figure 3.10. This effect is not visible in Shaded view, but if you render it and you have something behind the object, then you can see the distortion. The Reflection values also cannot be seen in Shaded view, but they can be seen with Realtime Shaders (for more info on Realtime Shaders, refer to your software manual or the Help menu). You can see reflections by first adding items to your scene that your object can
Figure 3.10 Example of refraction applied to an object
48 TLFeBOOK
Experience XSI 4 reflect and then using the Q key to see a render region (see Figure 3.11). Hold down the Q key on the keyboard and drag the curser across what you want to render.
A quick and easy way to view the effects applied to an object in your scene is to use the Render Region. This is a great tool for quickly previewing any modifications to your objects that have materials or textures. To use the Render Region, hold down the Q key on your keyboard and drag the cursor across the area of the screen you would like to preview. If you need to increase the resolution or the aliasing of your render, look for a small blue box on the upper right-hand side of the region; this is the resolution slider. Sliding up increases the resolution; sliding down decreases it. Figure 3.11 Example of reflection applied to an object
Figure 3.12 Example of Translucency applied to an object.
3. Texturing Your Character
The last tab on the Materials dialog box, Indirect Illumination, cannot been seen in Shaded view, but in Chapter 7 you’ll learn about its properties—Global Illumination, Caustics, and Final Gathering. The other two areas of on the Indirect Illumination tab, Translucency, shown in Figure 3.12, and Incandescence, shown in Figure 3.13, will give your object a glowing or illuminated appearance.
Figure 3.13 Example of Incandescence applied to an object.
49 TLFeBOOK
Experience XSI 4 In XSI, there are many different types of materials you can apply to your object (see Figure 3.14). Phong, Lambert, Blinn, Cook-Torrance, Strauss, Anisotropic, Constant, and Toon can be found under the Material tabs. All of these materials have a unique look and function and can be used for a variety of purposes—from skin to metal, stone to cloth. The materials are the base to which textures can be applied. Materials without some kind of texture have a “too perfect” appearance.
Figure 3.14 Examples of different materials
Texturing Basics: Using the Render Tree and the Texture Layer Editor Texturing is the next step after applying a material. Textures will give your character life by unifying all of its elements. The broad shapes of your model can be enhanced by the fine detail from the bump and displacement maps. The color can be made more vibrant using color maps. And the translucency (mixed with volume effects) of the object can be given a realistic subtly that can mimic skin.
3. Texturing Your Character
The Render Tree is where you can see and edit your textures in a node or tree-based schematic. Let’s do a simple texturing exercise to give you a better understanding of what texturing is. First, start with a sphere (Get > Primitive > Surface > Sphere).
50
Before you apply a texture, you need to apply a material. Get a material (see Figure 3.15) by selecting Get > Material > Phong. With the sphere still selected, get a texture (Get > Texture > Image). This is an image-based texture, meaning that it will be utilizing an image instead of some other procedural type (see Figure 3.16). To see the texture on the sphere, first change the view from Shaded to Textured. Do this by clicking on the Shaded icon in the top right-hand corner of the View Port. A menu will open; scroll down and select Textured. This will change the view from Shaded to Textured (see Figure 3.17). Next, you need to give the texture a projection coordinate. This is the way the texture will be projected onto the object (see Figure 3.18). Applying a texture automatically opens a Texture Image property page. On the right side of the box, near the bottom, is the New icon. Click this icon to open the Projection Coordinate options. Once the Projection Coordinate options appear, select Spherical. Now you can see the texture on the sphere and its texture projection, which is the green line around the object.
Figure 3.15 Applying a phong material
TLFeBOOK
Experience XSI 4
Figure 3.17 Changing the view to Textured
Let’s make a Render Region of the sphere to see the changes as you continue. Hold down the Q key on the keyboard and drag the cursor across the top of the sphere. In the Texture Image property page, enable Bump Mapping by checking the Enable box (see Figure 3.19). Now you will notice that the sphere has changed from being smooth to having a rough texture. You can also change the roughness of the texture by increasing or decreasing the Bump Factor. Now get an image to replace the default icon image: Click on New in the Image area at the top of the Texture Image property page (see Figure 3.20). From there, click on New From File. Locate your Softimage application folder on your computer (for example: C:\Softimage\XSI\Data\XSI_SAMPLES\Pictures). Import the image named gazmetal_tga2. Your new image appears in the Render Region. Now change the bump factor to -1. Next, change the interface to help organize your workflow (see Figure 3.21). Minimize the View Port window, make the left View Port a Property Editor, and make the bottom View Port a Render Tree. Both the Property Editor and the
Figure 3.18 Applying a texture projection
3. Texturing Your Character
Figure 3.16 Applying a texture
51 TLFeBOOK
3. Texturing Your Character
Experience XSI 4
52
Figure 3.19 Enabling Bump Mapping and viewing it with the Render Region
Figure 3.21 Changing the interface to ease your workflow
Render Tree options are found in the top-left of the View Ports, under the Views menu. In the Render Tree, you will notice a node or tree-based configuration. In the top left-hand corner of the Render Tree, click on the Show button and select Show Thumbnails. This will make it easy to quickly see your images, which is especially helpful when the Render Tree has many images. The orange box on the left is known as a material node. Every object that can be rendered has a material node. This is where all the shaders get attached. As in our scene, there is a texture node attached to a phong shader node that is connected to the material node. The red and blue arrows show where and how they are connected. You can expand any of the nodes to see their properties by clicking on the gray arrow at the top-right of the nodes. You can also disconnect or redirect how they are connected to each other by clicking on the ends of the arrows.
Figure 3.20 Applying an image to the sphere
Now let’s get another image node (see Figure 3.22). Click Nodes at the top of the Render Tree and select Texture > Image. This will drop an image node into the Render Tree. TLFeBOOK
Experience XSI 4
Figure 3.22 Getting an image node from the Render Tree
Figure 3.23 Adding a bump map
Now get another image node from the Nodes menu and connect it to the specular of the Phong shader (see Figure 3.24). You can see the color of the icon in the highlights of the sphere. Change the icon image to a bump and specular image by opening the image nodes and importing the bump image (see Figure 3.25). These images can be found in the same location as the color image imported earlier. (For example: C:\Softimage\XSI\Data\XSI_SAMPLES\Pictures.) The image is gazmetal_big_bump. Use this image for both the bump and the specular nodes. Get another image node from the Nodes menu and connect it to the Displacement of the material node (see Figure 3.26). When rendered, the sphere appears to expand and change shape. This is because the icon image is displacing the geometry of the sphere. Figure 3.24 Adding a specular node
3. Texturing Your Character
XSI inserts the new nodes into the Render Tree randomly. You can organize the new image nodes by clicking the left mouse button and dragging the nodes to where you want them. Next click on the red circle in the top right corner of the node and connect it to the bump mapping of the other image node. Open the new image node by double-clicking on it and then enable the bump mapping. In the Render Region you can see the bump of the default icon image through the texture of the image you imported (see Figure 3.23).
53 TLFeBOOK
Experience XSI 4 Make sure the sphere is still selected, and then, on the right of the interface, click on the Selection button right above the Transform panel. Select Geometry Approximation. The Geometry Approximation property page will open (see Figure 3.27). In here you can fine-tune the displacement to get a cleaner-looking result. Under the Displacement tab in the Geometry Approximation dialog box, click on the circle next to Fine (see Figure 3.28). When the menu expands, click on the box to the right of View Dependent. This will give you a more detailed and accurate displacement.
3. Texturing Your Character
To see the render with proper shadows, you’ll need to enable Shadows in the light’s properties. To do this, press the 8 key on your keyboard. This will open an Explorer page, from which you can access the light’s properties (see Figure 3.29). Double-click on the Light icon to open its property page and then click on Enable Shadows. Now, when the image is rendered, you will see a better-looking image.
54
Figure 3.25 Adding a bump and specular image
Figure 3.26 Adding a displacement node
Figure 3.27 Accessing the Geometry Approximation property page
TLFeBOOK
Experience XSI 4 In the Render Tree, change the icon image for the displacement to the gazmetal_big_bump image. A quick way to use the same images stored inside the scene is to go to New From Source instead of New From File. Next, change the top-left View port to a Texture Layer Editor and disconnect the Displacement Node in the Render Tree by clicking and pulling the red arrow connected to the main material (see Figure 3.30). Hit the Refresh button (the circular arrows next to the lock icon) at the top of the Render Tree. There are a couple of different ways to add a new texture that will appear in the Texture Layer Editor. One way is to select Texture under Modify on the left side of the interface. Select Add Image, which will apply a new image node in the Render Tree as well as a new layer in the Texture Layer Editor (see Figure 3.31).
Figure 3.29 Enabling Shadow in the light’s property page
3. Texturing Your Character
Figure 3.28 Adding Fine to the displacement
You can change the amount of influence of the Ambient or Diffuse feature within the layer by dragging the mouse over the value sliders. Drag to the left to decrease the value and to the right to increase it. Clicking on the Over icon will expand the
Figure 3.30 The Texture Layer Editor
55 TLFeBOOK
3. Texturing Your Character
Experience XSI 4
56
Figure 3.31 Adding a new texture
Figure 3.32 Adjusting the layer values
Mixing mode. In here, much like with compositing, you can change the type of mixing that the layers will have (see Figure 3.32).
Texture Editor Overview The Texture Editor allows you to modify the fit of a texture projection that you have applied to your object (see Figure 3.33). Texture projections are similar to the overhead projectors you remember from school. The object you have built is the screen and the texture is the transparency laid on the screen of the overhead projector. Therefore, the texture projected onto the image is just that—projected onto it. Because of this, you’ll get some stretching of the texture in places on the object that the projection can’t accommodate. In order to produce a goodlooking texture, you need to fit the texture to the object. The Texture Editor gives you a flat representation of the object under the texture you have chosen to apply to it. From here, you can shift the UV (U horizontal, V vertical) coordinates of the texture to best fit your object. Figure 3.33 Example of the Texture Editor
TLFeBOOK
Experience XSI 4
Setting Up UV Coordinates Using the Texture Editor To understand how the Texture Editor works, first select a Primitive > Model > Body - Man (see Figure 3.34). Maximize the top-left View port horizontally by middle-mouse clicking the Minimize/Maximize box in the top-left of the view port. Make the bottom View port into a Texture Editor. Change the top view port to Textured mode so that the textures are visible. Make sure that the model is selected in order to see the UV coordinates in the Texture Editor. Once the Texture Editor has refreshed to show the selection, you can deselect the model and the selection in the Texture Editor will still be visible. You can see that the model in Figure 3.35 already has UV coordinates set up.
Figure 3.34 Getting a model
Figure 3.35 Setting up the view ports to work with the Texture Editor
Figure 3.36 Deleting the texture coordinates
3. Texturing Your Character
To understand how to work with the Texture Editor, delete the texture coordinates by selecting the model and clicking on the Clusters icon on the left of the interface (see Figure 3.36). When the window pops up, open the UV_Clusters node and delete Texture_Projection. This way, you’ll be starting with a clean model.
57 TLFeBOOK
Experience XSI 4 Next, add a texture projection by selecting the model and selecting Render > Get > Image Texture (see Figure 3.37). Once the Image Texture Properties Page pops up, apply a new texture projection and select Cylindrical. Once this is applied, you will notice how the Texture Editor updates itself with the new UV projection. You can manipulate the mesh, which are the UVs for the texture, in the Editor (see Figure 3.38). You can select the mesh by using the arrow on the left side of the Editor toolbar. To do so, select the area by holding the mouse button and dragging across the area you want. This area can now be scaled, rotated, or translated by using the s, r, and t buttons, respectively, in the toolbar.
3. Texturing Your Character
Hit Control+A on your keyboard or go to your Editor toolbar and hit Select > Select All. This selects the entire mesh. Click on the t button and translate the mesh out of the image area of the Texture Editor. This will make it easy to organize the UVs as you edit.
58
In the Camera view, press the T key and then drag with the mouse across the head of the model. With the head now selected and the cursor in Camera view, hit the F key. This will frame the selected area. Now orbit the camera using the O key until it shows the face somewhat straight on, and, with the Y key, select just the right half of the face.
Figure 3.37 Adding a texture projection and viewing it in the Texture Editor
Now, in the Texture Editor in the middle of the toolbar, you will see icons in the shape of a cube, a cylinder, a sphere, and so on. These icons represent the different texture subprojections that can be applied to a selection in the Editor. Click on the cube and select Best Fit. This is a planar subprojection, and by applying Best Fit, XSI tries to find the best angle to which to align the subprojection for this selection (see Figure 3.39). Sometimes applying Best Fit doesn’t align the projection exactly where you want it to be. If this is the case, you can manually select the texture projection in the Camera View and either scale, rotate, or translate the projection (see Figure 3.40). In the Texture Editor toolbar, click on the ISL button. This is the Island Selection Filter, and when it is activated, you can select all points that are connected. Select the face in the Editor and change its planar subprojection to XY Object Aligned. In
Figure 3.38 Translating the UVs
TLFeBOOK
Experience XSI 4 the Camera View you will notice the texture stretching on the side of the head (see Figure 3.41). This is because the texture is being projected from the front and cannot properly conform to the side of the head, resulting in a distortion for this area. Let’s fix the distorted areas. First, select the side and back of the head with the U key. If you need to continue your selection, then you can use the Shift key on your keyboard. Now select Best Fit from the planar subprojection and translate the selection to the right, close to the front of the face (see Figure 3.42). The edges of the projections you have selected are irregular. These edges fit together somewhat like puzzle pieces, making it easy to line the side of the face up to the front. In the Texture Editor, click off the ISL button so that you can make single point selections. Now select two of the closest points from either side of the two different planar subprojections. Next, select Tools > Collapse. This will merge the two points together, as shown in Figure 3.43.
Figure 3.40 Adjusting the texture projection
3. Texturing Your Character
Figure 3.39 Applying a planar subprojection
Figure 3.41 Changing the planar subprojection
59 TLFeBOOK
Experience XSI 4 Continue selecting and collapsing corresponding points until both sides merge as one (see Figure 3.44). In Camera view, select the back of the head using the U key. Now, in the Texture Editor, choose Best Fit from the planar subprojection. Scale and translate the selection to meet up with the right side of the head, lining it up as closely as possible. Now select all of the projections and translate them over to better fix the image (see Figure 3.45).
3. Texturing Your Character
Sometimes the two different projection points don’t meet up as closely as you would like. One way to modify the mesh and move the points a little closer to each other is to use the Proportional Modeling tool. Click the Proportional Modeling Tool button to activate it. Then right-click on the Proportional Modeling Tool button to see its properties. In the property page, change the Distance Limit to 0.1, and use the M key to move the points in the Texture Editor closer to each other.
60
Figure 3.42 Selecting a new planar subprojection
Figure 3.43 Collapsing points in the Texture Editor
Figure 3.44 Collapsing more points
TLFeBOOK
Experience XSI 4
Figure 3.46 Collapsing the rest of the points
Now collapse every two points together until the head is completely merged (see Figure 3.46). In the Camera view, orbit around the head. You can see that the texture conforms to the head with very little distortion. To see the head with a smoother appearance, subdivide it by clicking on the + key on your keyboard. To speed up the UV editing, you can mirror one side to the other (see Figure 3.47). To do so in the Camera view, use the y button to select the half of the head that has no texture. Next, minimize your Texture Editor window horizontally and make the other bottom view port into a Net view window. Click on Tools > Render. Now scroll down and select UV Mirror Tool (script). Click on MI UV Mirror.VBS. Once the script is activated, choose YZ plane (invert x-axis) and click OK. This will mirror the texture from the opposite side of the selection in the YZ plane. Now you can change the default of noIcon.pic to an image of a face. To do so, you need to create an image of a face by taking a photo of someone. This image should be the front and side of the face merged together in Photoshop then
Figure 3.47 Mirroring the UVs
3. Texturing Your Character
Figure 3.45 Moving points in the Texture Editor
61 TLFeBOOK
Experience XSI 4 cropped down the middle of the face. Select the default model and hit 7 on your keyboard to open up the Render Tree then double-click the image node to open its property page. From here, import the image you have created. Line up the UV mesh with this image in the Texture Editor by translating or using the Proportional Modeling tool (see Figure 3.48). Another way to apply a subprojection to a face in the Texture Editor—a way that doesn’t take all the work of creating different planar subprojections—is to select the whole head and apply a cylindrical subprojection. This is represented by the cylindrically-shaped icon next to the planar subprojection. Once it is applied, notice in the Texture Editor how the head appears to be unwrapped (see Figure 3.49). This is great for some things, but personally I find it hard to line up a face without doing a lot of reshaping and tweaking in Photoshop.
3. Texturing Your Character
Adding Texture to Your Character Using the Texture Editor
62
Now start texturing the character you modeled in the previous chapter. First, open the scene called Final Model you saved from Chapter 2. Select the model and add a simple phong material, setting the Diffuse R to 0.768, G to 0.700, and B to 0.626 (see Figure 3.50). This will give the diffuse a tan appearance. Leave the Ambient RGB at 0.300 for now. Next change the Specular RGB settings to 0.252. Most of these settings will change when the image is determining the RGB values.
Figure 3.49 Applying a cylindrical subprojection
Next add a texture. Select the model and apply a texture image, then select a cylindrical texture projection (see Figure 3.51). Remember that if you want to see how the texture is being distributed along the model, you can change the mode to Texture mode. Make the View port into a Top view. Select the character and hit the F key to frame it. Use the Y key to select the right half of the character. Make sure you select exactly half of the body (see Figure 3.52). With half of the body selected, press the H key. This will hide the half of the character that was selected (see Figure 3.53). Now hit Control+Shift+A. This will deselect the ghosting polygons. Hiding half of the character makes the texturing process much easier. Change your interface so that the top view port is the Camera view and the bottom view port is the Texture Editor.
Figure 3.48 Lining up the UVs to an image
TLFeBOOK
Experience XSI 4
Figure 3.52 Selecting half of the body
Figure 3.51 Adding a texture to the character
Figure 3.53 Hiding half of the character
3. Texturing Your Character
Figure 3.50 Applying a phong material to the character
63 TLFeBOOK
Experience XSI 4 To make our scene a little more organized, let’s make a couple of layers that will have everything but the body in them. In the Camera view, select everything in the scene by using the right mouse button and dragging across the scene. Select New Layer under Layers at the top right-hand side of the interface (see Figure 3.54). Name this layer bg. Next deselect and reselect just the body, make another new layer, and call it creature. Hit the 6 key on the keyboard to open the Layer Controls box. Uncheck the three options (View Visibility, Render Visibility, and Selectability) of the bg layer. This will leave only the creature visible, making it much easier to see and work with when applying textures (see Figure 3.55).
3. Texturing Your Character
With the cursor over the Texture Editor, hit Control+. This will select all of the UVs. Next click the t button in the toolbar and move the section over to the right, out of the image area of the Texture Editor (see Figure 3.56).
64
In the Camera view, use the Y key to select the head and neck of the character. With the head selected, apply a planar subprojection within the Texture Editor’s
Figure 3.55 Hiding layers
Figure 3.54 Making new layers
Figure 3.56 Selecting and Moving UVs
TLFeBOOK
Experience XSI 4 toolbar (see Figure 3.57). Select Best Fit. After the subprojection has been made, use the SRT scale and translate functions to move the selection over to the right of the Image area again, leaving the Image area clean. In the Camera view, use the U key to select only the body of the character; avoid the head and neck, as well as the arms, legs, and tail. When making the selection, start at the base of the neck where the last section ended. When using the U key, you will most likely have to use the Shift key to continue your selection until completed. After the selection is made, apply a planar subprojection with Best Fit (see Figure 3.58). Again, scale and translate the section over to the right, but make sure to position the section so that it doesn’t overlap the UVs of the head and neck. This will make organizing the UVs easier. In the Camera view, using the U key, select the upper arm of the character. After the selection is made, apply a cylindrical subprojection with Best Fit. Again, scale and translate the section over to the right. Figure 3.57 Applying a planar subprojection to the head and neck
Follow the directions above to the upper arm (see Figures 3.60 and 3.61). Next select the hand of the character without selecting the thumb or fingers. After the selection is made, apply a cylindrical subprojection with Best Fit. Scale and translate to the right (see Figure 3.62). Now do the same for the fingers and the thumb (see Figure 3.63). Complete the above directions for the upper leg, being careful not to select the body (see Figure 3.64). Continue the selection of the rest of the leg, foot, and toes separately, using cylindrical subprojection with Best Fit, and moving them away from each other and to the right. If there are any UVs from the side of the character that you are texturing, find where they are on the body and try to apply subprojection accordingly. Do not apply a subprojection to the side of the character that is hidden. Figure 3.58 Applying a planar subprojection to the body
3. Texturing Your Character
In the Camera view, use the Y key to select the tail. After the selection is made, apply a planar subprojection with Best Fit and again scale and translate the section over to the right (see Figure 3.59).
65 TLFeBOOK
3. Texturing Your Character
Experience XSI 4
66
Figure 3.59 Applying a cylindrical subprojection to the tail
Figure 3.61 Applying a cylindrical subprojection to the forearm
Figure 3.60 Applying a cylindrical subprojection to the upper arm
Figure 3.62 Applying a cylindrical subprojection to the hand
TLFeBOOK
Experience XSI 4
Figure 3.64 Applying a cylindrical subprojection to the upper leg
After successfully applying subprojections to the entire half of the character, one at a time, scale and translate them back into the image area in an organized fashion, as in Figure 3.65. Now it’s time to unhide the other half of the character. First unhide the bg layer then select Unhide All Polygons (found under View at the top of the interface); the other side of the character will reappear (see Figure 3.66). Living creatures are never perfectly symmetrical—one side will always vary slightly from the other. You can mimic this imperfect reality by applying individual subprojections to the other half of the character. What you do will depend upon how closely your character will be viewed and how detailed you want to get. For most CG characters in movies you would definitely take the extra steps, but in some situations (and for our purposes) you can get away with mirroring the UVs. As we did earlier in this chapter, use the Y key to select the half of the entire body from the top view that doesn’t have the subprojections applied. Now open a NetView (View > Views > NetView), click on the Tools tab, and then click on
Figure 3.65 Organizing the UVs
3. Texturing Your Character
Figure 3.63 Applying a cylindrical subprojection to the upper finger
67 TLFeBOOK
3. Texturing Your Character
Experience XSI 4
68
Figure 3.66 Unhide All Polygons
Figure 3.67 Mirroring the UVs.
Render. Now scroll down and select the UV Mirror tool (script) by clicking on MI UV Mirror.VBS. Once the script is activated, click OK to YZ plane (invert x-axis). This will mirror the texture from the opposite side of the selection in the YZ plane (see Figure 3.67). Another way to mirror the UVs is to use the Symmertrize Polygons tool method discussed in Chapter 2. In the top view, use the Y key to select the half of the entire body that doesn’t have the subprojections applied and delete that half. Now use the spacebar (the normal method) to select the other half, and go to Modify > Poly.Mesh > Symmertrize Polygons. Select the default on the property page that appears. This creates a symmetrical image in the x-axis and welds the two sides together. Close the property page and with the model selected, click on the Freeze button. You should freeze the texture projections on all your models. Once you freeze the texture projections they become explicit UVWs and can be duplicated and moved without losing their texture coordinates. To freeze the texture projections, select everything you want to freeze and right-click on the Freeze icon at the bottom of the right side of the interface. This will expand the options of what to freeze. Select Selected to freeze your work.
Working with 3D Paint Programs to Texture Your Character Now that you’ve applied the proper UV coordinates to your character, it’s time to start applying textures to follow these coordinates. There are many ways to do this. You could just use Photoshop to import XSI’s Stamp UV Mesh tool (found in the Texture Editor under Edit), but all this will give you is an image that shows how the UVs are distributed, the same way they look in the Texture Editor. With the UV image you could try to paint your texture as an overlay but in most cases—especially when the mesh is complex—the results will not be satisfactory.
TLFeBOOK
Experience XSI 4 With a character as complex as the one you are working on, you need to paint your model in a 3D paint program. 3D paint programs give you the ability to paint on your model much like in the real world. XSI will eventually have a 3D paint feature. For now, I use Deep Paint 3D (see Figure 3.69), from Right Hemisphere. Deep Paint works well with Photoshop (see Figure 3.68) and XSI. You can import an .XSI format or many other formats and use the UVs from that model to paint. You can also export sections of the model from Deep Paint into Photoshop and paint just that section using the tools in Photoshop, then import the textured sections back into Deep Paint, and then export them, after you are done, into XSI. There are, of course, many other ways to achieve the same goal, but this is how I paint textures right now (see Figure 3.70).
Figure 3.68 Example of Photoshop
Figure 3.70 Example of model with texture applied
3. Texturing Your Character
Figure 3.69 Example of Deep Paint 3D
69 TLFeBOOK
Experience XSI 4
Finalizing Your Textures in the Render Tree When texturing using 3D paint programs, I like to start painting the bump map, which gives the character a surface of pores and wrinkles. This is the basis from which I can start painting a color map, as well as transparency and specular maps. Once these maps are made, you can apply and organize them in the Render Tree. See Figure 3.71 for an example. If you didn’t make or paint any of the textures, then download them from the Web site under Character Textures. When organizing the maps, start with the bump map as your first image texture, enable the bump mapping, and increase the bump factor to –0.8696. Preview this with the Render Region to see the results (see Figure 3.72). Next, add another image-based texture under Modify > Texture >Add > Image and make this the color map. It will automatically attach itself to the phong shader as a new layer (see Figure 3.73).
3. Texturing Your Character
Figure 3.72 Applying a bump map
70
Figure 3.71 Example of the texture maps applied in the Render Tree
Figure 3.73 Applying a color map
TLFeBOOK
Experience XSI 4 Now get another image-based texture under Nodes in the Render Tree and make this the specular map. Connect this to the phong shader’s specular input (see Figure 3.74). The last image-based texture will be the transparency map. Connect this to the phong shader’s transparency input (see Figure 3.75). To give your character’s skin a more lifelike quality, you can apply a volume shader. This is found under Nodes > Volume > Volume Effects. Connect this to the Volume input of the Material shader (see Figure 3.76).
Figure 3.75 Applying a transparency map
Figure 3.74 Applying a specular map
Figure 3.76 Applying a volume shader.
3. Texturing Your Character
Since the default Volume shader’s function is very general (to allow for various applications), you will need to do some adjusting in Volume effects. Double-click on the Volume shader, click on the Light tab and then on Pick Item; now select a light. Next, open the Scattering tab and adjust the Ambient setting to R 0.742, G 0.570, B 0.403 and the Absorption settings to R 0.194, G 0.274, B 0.462. Next, place a check next to both Volume Density and Transparent. Now open the Proximity tab and check On. Adjust the Cone Angle to 46.286 and the Intensity
71 TLFeBOOK
3. Texturing Your Character
Experience XSI 4
72
Figure 3.77 Adjusting the Volume shader
Figure 3.78 Previewing the results
scale to 53.81. Open Falloff and check Radius, then adjust the Distance to 24.762 and the Bias to 0.686 (see Figure 3.77). Now, make a Render Region on your character to preview the results (see Figure 3.78). You can adjust any of these settings to your preference. If you have any questions about what these setting are or what they do, just click on the question mark (?) within the shader. Finally, save the scene as Final_Textured_Character.
Texturing Eyes and Nails In this section you’ll be adding the final details to the character by texturing the eyes and nails (see Figure 3.79). Open the Final_Textured_Character scene you just saved. Select the entire creature and make a new layer. Call it “body.” Now deselect all by clicking on an open area or by pressing Control+Shift+A. Select one of the eyes, making sure to select both the outer and inner eye. With the eye selected, make a new layer and call it “eye.” Open Layer Control and uncheck the body layer. Now you should have only the eye visible. Select the outer eye, and in the Camera view port hit the F key on
Figure 3.79 Example of a textured eye
TLFeBOOK
Experience XSI 4 your keyboard. This will frame the eye. In one of the other view ports open a Net View. Under Library > Render >Glass > Glass 001, hold down the left mouse button and drag the Glass 001 Shader over to and on top of the outer eye. This will apply the shader to the outer eye (see Figure 3.80). Next, select the inner eye and add a phong shader. Open the Render Tree and double-click to open the phong shader. Change the Specular RGB value to 0. Under Indirect Illumination > Incandescence, change the Intensity to 0.207 (see Figure 3.81). Now add a texture to the eye and give it a Planar XY texture projection. Change the Shaded view of the Camera view port to Textured. From the Texture collection on the Web site, apply Eye232bump as the first texture for the inner eye. In the Camera view port, select the Texture Projection box and scale it to line up with the eye, making the iris fit within the concave region of the inner eye. Enable bump mapping and change the bump factor to 12.3353 (see Figure 3.82).
Figure 3.80 Adding a glass shader to the outer eye
Figure 3.82 Adding a texture to the inner eye
3. Texturing Your Character
Figure 3.81 Adding a phong shader to the inner eye
73 TLFeBOOK
Experience XSI 4 Next select the inner eye and add the color map named Eye 234-2. In order to add an additional image texture without overriding the previous one, go to the Render toolbar Modify > Texture > Add > Image. Now your texture images will be applied as separate layers. Make a Render Region around the eye to preview the texture (see Figure 3.83).
3. Texturing Your Character
The final detail will be to add a bump map to the outer eye. This will make the eye look more realistic by making the outer surface appear less perfect. Select the outer eye and apply an image texture. Give it a cylindrical texture projection. From the Image Texture collection, use the texture named OuterEyeBump and click on enable Bump Mapping. Change the Bump Factor to -1.7391. When rendered, you should have a nice-looking eye (see Figure 3.84). You should freeze the texture projections on all your models. When you unhide the body layer you can duplicate the eye and move it over to where the other eye is, deleting the old eye.
74
To make texturing many objects easier, you can group them together. Grouping is a great way to speed up the texturing process for objects with the same texture. The nails are a good example of objects with the same texture. After you make them a group, you can apply a material and texture to all the nails at once. Texturing the nails of the creature can be done the same way as the eye. Select the nails by clicking on the first nail, then pressing the Shift key, then selecting the next nail. When you have selected all of the nails, click on the Group icon, which is at the bottom-right of the interface. Now, with the group highlighted, add a phong material. Apply a texture and give it a cylindrical texture projection (see Figure 3.85). You can apply the three different textures available for the nails on the Web site: NailBump, NailColor, and NailSpec.
Figure 3.83 Adding the color map for the inner eye
Working with Hair For years, it was impossible to achieve realistic hair in any computer animation program. You would have to fake it using textures or alpha channels on grids with some kind of dynamics applied. Only recently has technology been available in any animation software that utilizes geometry or volume-based hair. XSI has one of the best hair software applications available. With the hair program in XSI, you can grow, cut, style, color, and add dynamics to your character’s hair, greatly enhancing your character’s appearance (see figure 3.86). The hair in XSI is mod-
Figure 3.84 Adding a bump map to the outer eye
TLFeBOOK
Experience XSI 4
Figure 3.86 Example of hair in XSI
eled to act like hair in the real world and so will react to a number of influences in your scene. XSI hair can move naturally, contain shadows, and respond to other elements in the scene (such as wind or gravity). In this section, I will go over some hair basics. Start by getting a primitive polygon sphere and, with the Y key, select the top of the sphere. To access the Hair panel, click on the Scissors icon on the bottom-left of the interface. With the top of the sphere selected, go to the Hair panel and under Create, click on Hair > From Selection. This will apply hair only to the selected area (see Figure 3.87). As you can see, it doesn’t look like hair—it looks like little lines or normals protruding out of the sphere. These are known as guide hairs. XSI hair is separated into two categories: guide hairs and render hairs. Guide hairs are just what they sound like, guides for the render hairs to follow. Changes to guide hairs create changes to the render hairs. To see the render hairs in Shaded or Wireframe mode, enable the Render Hairs display at the bottom left of the Hair panel. By checking the Render Hairs box, you can see the render hairs as styled. The percentage slider allows you to manipulate the percentage of hairs to view, from 0%
Figure 3.87 Applying hair to a sphere
3. Texturing Your Character
Figure 3.85 Appling texture to the nails
75 TLFeBOOK
Experience XSI 4 to 100%. If you choose 100%, styling will be very slow. 10% is the default when activated. This gives you enough detail to get an idea of what the style will look like when rendered. The Hair property page includes many options (see Figure 3.88). You can access the property page by selecting the guide hairs and hitting Enter on your keyboard. In the property page you can change the total number of hairs, change the effect of the hairs, adjust the dynamics, and add presets to the hair from straight to curly.
3. Texturing Your Character
Select the hair and hit the 7 key on your keyboard. This will open the Render Tree. Here you can change the color of the hair from the root to the tip, as well as the color of the specular or the transparency (see Figure 3.89). You can also add pre-made hair shaders, found in the Net View under Library > Render > Hair. With these presets you can drag and drop onto either the hair or the material in the Render Tree.
76
In the Hair property page, click on the Effect tab and change the values of Frizz or Kink, depending on what look you want to achieve. Also change the Thickness of the Root setting and the Tip setting. With the Tip setting thinner you will get the look of hair or fur, and with the tip thicker you’ll get the look of grass. Use the Render Region to preview a section of the hair to see the changes of the color and effects (see Figure 3.90).
Figure 3.88 The Hair Property Page
You can also style the hair with Proportional Modeling. Just click on the Proportional Modeling tool (the Prop icon on the right hand side of the interface) to activate it and start pulling guide hairs in the direction you want to style (as shown in Figure 3.91). You can also change the amount of influence the Proportional Modeling tool has on the hairs. Right-click on the Prop icon to open the property page and change the Distant Limit setting to what is desirable. You can also have the hairs change color over the surface, like a pattern (see Figure 3.92 below). To do so, you will need to add UV Coordinates to your sphere. The hair color will be modified using the UVs. First, select the sphere and add a material and then a texture, and then give it a spherical projection. Now select the guide hairs and click Transfer Map on the Hair panel. Hit 8 on your keyboard to open an Explorer. In the Explorer, expand the Sphere > Polygon
Figure 3.89 Changing the color of the hair
TLFeBOOK
Experience XSI 4
Figure 3.92 Using the spheres UVs to give the hair patterns
Mesh > Clusters > Texture_Coordinates_AUTO, and click on Texture_Projection (Spherical XY). This will make the hairs use the same texture coordinates as applied to the sphere. Now select the hair guides and hit 7 on the keyboard to open the Render Tree and add a texture under Nodes > Texture > Image. Connect the image node to the defuse root and defuse tip a and b of the Hair Render shader. Using the Render Region, notice how the color of the Default Icon image is transferring through the hair. There are many other things you can do with the styling or the color of the hair, many tools to experiment with. So feel free to play around with all the different features available on the Hair panel. You can also apply hair to your character the same way as you did to the sphere. Just select the section of your character with the U or Y key on your keyboard and apply Hair From Selection, then style, color, and render (see Figure 3.93). Figure 3.91 Styling the hair with the Proportional Modeling tool
3. Texturing Your Character
Figure 3.90 Previewing the changes of the hair with the Render Region
77 TLFeBOOK
Experience XSI 4
Summary
3. Texturing Your Character
In this chapter, we covered how to add materials and textures to an object as well as to the character you modeled in Chapter 2. You learned how to apply UVs and edit them in the Texture Editor. You also learned some of the functions of the Render Tree and how to add and organize shaders in the Render Tree. Next you worked with the Texture Layer Editor, then learned to work with hair, applying it to an object, styling it, and coloring it. There are many ways to texture a character in XSI and we have only scratched the surface of the program’s great capacity. But with the tips in this chapter, you should now know the basic operations needed to meet whatever texture challenges your characters will present you with.
Figure 3.93 Example of hair on the character
78 TLFeBOOK
Experience Experience XSI 4
chapter 4
Character Setup he core of character setup is a dream of making artificial life that has existed for a long time in human history. From Pygmalion to Mary Shelley’s Frankenstein to Stanley Kubrick’s 2001 and Blade Runner, there’s a strong current in our stories of the human mind’s power to modify and create new life.
T
That dream, or desire, is exactly the inspiration for making characters in 3D. Character setup (or rigging as it is often referred to in the industry) is the dream of taking all the tools and mechanical systems of 3D software, assembling them with a vision and passion, and producing a new creature ready to move. For those not familiar with rigging, a simple way to think about it is as making a mechanical skeleton for your character; later you will move those bones around to animate the character and bring it to “life.”
However you view it, one thing is clear to everyone: character setup is not simple. The rewards are great and it’s fun thing to do, but it requires mental discipline and lots of tinkering to get good at it. So, in this chapter, let’s jump into the details and quickly move from simple character setup into the depths of the profession. In this chapter you’ll start with your dinosaur character and make a puppet for it using XSI’s rig-construction tools. Figure 4.1 shows the type of mechanical rig we will be making and how some of the parts interrelate. You will then modify that rig, adding some extra bones and making a pop-up synoptic that has controls for your character.
4. Character Setup
Across the 3D industry there is a great range of thought concerning what the process of making characters actually consists of and what the big picture goals are. Many artists view the process of creating a 3D character as simulating life itself and dive into the details, making each aspect of their character and its controls as close as possible to its real-life counterpart. Others look at 3D creatures as puppets or robotic statues that run and walk where you tell them to in the service of making a game or movie. Still others see the process of making characters as a conversation with animators in a pipeline that evolves more like a piece of software. I think of the building process itself as a pattern that weaves and forms characters in slightly different variations, much like DNA.
79 TLFeBOOK
Experience XSI 4 The rest of the chapter is really optional—it’s for those interested in advanced character setup. It is a framework to understand XSI at a low level, to help your prototyping of mechanical systems, skin, and muscle. The final section in this chapter covers character setup at a production scale and how tools and workflow in XSI can impact your methods of tackling multi-character scenes, collaboration, and data management.
Template-Based Character Setup Luckily for those with little time to learn character setup or who are in a rush to start animating, XSI has a built-in system to make rigs (or puppets for your character). Follow these steps: 1. Load a guide to set up the size and proportions of your character. 2. Run one of the Rig From Guide commands for a Biped, a Biped Dog Leg, or a Quadruped. 3. Select the options that best describe how you want to animate your character and then click OK.
Figure 4.1 Rigs are networks of mechanical parts and logic
4. Character Setup
4. Delete the guide and envelope the rig to your character.
80
For example, let’s load up the scene from Chapter 3 called Final_Textured_Character. Looking at the three default guide types in XSI (Biped, Biped Dog Leg, and Quadruped), it’s clear the Biped Dog Leg guide is the closest to the form of the dinosaur. For those of you working on characters nothing like these structures, keep in mind that they are based on a rigging programming language that works as a tool kit for reaching a much broader range of character type. This is covered at the end of this chapter in the “Character Engineering at a Production Scale” section.
Guide Proportioning In this case the structure of the Biped Dog Leg is close enough to the form of an upright dinosaur that we can use the software tools without much extra rigging or scripting. Open Animate > Character > Biped Dog Leg Guide (shown in Figure 4.2). In the rest of this section we will line up the cubes of the guide to the dinosaur proportions and then add a few rigging changes to add detail on the head, tail, and feet.
Figure 4.2 The Biped Dog Leg guide
TLFeBOOK
Experience XSI 4 Manipulating the guide is pretty simple. Just select the cubes and move and rotate them around (select the object and press V for Translate mode and C for Rotation mode). Where the red bones are or how they are oriented doesn’t matter—that’s just a visual aid to let you see where the structure of the character is going. You’ll notice that there is bi-directional symmetry between the left and right sides as you move the cubes around. By selecting an object on the right side and looking in the Kinematics > Constraints Folder in the Explorer, you will find the constraint responsible for this behavior. So if you ever want to remove the symmetry on part of the body you can delete the constraints in the Explorer under Object > Kinematics > Constraints > Symmetry Cns.
Figure 4.3 The Child Compensation button
Another trick with the guide is turning on ChldComp, or Child Compensation, shown in Figure 4.3. When manipulating the right side of the body with Child Compensation on, you can see that the children of that object don’t move. Make sure you turn off Child Compensation when you stop rigging and want to start animating; if you don’t, you can end up breaking the rig apart rather than animating it. Figure 4.4 shows merging in the scene from Chapter 3 named Final_Textured_Character.
The first thing to do is to select the GlobalSRT Node under the Biped_DogLeg_Guide and scale it up (press X on your keyboard to get into Scale mode). Figure 4.5 shows the first steps in scaling and aligning the guide.
Figure 4.4 The dinosaur and rig loaded together
Next, rotate and move the different parts of the character to match the form of the dinosaur. Start with the feet. The rotation points on the feet are usually a bit higher than you would guess at first; the break point before the heel isn’t necessarily driven by bone anatomy but also by where a foot lifts off as it transfers weight on the ground. Also, for the feet, don’t forget the side roll boxes. Keep them in line with the local axis of the back heel pivot as shown in Figure 4.6. They don’t have to hit the very edge of the side, just the point that approximates where the side roll is occurring.
4. Character Setup
To see the rig through the mesh geometry easily, turn on X-ray mode under View > Display Options > Shaded Mode > Xray Mode and toggle it on.
The hands (see Figure 4.7) also get a bit tricky.
81 TLFeBOOK
Experience XSI 4
Figure 4.5 Scaling the guide to match the character
Figure 4.7 Aligning the hands
4. Character Setup
The guide has more fingers than the dinosaur, so just branch-select the fingers (middle mouse select) and delete them (with the Delete key). To get the plane of finger curl correct, orient the yellow blade triangles such that the fin is pointing outward along the plane the finger rotates on. The bone of the deleted finger may jump out around the guide. This red bone is just a visual aid and is no longer relevant; just hide the red bones by selecting them and hitting the H key. You can delete them as well if you dig around in the explorer, but to delete a bone you need to delete its root. When you get to the head, the obvious problem is that you don’t have enough resolution to describe the curl of the neck in the guide. The trick to add more divisions on the neck is simple: 1. Select the box called “Head” at the tip of the head as shown in Figure 4.8
82
Figure 4.6 Adjusting the feet
2. Hit Ctrl + D to duplicate the tip.
TLFeBOOK
Experience XSI 4 3. Translate the duplicate end cube to the next division point. 4. Continue this process by duplicating the new duplicate until you rough out the positions you want to pass through. The names of the cubes should be running in the order “Head,” “Head1,” “Head2,” and so on until you hit your last cube. Figure 4.9 shows the guide after you’ve duplicated out a few extra boxes off the head tip. XSI does a name-based search for extra resolution and draws either a skeleton or spine object through the new points. The same trick applies to fingers as well. Don’t worry that there’s no bone drawn between the duplicated objects. The programs that create the guide only look at the cube positions.
Figure 4.9 Duplicating the neck tip to increase neck resolution.
Figure 4.8 Adjusting the neck
Figure 4.10 Selecting the top of the pelvis to begin duplicating out a tail
4. Character Setup
You don’t really have a tail on this guide, but a process similar to that used on the head can be used to create one. First, select the top of the pelvis (a box called “SpineBase”), as shown in Figure 4.10.
83 TLFeBOOK
Experience XSI 4 Like you did with the head, just duplicate the object and translate it outward, repeating the process to define the location of tail-control objects as shown in Figure 4.11. With XSI, you can draw a spring-based tail through these new positions.
Once you have a guide at all the rotation centers for your character, save a backup copy. That way, if you decide to change your rigging options, you can always come back and easily generate a rig in exactly the same place.
Rig Construction
4. Character Setup
Now you are ready to start experimenting with creating different rigs from this template. Let’s start by creating a rig using Animate > Character > Rig From Biped Dog Leg Guide.
Figure 4.11 Tip duplicates mark the locations of tail controls
Typically at this phase of the pipeline you need to make quite a few rigs, experiment with their behavior, and start over again. It’s a smart idea to do some very simple enveloping (skinning) a few times just to double-check that all the centers of rotation are in a reasonable place. It also makes a lot of sense to be referring to skeletal images of the type of animal (or closest approximation) you’re making. Animation looks funny to the trained eye when it rotates in the wrong place; a good anatomy reference can help you avoid problems and improve quality in this area. For the setup you’re doing here, you only need to change the following two options in the Make Biped Dog Leg dialog shown in Figure 4.12: 1. Chest Tab > Control Icons > Cube Controls. 2. Head > Tab > Head > Quaternion Spine Head. After you’ve generated a version of the rig over the Guide template as shown in Figure 4.13, either hide or delete the guide and start testing the behavior.
84
Figure 4.12 Generating a rig from the Biped Dog Leg guide
TLFeBOOK
Experience XSI 4 Figure 4.14 shows the new rig. It’s worth experimenting with some different setups to get a feeling of how XSI can save you time or simplify animation. Here are a few tips to keep in mind: ◆ Using a quaternion spine on the head or chest can reduce the amount of counter-animation if you or the animators you work with tend to fidget a lot on the poses. ◆ You can now make stretchy spines for the head and chest that pull out for toon-style exaggerated animation. ◆ You can make ears in the Head tab. The tips of the ears can be duplicated off just like the head tip for long-eared characters like dogs or rabbits. ◆ You can get quaternion-based forearm, bicep, and thigh roll in the Roll Division tab. ◆ Use the small yellow/orange controls to position a setup for Hip/Thigh/Arm Pit Sliding and the belly. ◆ The Quadruped setup has all the same options and techniques as the Biped/Biped Dog Leg. You can duplicate tips, make shadow rigs, and so on.
Figure 4.13 The new rig and guide together
◆ By selecting the Neck object on the different guides and duplicating it out, you can define a jaw or snout chain.
4. Character Setup
You may want to select your geometry and then, in the top right, Select Menu > Selectability > Toggle Selected Objects. Doing so will make your geometry unselectable in the 3D views (but not in the Explorer) so you can easily select control objects (without accidentally getting the character mesh) and move them around. If you are not familiar with this rigging system or style, test out the following: ◆ The yellow UpperBody controller at the hip moves the entire body, the blue hip controller moves the hip alone. ◆ The yellow controllers at the chest and neck drive position and orientation. ◆ The dark green controllers on the tail layer controls rotation in the dynamics. ◆ On the feet, the large yellow controller is the foot position and orientation. The small blue controller is the forward, backward, and side roll. The gray controller between is the distribution between the dog leg bones.
Figure 4.14 The new dinosaur rig
85 TLFeBOOK
Experience XSI 4 ◆ The small yellow controllers on the feet are a layer of rotation offset on each foot bone overtop of any roll. ◆ The hand bones have a set of sliders under them for the fingers. ◆ There’s a set of sliders under the Biped_Dog_Leg model for the spine and feet. If you experiment with the rig for a while you may notice that some of the controllers are at a good scale and some are not-so-perfectly scaled. The GlobalSRT, in particular, is tiny with this setup. The reason for the sometimes odd scaling is that each area of the body is scaled relative to its volume. The GlobalSRT is scaled based on the hand distance, which is really close in this particular setup, so you have to go in and adjust it manually. To do so, just select the GlobalSRT icon, then hit T to tag points, then tag all the points on the control curve and scale them up as shown in Figure 4.15. You can continue to scale up the different curve controlers in the rig this way to fit your character.
4. Character Setup
If you think that any of the bone-based icons are at the wrong scale, just select the icon, press Enter, then adjust the shadow bone display. Some of the objects, like the hip and chest icons, also have separate draw operators under their polymesh in the Explorer, and you can adjust some of the visual properties there.
86
Figure 4.15 Scaling the icon for the global SRT
Next let’s adjust this setup by adding some missing parts like side claws on the feet. To start, let’s hide the rest of the geometry so we can really focus on that part of the body. Press Y to do a rectangular selection of polygons, then select the entire character except for the feet and press H to hide the selection. From the top view, go in and draw new chains for the side claws with Animate > Skeleton > 2D chain, as shown in Figure 4.16. Next, go into one of the 3D views and use Move Joint to tweak the claw bone so it’s well-centered. Select the bone, and then press Ctrl +J and orbit around and tweak the bone position, as shown in Figure 4.17. When you’re done, right-click to exit Move Joint mode. Keep in mind that Move Joint will adjust bone positions but it won’t work with parts fully constrained by rigging, like the foot and dog leg (but it will work with partially constrained chains).
Figure 4.16 Drawing chains for the side claws
TLFeBOOK
Experience XSI 4
Figure 4.17 Using Move Joint to adjust bone position
Figure 4.18 Mirroring the side claw bones
Next let’s add a marking set to the new bones. Select the bones, press R to enter Rotation mode and then click the Animation button below the Timeline > Parameters > Create Marking Set. This will make those bones key when you key the entire character later through marking sets. You can also save out a new default pose using their marking so that resetting the character in the future will include these bones.
Of course, it is possible to do a more complex, custom setup wherein these side elements have a separate rolling mechanism, but for this project, simple chains that move with the primary roll are good enough. Next bring the new bones into your group that keeps track of what will be deformed. Get all of your hidden polygons back; select the dinosaur geometry in the Explorer and press Ctrl+H. Under your character Biped_DogLeg model there are two groups called “envelope_group” and “hidden.” Select the hidden group and press H to unhide and hide the group to inspect hidden controllers.
4. Character Setup
Next let’s mirror over the bones to the other side. Select the two new bones in branch and then choose Animate > Skeleton > Duplicate Symmetry as shown in Figure 4.18. Parent the bones on the left side to LfootBone1 and the right side to RfootBone1.
To add the new bones to the envelope group, select the bones, then select the group, and then select Edit > Add To Group, as shown in Figure 4.19 Based on what options you select in the rig-making process, the appropriate items will be stuck into that group; anything custom must be added. Next let’s attach the skin to the character rig.
87 TLFeBOOK
Experience XSI 4
Enveloping The first things we need to keep in mind when doing deformations like enveloping are construction modes, shown in Figure 4.20. Construction modes are found in the bottom-left corner of the XSI interface. Basically, the current mode tells XSI which part of the operator stack you want to be working and interacting in. It may sound complicated, but in practice it’s very simple. If you are modeling, go into Modeling mode. If you are applying animation deforms like enveloping, then go into Animation mode. If you are pulling points on shapes, then go into Shape mode. What’s cool is that if you use this process you can do things like model on a character with enveloping or shape animation and everything will interpolate perfectly—even after you hit the Freeze button.
4. Character Setup
In fact, XSI also anticipates that people might make some mistakes and find themselves in the wrong mode now and then; for instance, if you apply enveloping in Modeling mode, it will pop up a dialog asking if you meant to be in Animation mode, since that’s the common practice. This pop-up is shown in Figure 4.21. To apply enveloping to your character, go into Animation mode and select the geometry then select Animate > Envelope > Set Envelope and pick the “envelope_group” under your character. Press W to activate weighting and see the weight map on your character, as shown in Figure 4.22.
Figure 4.20 Construction mode
If you want to work in a traditional style of numerical editing you can always hit Ctrl+E and edit the values. Personally, I prefer to stick with the brush because it’s precise and is the only way to weight a character this dense in a reasonable amount of time. The default weighting in XSI doesn’t apply smoothing, and in most cases you probably want the character smoother than it is by default. Switch over to the Weight panel with Ctrl+3, then select your geometry and click Apply Smooth near the bottom of the Enveloping panel, as shown in Figure 4.23. For a mesh this dense, set a value of 4.
88
Figure 4.19 Adding the new bones to the enveloping group
Figure 4.21 You applied enveloping in Modeling mode, but should probably be in Animation mode
TLFeBOOK
Experience XSI 4
Figure 4.22 The enveloped character
Figure 4.23 Smoothing the envelope across the entire geometry.
4. Character Setup
There are also quite a few options for weight painting your character. Press W to start weight painting as shown in Figure 4.24. Hit Ctrl+W to bring up all of the painting options. To start painting a new deformer while in Weight Painting mode, press D and then pick the deformer you want. To smooth while you are painting, hold down the Alt key. The wheel on your mouse can drive the brush radius, which can save you time when painting weights. If you don’t have a wheel, then hold down R and the left mouse button while you move to modify the radius. If you have the weights working the way you want them to on half the character, then you can mirror them to the other side. First select the dinosaur geometry and then select Animate > Envelope > Create Symmetry Mapping Template. Hit Validate and close the dialog boxes that pop up. Next press T and select the points with good weighting that you want to mirror. Run Animate > Envelope > Mirror weights to switch the weight over to the other side. Next let’s look at setting up a synoptic on your character.
Figure 4.24 Weight painting enveloping
89 TLFeBOOK
Experience XSI 4
Setting up a Synoptic If you select part of the rig and hit F3, the default synoptic that comes with the character will pop up, as shown in Figure 4.25. The default synoptic that comes with XSI has a number of useful functions that you could use right off the bat without any changes—for example Key All, Reset All, and Plot Selection. However, for most character projects you will probably require at least a small level of customization and the synoptic is a great place to centralize such workflow. Also, the UI for XSI may not have the look and feel of your character, so setting up all the buttons you need to animate in the synoptic and having it express the mood of your character can help animators zone into the task at hand later in the project. The synoptics are stored in HTML files (using a subset of that format) and can be created in the Synoptic Editor, found in Application > Views > Synoptic Editor.
Figure 4.25 The default synoptic
4. Character Setup
To do a simple image change on the synoptic, let’s start by loading up the file from the default rig. Load the default synoptic for the rig in [your softimage install location]/Data/XSI_SAMPLES/Synoptic/Rig/ BipedSynoptic_CDK1.htm. The process of loading this file is shown in Figure 4.26.
90
First off you probably want to make a new background image for the synoptic. You can use a combination of rendering and screenshots to do it and then load them by selecting Synoptic Editor > File > Import Picture From File. If you want to do highlight effects in the Synoptic view, then just save a file with the same image name but append an _h suffix and XSI will look at that map when your mouse passes over a shape region. At this point you should save out the synoptic in a different location, being careful not to overwrite the default file in XSI. It doesn’t really matter where you put it, as it will be absorbed into your project after you save if you click on Copy External Files Under Project when you do a Save As. Figure 4.26 Loading default synoptic .htm in the Synoptic Editor
TLFeBOOK
Experience XSI 4
Figure 4.27 Changing the background image in the Synoptic Editor
Figure 4.28 Linking your synoptic to your rig
Finally, we need to replace the synoptic on the rig with the new synoptic. Just select the GlobalSRT node, open the Explorer and set it to Selection mode by pressing, E and click on Synoptic Property right below your GlobalSRT. It’s just a matter of replacing the path here to the path of your new synoptic. Now save your character as Final_Character_Rigged_and_Weighted (remember to click on Copy External Files Under Project), and you are ready to animate. For the rest of the chapter, I will focus more on the details of what XSI offers for readers who are interested in the wide array of specialized rigging tools in XSI.
Advanced Character Setup
4. Character Setup
As far as programming the synoptic goes, you can click on the Scripts tab and do some experiments, hacking around small changes to get your character to work. If you want to get more serious about making some small scripts in there, the best starting point is learning some scripting, which is covered in Chapter 6, “Scripting in XSI.”
I’ve tried to structure the rest of this chapter as a commentary on how XSI works at an atomic level and have tried to offer strategies for taking advantage of it.
91 TLFeBOOK
Experience XSI 4 Rather than cover a specific style of setup, in this section I will attempt to describe the fundamental mechanics of XSI character setup tools. Hopefully the section will reveal some secrets and hints for pushing rigging forward in your own projects and in customization.
Gluing Parts Together Character setup is really the art of attaching many parts together. Understanding all of the ways in which 3D parts can be glued can make you much stronger at rigging.
Parenting Parenting is the most common and fundamental element in character assembly. Basically, it contains a single transform that offsets position, orientation, and scale. The simplest way to think about parenting is as a stick with an orientation at both ends (see Figure 4.29). The first orientation is that of your parent and the space in which your translation is described; the second is the rotation that acts as a binding site for the next parent relationship. Parenting is really a set of transforms; such a diagram really doesn’t describe the complexities of scaling and shearing, but for most character problems you are better off avoiding these operations by removing any scaling from the setup (and using properties like bone length instead). Personally, I try to keep a simple model of parenting in my head so that I can look at a complex rig and still see what’s happening and only dig deep into scaling or shearing problems when I have to.
Figure 4.29 A binding stick with a rotation on both ends is a useful analogy for parenting without scaling
4. Character Setup
Also, avoiding scaling in your rigging will make workflows like animation transfer much more easily. Of course, this isn’t always possible when working with heavy squash and stretch, but it’s worth keeping as a goal. Parenting in XSI gives you many options for disabling part of that transform in the Local Transform (select the object and hit Ctrl+K) > Option tab. Here you can set up partial inheritance. Partial inheritance is useful for doing things like setting up a head that doesn’t follow the orientation of the body or a camera rig that follows a character but always points forward.
Pivots I like to think of pivots as a new subway line that’s been carved through the core architecture of XSI 4.0. In rigging, there are a million different cases wherein you’ll want to wire underneath or over top of something and pivots open up many new avenues to design mechanical behavior and solve problems. Select an object and Hit Ctrl+K to open the Local Transform dialog. Click on the tabs and adjust the settings of the Pivot and Neutral Pose tabs to experiment with pivots. Beyond giving you lots of extra sets of transforms, pivots have the main goal of allowing you to set an animation pivot point outside your object to rotate around and transfer weight.
92 TLFeBOOK
Experience XSI 4 To get a feeling for what the pivots are doing, open your visibility options for a view then press Shift+S. Next, select the Transforms tab and then turn on Center Pivots. Pivots can be thought of as a stack of layers or steps computed by the transform. Figure 4.30 explains how these layers intertwine in diagram form. This process of computing the local transform can also be though of as a series of computational steps: 1. Neutral Pose can be thought of as an extra parent null between your object and current parent to help everything zero out during animation. All other transformations are done overtop of this. 2. Compensation comes into play after you’ve set your pivot and have started local rotation about this new point. As rotating around switching pivots moves your object around, compensation adjusts the transform so that the object stays in exactly the same global position. Mechanically, compensation can also be thought of as an extra parent. 3. Next apply Local Translation (T). 4. Pivot Transformation moves the object to the pivot point. 5. Local Rotation (R) and Scaling (S) are a layer that scales and rotates about pivot point.
Moving, keying, and turning on and off the Compensate Pivot option should give you a feel for what the pivots are doing and how to key off of different centers and animate weight transfers.
Figure 4.30 Visualizing pivot layers
In addition to a new animation workflow it’s also exciting that there are three new layers of full SRTs and every one of them can be driven by animation, expressions, the mixer, and scripted operators. Here are a few of the new possibilities that open up with pivots:
4. Character Setup
6. Finally the inverse of the pivot transformation is applied and moves the object out of the pivot point.
◆ It’s now easy to do tail or long chain setups that are driven both by algorithm and animation. Just drive the pivot with your expression/operator and leave the local transform as an offset on the local transform. ◆ You can easily make character setup tools to curl the fingers as an expression/operator on the pivot.
93 TLFeBOOK
Experience XSI 4 ◆ You can rig setups in which you need multiple centers by controlling where the pivot and compensation are through a scripted/compiled operator.
Constraints If you think of rigging as a system of character molecules and parts shifting around in space, then constraints are a family and toolkit of small binding operations. Constraints in XSI are well designed. They blend rotations properly and have many options and parameters that allow you to construct elegant systems with fewer nodes. Like pivots, constraints have a number of layers of offset. The first is compensation. Click the CnsComp (which stands for Constraint Compensation) button in the lower-right corner of the screen (shown in Figure 4.31).
Figure 4.31 The Compensation button
4. Character Setup
With Constrain Compensation on, constraints keep an offset. In a constraint like Pose (also known as a parent constraint) you can offset the full SRT exactly like a child-parent relationship. A good way to watch the compensation relationships (and constraint relationships in general) is to open your visibility options for a view: Press Shift+S, then select Attributes, then turn on Relations and Relations Info. This visual interface for watching the constraint relationships is pretty cool—you can select the constraint line between objects or floating text associated with the constraint, and then hit Enter and it will pop up the constraint’s dialog box. If you study and experiment with the different Constraint tab options you will probably notice a second layer of position compensation offset on the positionbased constraints (Position, Pose, Distance). You can think of these two compenFigure 4.32 sation offsets as metal beams coming off the constrained and constraining objects. Soft coupling on a position constraint If your coupling is set to Rigid, then they are welded together. If the coupling is set to Soft, then they act like a tractor hitch. This behavior is great for rigging a slug or anything with sinuous “follow the leader” motion. Below are some tricks and techniques you can use with the constraint system in XSI: ◆ Animated parenting. Use multiple pose constraints and their blending sliders to animate parenting. This works great for tricky problems like characters picking up objects or each other. You can also use this to blend against local animation, for example when a character picks up a wiggling object.
94 TLFeBOOK
Experience XSI 4 ◆ Path constraint offsetting. If you make a Path constraint and turn on Path Constraint Tangency and Affected by Orientation, then you can rig offsets on path constraints that bank along the curve as they move. Also, use the Lock to Path on Interaction option when you use the constraint for rigging instead of animation. ◆ Symmetry constraint. Mirroring rotations properly is a hard thing to do in 3D. The Symmetry Constraint option makes it easy both for rigging and custom tools. ◆ Simple sliding over a volume. Create a Primitive > Implicit > Sphere and then create three nulls. Take the first null which will be used to slide over the volume and Constrain > 2 Points to the other two nulls. If you select Constrain > Bounding Volume, pick the volume, and then slide the null to the sphere and it will stay outside (or on/inside) the volume as the other two nulls slide over the volume.
Many of these constraints involve a direction pointing down a single vector (for example, a direction constraint), leaving 360 degrees of spin choices available. You can go to the UpVector tab of the Constraint dialog box and set an upvector object or axis to define the spin. This concept is also important for inverse kinematics: a 2-bone IK chain has a plane of spin available and this can be defined using a Chain Up vector, which also functions to define spin.
Expressions Expressions are small one-line programs that wire XSI parameters together. They have the advantages of being fast to set up and familiar for those switching from software that doesn’t have full SDK through scripted operators. Expressions have their own syntax and some neat shortcut functions. For example, to set the value to the current frame, use the one-line expression: Fc
ctr_dist( cube.kine.global , sphere.kine.global )
Scripted Operators In my mind, scripted operators are the very powerful center of what XSI offers for high-end rigging. I believe their big advantage is the XSI core architecture itself, which acts as a layered, interactive web of programming objects, parameters, and operators that scripted operators can dexterously control. Many of the tools within XSI—like the spine, dog leg, and quaternion fcurves—were roughed out as scripted ops, taking advantage of their strength as a system for visual prototyping.
Figure 4.33 Simple parameter-based scripted operators
4. Character Setup
Or to get the distance between cube and sphere:
Figure 4.33 shows a simple example of scripted operators linking a parameter.
95 TLFeBOOK
Experience XSI 4 To link two parameters, right-click on the cube global pos y > Set Scripted Op, then drag and drop the sphere global pos y into the top of the the scripted operator panel (in the Connections area of the editor), fill in the text shown in Figure 4.33, and then click Apply. Figure 4.34 shows how scripted ops can directly connect right into the XSI core architecture and copy a transform from one object to another. To do this, rightclick on the cube global > Set Scripted Op, then drag and drop the sphere global into the Connections area of the editor, fill in the text from Figure 4.34, and then click Apply.
4. Character Setup
Figure 4.35 shows how to manipulate a transform by using methods from the math library. Use the same process to fill in the outputs as in Figure 4.35. The first thing to notice here is that you have done the semi-complex operation of offsetting on the local transform in five lines. If you had tried to do this parameter by parameter in expressions, it would have been a rat’s nest of pain to wire up. It’s really the math library objects (specifically SIVector3, SITransform, SIRotation and SIQuaternion) and their methods that make programming scripted operators so efficient. I like to think of those objects as libraries of low-level character setup tools from which you can make powerful custom-designed systems.
Figure 4.34 A scripted operator driving the global transform
The other great thing about the math library is that it’s the fastest part of XSI (it’s tweaked in Assembler for optimum speed). This means that if your scripts use the math library well, then they can approach about half the speed of compiled C++. To get that kind of performance you have to be careful to avoid redundant looping and making objects over and over again. You can see that the scripted operator in Figure 4.35 creates the Vector3 in the bottom pane, which is only run on load and operator apply. That means you aren’t taking any extra memory or time to create the vector—you’re just creating one instance of the object and using it like a shelf. A few of other exciting facts about scripted operators: ◆ They can write to the meshes interactively. This means you can create systems with parametric geometry, like an arm with a variable number of edge loops.
96
◆ They can write to multiple objects in a single operator. Just watch the variable "Out.Name" (which holds the name of your current input port) and do
Figure 4.35 A scripted operator manipulating transform with math library methods.
TLFeBOOK
Experience XSI 4 the calculations on one object and cache it for the next. Making a system that controls multiple objects is the key for managing all of the complex interdependency problems that arise in 3D. ◆ They can be stored as presets and applied like regular XSI operators using applyOp or the contents can be directly dropped into place from scripting. If you are excited about learning more about scripted operators, a good starting point is to study the object model tips in Chapter 6.
If you write your scripted operators in JScript, then it’s a straightforward process to convert them to C++ because the SDK calls are identical and the syntax is close.
You can have objects driven by springs avoid bounding implicit spheres and cubes by using Constraint > Bounding Volume after applying the spring relationships.
Springs I just quickly want to recommend experimenting with springs in XSI. Although XSI has dynamics, the spring operator is a separate kinematic tool applied when making a tail. Here’s a one-line script to apply springs in a manner similar to constraints. Just select two objects and then type the following into the Script Editor: ApplyOp ("Spring" , null, 2);
Inspect the sliders on the global pos x,y,z of the object driven by the spring relationship.
Character Components
4. Character Setup
One of the most useful skills to learn in character setup is how to break a problem into small pieces and rough together a solution. Setups are usually a bunch of small pieces that have been hashed out over time and connected together. If you are stuck on a problem for more than five minutes, then a good approach is to open a second copy of XSI and try to make a simple version of the problem. Once you have a way to do it, either load that part back into the scene or make a script that will make it for you. The makers of XSI have tried to zero in on a number on common problems and create components that can be wired together to save time or avoid an area that’s uninteresting to you. Assembling these components through the Character SDK will be covered later in this chapter, but let’s look quickly how a few of these parts can be manipulated as ready-mades. Figure 4.36 The Spine character component
97 TLFeBOOK
Experience XSI 4
Spine To create a spine, make two objects to act as the controller for the hip and chest. Select Animate > Skeleton > Create Spine then pick the hip object, then the chest object, and then set the number of vertebrae. A simple spine example is shown in Figure 4.36. The spine acts as a form of bi-directional IK, such that it meets the hip in position and rotation and the chest as best it can. The main feature of the spine is that it cleanly distributes vertebrae roll across the chest without the gimble lock problems that are prone to arise in this part of the body. In fact, the roll division has a range of 720 degrees, making it a good tool for tentacles and spaghetti arm rigs. Here are a few tips for working with the spine: ◆ Keep in mind that the controllers need to point to local y+. So when you do setups of multi-spines you need an intermediate node (or use the pivot) to get the local orientation of the next hip object pointing the right way. ◆ By default, the rotation interpolation on the spine is linear. If you want to make the lumbar roll more than the chest, then you can always edit the roll percentage per vertebra. Just open the vertebrae in the Explorer and select Kinematics > Constraints > Point At – Up Vector > X > Spine Point At and then set the appropriate roll blend between the hip and chest.
4. Character Setup
◆ You can tweak the path percentage per vertebra by selecting Kinematics > Constraints > PathCns > Path %age > Expression and changing the number to the percentage between the hip and chest. ◆ You can make a squash and stretch spine that elongates and contracts to meet the chest controller through the rigging SDK or the Rig from Guide workflow. These spines can also squash and stretch their horizontal volume if you adjust the volume_factor slider under the Controls Slider on your Biped/Quadruped model.
Tail A tail component can be created by drawing a curve and selecting Animate > Skeleton > Create Tail. The Create Tail tool applies a hierarchy of spring operators to set the bounce and whip of the tail, shown in Figure 4.37. What’s interesting is that you can animate as a layer within the dynamics. Just select one of the control cubes and rotate or key rotation on them. The idea is that you key on the low-resolution controls and envelope to the higher resolution chain. Then, if you need to hit a very exact pose on the curl of the tail, just switch the chain over to FK and key the pose in rotation, ignoring the dynamics layer.
Figure 4.37 The tail posed into a curl
98 TLFeBOOK
Experience XSI 4 The green control cubes and lines are, in fact, chains using the Shadow display to change their appearance. The effectors of these chains have operators which can be found in the Explorer under Kinematics > Global > Pos; then find the spring operator under either the x, y, or z channel. The spring operator can be turned or plotted and removed for rendering. This is especially important if you are doing batch rendering because it will render improperly without plotting.
Dog Leg The Dog Leg is a rigging component that sets up a three-bone leg for a dog, dinosaur, bird, horse, and so on. A three-bone chain with a slider and expressions controlling stiffness can meet some of the goals for this type of rig. However, animators have many tricky requests for dog legs, and this attempts to provide a framework to meet the most common problems. The Dog Leg can be loaded by selecting Animate > Character > Rig From Guide > Biped Dog Leg or Quadruped, or by using the rigging SDK command makeDogLeg().
Figure 4.38 The Dog Leg
Here are some points for working with the Dog Leg (shown in Figure 4.38): ◆ The distribution between the three bones is controlled by the gray control box on the foot. ◆ The chains are constrained into place onto a set of hidden nulls with the suffix “Guide.” If you look at the operator on the global transform of these guides, you will find extra roll offsets for the first and second bone plane and the second and third bone plane.
Understanding Inverse Kinematics IK has been around for a long time in Softimage products—since the early days when Softimage | 3D was used in Jurassic Park. As a tool IK is pretty straightforward—just draw bones with Animate > Skeleton > Create 2D (or 3D) chain and use them to create elements that can be rotated like a hierarchy. The end effector can also be grabbed like a wrist and dragged around. There are a lot of tools for controlling switching and blending between IK and FK animation and manipulation. Press Ctrl+R to see the Kinematic Chain properties and change the FK/IK Blend slider.
4. Character Setup
◆ There’s a slider to control the locking percentage under the Controls Slider on your Biped Dog Leg /Quadruped model.
You can view the different results of the chain by changing the FK/IK Ghosting in the same PPG. Then turn ghosting on in a view by checking Skeleton FK/IK Blending in the Display mode.
99 TLFeBOOK
Experience XSI 4
If you (or your animators) are having flipping problems while animating an arm in rotations, there’s very little you can do on the rigging side. The problem is that the rotation keys are being interpolated as Euler curves. One trick is to select Animation (the button below the timeline) > Convert Euler Rotation to Quaternion and study the difference in key interpolation. After converting you can experiment with the tangency methods for Quaternion in the Animation Editor (right-click on the top bar and activate Quaternion Keys) or add a bunch of in-between keys and convert back to Euler for familiar tangency handles.
For controlling the hand orientation between IK/FK blending, select a chain then press Ctrl+R then select Blend Effector Rotation Against Bone and turn on Link with FK/IK Blending. This will set up a relationship wherein the wrist orients with the forearm in FK and will allow you to animate or constrain the orientation in IK. This is a real timesaver if you want a wrist to lock to a table or wall when a character leans on it in IK, but you still want good FK animation and tricky stuff like forearm roll to work seamlessly.
Figure 4.39 The cosine law
4. Character Setup
Cosine Law for Two-Bone Chains
100
For the experts out there who want to understand and harness IK at a math level, it’s worth taking a quick look at what a two-bone IK solve is actually doing. In fact, it’s simpler than you would think and involves only one well-known equation: the cosine law, which is shown in Figure 4.39. The cosine law describes the relationship between the sides and angles in a triangle. Given the lengths of three sides, you can figure out an angle. If you have two bone lengths, then you can assume the start is (0,0,0) and the end lies on the vector (1,0,0). Making that assumption means you can just use the theta value from the cosine law to rotate bone1 into place. Of course, IK effectors are not always sitting on the 1,0,0 axis. So the trick is to figure out a second angle and axis to get that into place. All you need to do is get the α angle and cross product between StartEnd vector and (1,0,0). This is all the information you need to set a rotation in axis and angle notation to transform your system as shown in Figure 4.40. Cross products and rotations will also be studied in more detail in Chapter 6.
Figure 4.40 Transforming a custom IK off the (1,0,0) Vector
TLFeBOOK
Experience XSI 4
Deformations Deformations move points around in space and are the primary character setup tools to make skin and muscle systems. In XSI, the Deform tools can be found under Model > Modify > Deform and Animate > Create > Envelope. All deformers in XSI can be combined with weight maps. Weights maps are just generic clusters of properties; you can have as many of them as you want and wire them to whatever deformers you want.
Enveloping Algorithms Enveloping (also referred to as skinning in other software packages) is the oldest and most popular deformer. The simplest way to think about enveloping is as blending parenting. For example, get a primitive body (select Model > Primitive > Model > Body – Man) and a simple skeleton (select Model > Primitive > Model > Biped – Skeleton). Typically, the best way to control what objects are going to be affected is to put them into a group and weight to that. The skeleton already has such a group, so just select the man geometry and then select Animate > Envelope > Set Envelope and pick envelope_Group in the skeleton model. When the Automatic Envelope Assignment PPG comes up, you can set it to 1 and you will see that the enveloping is like parenting.
Mechanically, you can think about enveloping as a pile of parenting relationships that are blended in position. For example, if you want to mimic the behavior of a point enveloped to three chains using constraints, you could just do the following:
Figure 4.41 Simple Enveloping set to a maximum assignment of 1
◆ Make three tracer objects at the position before deformation and parent them under the three chains in the Neutral pose. ◆ Make a new point result object and do an N point constraint between the tracer objects. ◆ Set the percentages of the N point constraint to match the enveloping percentages required. This parenting and constraint relationship should mimic the result from enveloping exactly.
4. Character Setup
In Figure 4.41, you can see that when you move the arm, the points behave exactly as though they have been parented.
It’s often a good idea to know how to rig or code something to exactly mimic deformer behavior. These first principles can always act as a point of reference when things aren’t doing what you want.
101 TLFeBOOK
Experience XSI 4 Figure 4.42 shows how the line representing the side of an arm joint is enveloped when the center point is weighted 50:50. You can see that enveloping is just a set of parenting relationships blended together. This knowledge reveals the strength and weakness of enveloping. Because enveloping is so simple, it’s easy to rig up something new and throw it into the mix and use weight painting to figure out how much you want to blend it in. The bad side of enveloping is that it completely bypasses issues of blending rotations. There are two signature rotation problems with enveloping. The first is shearing, which is the reason for forearm roll setups that divide the rotations into multiple parts (XSI has a command called makeForearmRoll() to make this setup through the Rigging SDK). The second is rotation overlap, and that’s what you get when the skin turns inside out in a criss-cross like the bottom joint rotation state in Figure 4.42. The most obvious way to avoid these problems is just to make new objects to blend in that create new mechanical behavior. For those of you used to packages that only envelope bones, one of the main differences in XSI is that it can envelope any object, opening up many possibilities for integrating rigging into enveloping without a layer of chains.
4. Character Setup
Figure 4.43 shows an example of using two point constraints to soften the rotation at an elbow. This is a handy technique for many parts of the body, especially under the arms and at the side of the hips. It is almost impossible to make a character that can do the splits by doing a good envelopeweighting assignment, but it is fairly easy if you use such a twopoint constraint technique.
102
Figure 4.42 Enveloping position blends multiple parents
Figure 4.43 Constraints can be used for sliding and rotation blending in enveloping
The two-point constraint in Figure 4.43 is achieving two goals. First, it delivers a weight assignment layer for a rotation between Bone A and Bone B. Enveloping doesn’t blend rotations, so this can help TLFeBOOK
Experience XSI 4 all kinds of problems. Secondly, it is pulling together the rotating arcs of the joints pressing towards each other. It acts a bit like a center point on the skin between webbed feet. As two rotations spin towards one another, the two-point constraint technique is a simple way to make them slide together. One thing to be careful of in this setup is that you can arrive at situations wherein the objects driving the two-point constraint cross one another and twist the envelope. You have to define a range where this setup is valid and be sure that limit is okay for the animators. Similar and even better results can be achieved using path constraints with multiple break points to split up the interpolation. You can think of the strategy behind rigging under enveloping as creating systems that track the behavior of a spot on the skin or layer underneath. The fidelity of the result is only limited by your ability to observe which points are the good ones to track and how to engineer a little machine that approximates that exact behavior.
If you have an enveloped character, it’s simple to move around the deformers and not change the weighting. Just mute the envelope and change the positions. Then, with the deformers branch selected, select Animate > Envelope > Set Reference Pose. Under the hood, all you are doing is changing the values on the Static KineState node under your object, which describes your default position. That node can also be interactively wired into.
Shrink Wrap Another deformer that I think is growing in importance in character setup is Shrink Wrap. Shrink Wrap is best understood as a Ray Casting deform. The trick to making good use of Shrink Wrap is figuring out how to control where the Ray Casting starts, which way you are pointing, and what and where you are projecting towards.
4. Character Setup
Mechanically, the most obvious thing you can do with Shrink Wrap is to project on an axis. To start, let’s take the case of moving a cube around on a terrain. To project a cube onto a terrain or curve like in Figure 4.44, do the following: 1. Make a parent control object and give it a one-point curve child, with the point placed at the parent center. 2. Make an object to slide on the terrain. Place its center at the point you want to slide on. 3. Make a cluster on your one-point curve. 4. Object to Cluster-constrain your sliding object to the one-point curve. 5. Shrink wrap the point onto the terrain. Set the options to Parallel to Axes, Along Y, and Reverse.
Figure 4.44 Simple Shrink Wrap on the –y axis
103 TLFeBOOK
Experience XSI 4 So here we’ve done a simple axis-based one-point Ray Cast, which is a bit like a constraint. It’s probably evident that the Towards Center option is going to project toward a center point ,so you could have that cube sitting on top of sphere or semielliptical shape as you rotated it around. But what if you wanted to project that cube onto a terrain in a manner where it banked and oriented while it moved? The answer is to use more points. Figure 4.45 shows how you can make a similar setup to that in Figure 4.44 but project three points to lift off an orientation. In the same way that motion capture on a hand uses three points to get a plane, you can always use sets of three points to lift banking from surface projections as shown in Figure 4.45.
4. Character Setup
For characters, the main interest in Shrink Wrap is for simulating muscles or internal volumes and projecting a skin around those forms. The first way to do this kind of setup is to go from the inside out and project along the vertex normals. Figure 4.46 shows a simple tube projecting outward along vertex normals. The outer surface can be made of multiple volumes representing muscles and chunks of body mass merged together. On the inside, you can make a network of connecting tubes projecting outwards.
104
You can either use this technique to deform the final skin of the character and weight paint where you want the effect or you can think of the sliding volume as a plate that contains anchor points for enveloping. The main limitation of the “inner tube expanding out” technique is that it’s tricky to solve areas of concave curvature like the crease that is formed by the inner side of the elbow joints. But keep in mind that tough areas like this can be solved by rigging the tube itself such that the normals project correctly. Finally, another great feature of Shrink Wrap is that you can expand from the outside inwards. All you need to do is Shrink Wrap towards a geometry duplicate. To define a goal points for the Shrink Wrap, just duplicate the
Figure 4.45 Y-axis shrink wrap using multiple points for orientation banking
Figure 4.46 The inner tube expanding outwards
TLFeBOOK
Experience XSI 4 geometry you want to project and reposition the points as the goals of each ray cast. Figure 4.47 shows this process. What’s great about this technique is that it opens the door to precise control over sliding through both rigging and projecting. Just as secondary enveloping rigs can track points along a surface, this opens up a much greater fidelity where you can design both the surface and the start and end of your projection through sliding. In cases where you want your object to expand from the outside inwards, all you need to do is think through where you want the rays to go. A starting point for this “outside inwards” technique is to consider each ringed-edge loop as converging towards a center point. You can step through the model loop by loop and make a “noodle and plate” structure to project towards.
Cage Deform Cage Deform is another popular and powerful deformation in XSI. People generally start studying the Cage Deform when they get tired of doing weight assignment on many characters and want to generalize the process.
Figure 4.48 shows how Cage Deform works. Mechanically, this deform is similar to enveloping but it blends between triangulated polygons instead of centers. Cage Deforms have slider control over strength and falloff, and you can weightpaint smoothing by selecting your deformed object—just press W and then hold down Alt while you paint.
Try applying Shrink Wrap in Animation mode in the construction stack. Then switch the mode back to Modeling, make sure Display Options > Display Mode tab > Construction Level Viewing Mode is set to “Result” and start moving points. You’ll see that the movement (even with proportional modeling) is in the space of the projection. This is one of the great features of the construction stack in XSI. It’s not just a mechanism to control which region of the stack operators are being created in—it can control interaction as well.
Because of the volume of points being taken into account during deformation, the speed of this deformer is a bit slower than with enveloping. But the implementation in XSI is quite fast and takes advantage of multi-threading, so if you plan to use Cage Deform a lot, you should consider using a dual CPU machine. It’s also worth checking out Model > PolyMesh > Polygon Reduction as part of your pipeline to make an arbitrary control mesh. With the option to preserve quads you can make good low-res cages quickly.
4. Character Setup
A good way to think of Cage Deform is as an arbitrary lattice or control cage for your character. You can build a lower (or in some cases higher) general representation of a body part or character type (such as a glove or biped) and reduce rigging and weighting labor by moving it from character to character in your project.
Figure 4.47 Shrink wrap towards a geometry duplicate
105 TLFeBOOK
Experience XSI 4
Control Splines None of the deforms you’ve seen so far have really addressed the stretchy quality of skin. In nature, skin has an elasticity to it. When a body stretches to meet a pose, the skin expands and then contracts back together upon return. There are also flow lines within skin, much like a wood grain, that move in the direction of where different skin regions are contracting and expanding. In fact, wrinkles precisely define lines perpendicular to heavy elastic stretch/contraction in aging skin. Although you could rough something together using twopoint constraints and Shrink Wrap to approximate this, one of the best tools in XSI to model this flow is path constraints. XSI already has a system for wiring paths to model skin elasticity called control splines. To test it out quickly, draw a curve, then select it, then select Animate > Skeleton > Create Control Splines (also found in the Rigging SDK command makeControlSpline() ). Control splines have three layers, as shown in Figure 4.49. The first layer is shown in the figure as green diamonds. The point controls on this layer are the points of a bspline curve. As you move the controls around, the curve and controls above smoothly interpolate through these points. As the motion or position of the point controls expands or contracts, the layers above evenly expand or contract across the length of the curve.
4. Character Setup
The second layer is composed of tracer controls that are path-constrained to the spline. To change the position so that the distribution is non-linear, just open the path constraint on one of the controls and change the path percentage. To create an area with more resolution, just branch-select a tracer control, duplicate the object, and then change the path percentage.
Keep in mind that the tracer controls don’t have an up vector defined, and you will run into problems later if you don’t set one. For a head it’s easy enough—most curves can point to the center bone. But if you start rigging control splines to define complex volumes, like an entire body, then you need to be careful about your up vector assignment strategy. Figure 4.48 Cage Deform blends reference frames of triangulated polygons
106 TLFeBOOK
Experience XSI 4
Figure 4.49 The three layers of control splines
4. Character Setup
The third layer is for rotation offset. Skin has a spin to it when pinched, pushed, or deformed like a pouting lip. This layer allows the animator to tweak the orientation of a region of skin. It can also be used to pinch areas together in translation without any interpolation. The idea is that control splines are hooked up to skin through enveloping to the third offset layer. When you generate the control splines an “envelope_group” group is also created that you can weight to. Of course, for the sake of economy you can always decide not to have a third layer controlling rotation and just weight to the second. The nice thing about this approach is that it’s very flexible to mix into other skin deformation styles. Because it uses standard weighting it’s easy to blend into the enveloped rigging of the body. The more fundamental question in a control spline approach is where to place the lines. Figure 4.50 shows control splines placed on the character’s head.
Figure 4.50 Control spline layout on a head
107 TLFeBOOK
Experience XSI 4 When you start playing with this system and thinking about skin flow and doing tests, the following few strategies become useful: ◆ The root idea is to try to treat the curves as a soft selection or proportional range where you can easily pull out shapes. ◆ Do tests to figure out if a region is best suited for splines running perpendicular to lines of force or parallel. In a wrinkle, it’s pretty clear that the best results come from putting a line parallel to the bulge of the wrinkle and one underneath, on the indent. ◆ When creating rings (for example, on the eyes and lips), don’t make them from single curves. Connect multiple curves and place breaking points snapped together where the connection points should be locked. Doing this ensures that when you pull the bottom of an eyelid or lip, the top won’t be deformed. Control splines were created with complex networks of curves in mind, so you can have as many curves as you want arriving at a single point in space and the tool will return only one point controller there. You could also consider control-spline networks as a general framework on a set of characters, to generalize deformation and transfer attributes.
Shape Blending snapshots of mesh positions is the logical choice for facial animation or anything requiring absolute control over form. Over time, shape deformation in XSI has ballooned into an enormous array of workflows and rigging tools.
4. Character Setup
Here are a few of the main methods for shape-based workflows in XSI: ◆ Shape locally modeled on geometry. Switch your construction history into Shape mode. Select Animation > Shape > Save Shape Key, and then model a new shape. When you’re done, select Save Shape Key and so on. When you run this process, make sure you are in Shape > Mixed Weight Mode. ◆ Shapes copied from reference objects. Create multiple copies of your geometry, model different shapes on them, and use Animation > Shape > Select Shape Key to hook up mesh copying operators on the new shape. This new operator interactively copies over the mesh positions ◆ Shape based on orientation. Create a cluster for the area you are working on and select the cluster. Then select Animation > Shape > Link Deform with Orientation. Move the bone or object you are basing the deformation on through a series of poses and select Shape > Save Deform Key. This workflow is well implemented and will use quaternion interpolation to prevent gimble lock. Keep in mind that the same workflow is available to general rigging by right-clicking on a parameter and selecting Link with Orientation. ◆ Weight-painting shapes. Once you have established shapes from one of the techniques described so far, you can paint the influence by creating a weight map with Animate > Property > Create Weight Map. Then select the shape key in the Explorer, then Shape > Connect with Weight Map. ◆ Shape interpolation from mixer clips. In XSI, you can animate shapes as clips in a manner similar to how a film editor would work. Just set Shape > Instance Only Mode and either save shape keys or store them and pull them up from a library and transition between the shapes. One of the great things about this workflow is that you can get bezier interpolation along each point’s path by setting your mode to Shape > Cardinal Transition Mode.
108 TLFeBOOK
Experience XSI 4 ◆ Blending shape animation from different clusters. All shape animation in XSI is cluster-based, so it’s not difficult to blend a set of shapes on your eyebrows and a set of shapes on the rest of the face. Just define the clusters based on which regions you want to save shapes on (they can even overlap) and have the right one selected when you save shape keys. In the mesh operator, stack open the shape operator called Cluster Shape Combiner and adjust the sliders to control the blending between clusters. One of the great features in XSI 4.0 is that shape interpolates through modeling. So even if you have a thousand shapes on your character, they will all interpolate according to whatever modeling operator you applied.
One of the most interesting of these workflows was pioneered in XSI by Eric Sanford and shown at Siggraph 2003. This technique, shown in Figure 4.51, is a process to trace high-resolution scan data and generate a low-resolution control cage that describes detail and form in a layer of shape offsets and displacement.
4. Character Setup
Finally, there are a number of interesting setup techniques revolving around using a layer of shape offsets in combination with rigging workflows. If you save shapes in Local Relative mode, then you are saving the difference between your default shape’s reference frames and your current position.
Figure 4.51 Using Generator Subdivisions, Shrink Wrap, Shape Offsets and Rendermap to drive highly detailed geometry with a lowresolution cage.
109 TLFeBOOK
Experience XSI 4
Smoothing / Relaxing Another new deform to XSI 4.0 that’s very useful for character setup is Smoothing (Model > Deform > Smooth). This deform evens out and untangles geometry. To picture an approximation of what the algorithm is doing, you can think of it as a weighted averaging of neighborhood points evening out the entire surface. Smoothing can also be a very useful operator with which to mimic skin elasticity. You can apply whatever muscle setup you want and then just apply Deform > Smooth > Advanced Settings and turn on Reproject (this is called Relax in the Deform menu). This averaging and then reprojection on the original surface has an effect very similar to skin evening out as parts shift around underneath. Another great option for character setup in this deformer is basing the smoothing on concavity, which will soften out only the parts of a character creasing inward. Just set the Construction mode to Animation, then select your object and choose Model > Deform > Smooth, give it some strength and then go to the Advanced Settings tab and select Restrict to Curvature Type to Concave.
Deforming with Hair and Springs I’ll just bring this up briefly: both hair and springs are great tools for achieving deformation effects. Ideas for doing so include the following:
4. Character Setup
◆ You can piggyback hair dynamics by constraining control objects to the tips and enveloping to them. This is a great way to rig loosely hanging objects like shirt sleeves or feathers. ◆ Introducing springs in your character setup can help add layers of jiggle and bounce in muscles and skin. You can achieve similar effects with soft body, but those are typically one level deep. What’s great about the spring is that it can be assembled into a hierarchical structure in which bounce and whip propagate downwards. The tail is an example of this, but branching structures like character and body parts made from springs applied to chains can also be assembled in this manner. Keep in mind that this structure doesn’t need to go only from the hip out—it could be shot specific. For example, it could begin with the arm of a character hanging off a cliff and carry down. ◆ Hair can also be piggybacked for driving deformation of trees or bushes in a forest. Just wire parts of the foliage to hair strand end controllers at different heights. What’s great is that the hair can then be easily driven by forces like wind and turbulence.
Character Engineering at a Production Scale When character setup occurs at the scale of a large production for film, games, or television, a whole new set of problems arise. Primarily, these problems revolve around managing the complexity of a large number of characters and the difficulties inherent in having a large number of people working together.
Automating Character Setup with Scripting 110
One of the most powerful starting points when making a large number of characters is to combine character setup with scripting. Many of the tasks in the rigging process can be automated, or converted into a set of logic or heuristics that assemble parts and characters. This doesn’t mean that everyone on the character team needs to be scripting—of course, prototyping solutions to rigging problems by hand is the heart of the profession and can give any project TLFeBOOK
Experience XSI 4 an edge. But getting the bulk framework of the character process into a set of tools can save time and help guarantee consistency in naming, control icons, and mechanical behavior.
Object-Oriented Scripting One of the major advantages of XSI for creating characters with scripts is object-oriented scripting. Making a set of characters for a large project is a very complex undertaking that is likely to produce a great deal of spaghetti code and clutter. Object-oriented scripting allows you to write code in which different parts and programs are nested in a tree that allows you to keep track of everything in a simple, clean way. So when you create a Biped, for example, it can call a second structure for the arm and another for the roll, making it easy to get a binding point. Here’s how: Biped.Rarm.Roll[7].BindPoint
This is much easier than digging through several thousand lines of script code, desperately searching for CONSTRUCTOR7_ARM_ROLL_BINDINGPOINT, which is a variable nested deep in a forgotten file, named by someone on vacation right now. This may seem like a fine point, but having a cleanly organized character system can make or break a production and the sanity of the people doing it. Object-oriented scripting is covered in depth in Chapter 6, “Scripting in XSI.”
Rigging SDK
4. Character Setup
For those who are interested in learning more about programming a character pipeline or converting one from another package, XSI has a new section of the SDK devoted to programming characters, shown in Figure 4.52. The system uses a kit approach wherein object-based character components (such as the Spine, Head, Leg, Dog Leg, Foot, and so on) can be used to assemble characters. Because the CDK (Character Development Kit) treats character parts as components in both a character setup and programmatic sense, it ends up defining a system more like a DNA for all the characters in a film or game. If you change the assembly script for makeSpine() with a new kind of control icon or behavior, then it’s easy to reassemble 100 characters across a project and propagate the new spine
Figure 4.52 Functions in the XSI Character Development Kit
111 TLFeBOOK
Experience XSI 4 to every one of them. Also interesting is the fact that the components are based on search algorithms that find variable length appendages (such as exactly how the tip of the head was extended earlier in this chapter). This means that you can describe a wide array of character types with a small set of functions, increasing the efficiency of making changes. The nature of the CDK is closer to a parametric system for character definition rather than a tool that glues rig presets. There are quite a few advantages for using this system as a starting point or reference for a character pipeline. ◆ The fact that the assembly source is open means that if you are making a new pipeline from scratch, then it’s a good source of scripting code examples to look up methods for drawing chains and spines and calculating spatial relationships. ◆ The component functions are independent from the templates for making the Biped, Biped Dog Leg, and Quadruped. ◆ Although the components and functions are JScript based, you can call them and get object-oriented returns in any language—JScript, Python, Perl, VB, or C++.
Referencing Another key element of a large-scale production is referencing. Referencing is used for two major goals: 1. Making animation of multi-character scenes play back faster by controlling and switching the resolution of parts in a scene.
4. Character Setup
2. Helping multiple people to collaborate on the same project.
112
The main workflow for referencing in XSI is using models (for example, save out a model, then reimport it with File > Import > Reference Model). If you look at the options of the new reference model (as shown in Figure 4.53), you’ll see that it can reference constraints, expressions, animation, properties like materials and the mixer. Mechanically, what is happening is that XSI is tracking what parameters have been touched, which are shown in the Parameters Changed list under your reference model. It then stores a clip with those items, offloads the model completely from memory, and applies these animation sources to the new container of objects loaded at the incoming level of resolution. For a pipeline automation process it’s fine to use referencing as-is, but keep in the back of your mind that this is all based on the mixer, and there’s a great framework and SDK for transferring containers of animation around that you can highjack at any point. Finally, XSI has many features that can be combined in a referencing workflow, such as an ASCII table of contents, the ability to offload mixer clips or ranges of animation as ASCII, and a preset system that saves out most data types as files holding everything from materials to weight data to dialog box settings to particles.
Figure 4.53 The Referencing dialog box
TLFeBOOK
Experience XSI 4
If you separate body parts like the hands, head, and torso into models and envelope them to a rig in a separate model, then the enveloping links will be left hanging during export. However, XSI will remember the weighting information and the dangling link of connection when the models are brought together in a new scene. When reference models are loaded, they will find the rig parts driving the enveloping (or search to a new model path you provide) and hook up the operator again. Using this technique, you can create a real-time assembly system that swaps character parts in and out.
Libraries When working on big-character projects, you’ll have a small army of people constructing animation and 3D objects. For a studio, it makes sense to assemble objects into libraries ready for reuse later. The best tool in XSI for setting up this kind of system is Netview. In Netview, any type of preset or saved XSI file can be dragged and dropped into other XSI views. One of the great things about embedding JScript and VBScript from XSI in Netview pages is that you can call the entire application and SDK and your code can be bi-directionally woven into scripts controlling the Web page.
Custom Interface Once you have a character setup, it’s a good strategy to be very precise about making a layout for animators using that character. You don’t want to include any distractions, extra buttons, or workflow possibilities that allow the rig to be broken.
4. Character Setup
The XSI 4.0 interface is based on XML and has a scripting system for driving UI views and relations (like 3D object views, the Timeline, and the Explorer) through scripting. This means that you can start to think of XSI as an invisible toolkit for making software interaction devoted solely to your character and project. A great example of this type of interface for facial animation is the new combination Fcurve Editor / DopeSheet / Mixer found in Application > Views > Sample RV – Timeline Mix Dop Fcv. A typical custom layout for facial animation is shown in Figure 4.54.
Asset Management If you step back and watch yourself work in 3D for a while, you’ll realize that you waste an incredible amount of time looking for files, clicking around directories, and managing versions of files with the team you are collaborating with.
Figure 4.54 A custom view for facial animation
113 TLFeBOOK
Experience XSI 4 Asset-management software like NxN Alienbrain has helped solve the problems associated with collaborative files and has taken complexity management forward a great deal. The fact that AVID recently purchased NxN means that it is now part of the same company that owns Softimage. This bodes well for this aspect of the character pipeline in the future.
Inter-Group Workflow XSI has changed a great deal since the early days of XSI 1.0, but from the beginning, it has focused not just on tools but on an environment in which the relationship between workflows is smooth. Slowly this is starting to change the way 3D work is done, but you have to stay alert to the opportunities for using new tools for collaborative workflow. For example, XSI 4.0 does an excellent job of interpolating envelope weighting and shape animation when you model on a rigged character. This means that if you have a group solely devoted to modeling, it starts to make sense to rethink taking whatever they hand you and figuring out some algorithm, like spatial proximity, to substitute in new geometry. Instead, you should consider giving the modeler back a scene that has the rig hidden in the background (so he isn’t distracted) and getting the benefit of an intelligent attribute interpolation on every modeling operation he does. Then it’s a simple matter of referencing to get that modified object substituted back in the pipeline. I bring this point up because new technologies, such as Illusion, Matador, Ridgid Body Dynamics, and so on, are working their way into XSI. As you plan a large production, it’s beginning to make more sense to look at the entire pipeline and get creative about “tasks in context” rather than planning solely on certain people making single chunks of data.
4. Character Setup
Summary XSI has a simple visual way of creating rigs, weighting envelopes, and setting up synoptics that allow users to quickly get a character up and running. For those advanced in the craft of character setup, there’s a rich design environment for prototyping mechanical behavior, skin, and muscle systems. XSI is oriented for collaboration at a studio scale, and achieves this through low-level access (object-oriented scripting, Mixer SDK, events, relation-triggered XML) and by example (rigging SDK, referencing tools, XSI Net).
114 TLFeBOOK
Experience Experience XSI 4
chapter 5
Animating Your Character his chapter explores some of the many powerful animation tools offered by XSI. It mainly covers the tools that pertain to character animation. Although a single book can’t cover every animation capability of XSI, the tools you’ll learn about in this chapter will give you a better understanding of how to animate within XSI. As you’ll soon see, when it comes to XSI, there are virtually no limits to what you can animate.
T
Much like the design process, character animation can consist of many styles and techniques. From cartoon to realism and anywhere in between, the thing to remember when animating a character is to always have a motivation or reaction for every movement your character makes. As a puppeteer in the movie industry, I learned from practice that things like weight, balance, motivation, and reaction all play a part in “animating” a puppet built for a movie. Computer animation requires many of the same skills. For instance, if you have a character that is jumping, as shown in Figure 5.1, its first move is to squat down to build momentum for the jump. Next it will extend the hind legs to thrust forward. These two actions constitute the character’s motivation. When in the air, the legs will pass in front of the body to ensure that the body doesn’t fall flat onto its belly. This is also a motivation. Next, the feet make contact with the ground, and the upper body compresses down and balances itself. This is a reaction to the impact. That said, there may be times when, while animating a character, you’ll have to use a reaction before a motivation (see Figure 5.2)—for example, if your character is standing and has to react to some external force, such as a big gust of wind or an explosion. Whatever the external force may be, if the body doesn’t expect it, there is no time for motivation, only a reaction to what just occurred.
Figure 5.1 How a human body uses motivation to jump and react to landing
5. Animating Your Character
Character Animation Overview
115 TLFeBOOK
5. Animating Your Character
Experience XSI 4 When animating a character, most of the action will consist of a somewhat even balance between motivation and reaction in response to surroundings and forces. A character will react to and be motivated by everything that happens to it. To best explain this, let’s look at a simple walk cycle. Walking can be seen as a controlled fall without falling. The motivation begins when the body lunges forward. The reaction consists of a leg moving in front of the body to prevent the body from falling, while the upper body works to maintain balance. By repeating this movement continually, the body moves forward (see Figure. 5.3). This basic walk cycle becomes more complicated when you consider forces such as wind and gravity. Additionally, emotions such as anger, sadness, and happiness influence how the character looks when it walks. Even the personality of the character plays a role. Is the character confident, shy, aggressive, or sneaky? By taking all these elements into consideration, you can start to create an impressive animation for your character.
Figure 5.2 How the body reacts to an unexpected external force
Basic Keyframing Now that you’ve looked at some of what goes into animation, it’s time to start Figure 5.3 understanding how to use XSI to animate How the body looks when walking, using motivation and reaction your character. Before you start animating the character that you’ve built so far, however, I would like you to do a simple keyframe exercise so that you will have a better understanding of how the tools for animation work in XSI.
What Is Keyframing? Keyframing, or keying, is setting marked animation parameters for a selection in an animated sequence. In order to create an animation, XSI enables you to mark the parameters of a selection in a particular frame in the timeline. You can set a key for any animated parameter, in any order, at any given frame on the timeline. After many keys are marked with all the changes at the chosen frames along the timeline, XSI will fill in the gaps, giving you a perfect blend of all the different changes you have made along the timeline. When the sequence is played back, you can see the action in motion. After you have your animation blocked out, you can add more keys to the animation, edit the animation, or store your animation, which then can be worked on in the Animation Mixer. We’ll cover all these specific parameters throughout this chapter.
116 TLFeBOOK
Experience XSI 4
Some of the Tools Used for Animation In Figure 5.4, the blue arrow shows the Animation toolbar, the yellow arrow shows the frame indicator of the timeline. The red arrow is pointing at the keyframe icon (shown in Figure 5.5) used to set keys when the Transform panels are in use (I’ll go over the Transform panel operations a little later). As you know, in XSI, almost anything can be animated, from property pages to shapes and textures. Figure 5.6 shows a property page. Notice the small green icons to the left of each of the sliders. These icons are similar to the keyframe icon under the timeline and are used to indicate animation settings for each parameter along chosen frames. The red icon in the circle indicates that a key has been placed at a certain point on the timeline.
At the bottom of the screen is the button for the Animation menu (circled in red in Figure 5.8). Here you can add, copy, paste, or remove animations from selections; move between keyframes; work with parameters; and open the animation and expression editors.
Figure 5.4 Animation interface
Figure 5.5 Close-up of the timeline and the keyframe icon. This button also serves as an indicator. When an animation is applied to a selection, this button will change color.
Figure 5.6 An example of keying in a property page
Figure 5.7 Parameters with animatable properties
5. Animating Your Character
Figure 5.7 shows some examples of the various stages of icons that both set animations and indicate that they are applied. You will find these icons on property pages next to the parameters that can be animated. Property pages are windows providing options for animating properties of various selections. In the first box, the small green icons on the left side indicate that these are parameters that can be animated. The box to the right shows three stages of animation (notice how the boxes are slightly larger when animations have been applied). The red icon indicates that an animation has been applied to this parameter at this frame of the timeline. The green icon shows that an animation has been applied to this parameter, but not at this frame. The yellow icon indicates that an animation has been applied, but that there have been changes made to it without a new key set to mark the change as a key. If after changing the animation parameter at this point you don’t set a new key, the animation will revert to the original settings.
117 TLFeBOOK
5. Animating Your Character
Experience XSI 4
118
Figure 5.8 Opening the Animation menu
Figure 5.9 Getting a primitive polygon sphere from the Animation toolbar
Applying Keyframes This exercise will take you through some of the steps involved in keyframing transformations using the Transform panel. On the left side of your screen are the different toolbars used for modeling, animating, rendering, and simulation. Start by accessing the Animation toolbar either by clicking on the top icon and choosing Animate from the pop-up menu that appears or by pressing the 2 on your keyboard. Next, beneath the Get icon, click Primitive > Polygon Mesh > Sphere, as shown in Figure 5.9. Notice that a property page pops up after you have made your selection (see Figure 5.10). As stated in previous chapters, this happens in XSI after you have made selections or any type of modifications to the selected objects. Figure 5.10 The property page for a polygon sphere
TLFeBOOK
Experience XSI 4 If a property page doesn’t appear after a selection is made, use the User Preferences dialog box to set the page to pop up automatically. Here’s how: 1. Open the File menu and choose User Preferences. 2. The User Preferences dialog box opens (see Figure 5.11). Click the Interaction tab. 3. In the Property Editors/Views section, click the Automatically Popup Property Editors on Node Creation check box to check it. 4. Close window. Now that you have your polygon sphere and have accessed your property page, activate the Translate panel by clicking the Translate button shown in Figure 5.12 in the red circle. Clicking on this button activates all three axes that are available on the panel for manipulating your object:
Figure 5.12 The Translate panel Figure 5.11 The User Preferences dialog box
◆ Translate. Changes the position of an object in X, Y, or Z. ◆ Scale. Changes the size of an object in X, Y, or Z. These enable you to control the movement of your object to begin the animation process. (Make sure that you are in View mode, as shown in the yellow circle). To begin animating your object, do the following: 1. Be sure that your object is selected (you can do this by clicking anywhere on the object). 2. Click to translate the object to the left in X and Y using the Transform panel. The Transform panel is found on the right-side toolbar, indicated in Figure 5.13 by the yellow arrow. The red arrow shows the direction we have moved from. When you click on any of the Transform panel Axes buttons, the color Figure 5.13 Translating the primitive sphere of the buttons will correspond with the colored indicators inside the object you are animating. You can click on these indicators to perform the action of your choice. If you de-select your object by clicking and dragging in the back3. Activate the Rotate panel by clicking the Rotate Tool ground, you can re-select it by clicking and dragging within the object. button, as shown in Figure 5.14.
5. Animating Your Character
◆ Rotate. Turns an object in X, Y, or Z.
119 TLFeBOOK
Experience XSI 4 4. Rotate the sphere in Z by holding down the right mouse button while you drag the mouse, as shown in Figure 5.15. 5. Activate the Scale panel by clicking the Scale Tool button, as shown in Figure 5.16. 6. Scale the sphere by clicking on the Scale tool button and then holding your left mouse button down while dragging the cursor, as shown in Figure 5.17.
Figure 5.14 The Rotate panel
5. Animating Your Character
7. Now that you have translated, rotated, and scaled your object, it’s time to start plotting keys. With the timeline at 1 (indicated by the yellow arrow) and the Translate button clicked (indicated by the blue arrow), plot a key (indicated by the red arrow) by clicking on the key symbol, as shown in Figure 5.18. This action sets the Transform position of your object for this frame.
120
8. With the timeline still at 1 (yellow arrow), click the Rotate button in the Transform panel (blue arrow), and then plot a key (red arrow). This action plots the rotation of your object for this frame (see Figure. 5.19).
Figure 5.15 Rotating the primitive sphere
9. With the timeline still at 1 (yellow arrow), click the Scale button, (blue arrow) and plot a key (red arrow), as shown in Figure 5.20.
In some situations, you may find it easier to use the Auto Key button next to the key as shown in Figure 5.21. When this button is selected, every time you translate, rotate, or scale the selected object, it will automatically key that change. When you use the Auto Key feature, it is important to remember to turn it off when you are finished animating. If you leave the Auto Key feature on, you can inadvertently key, as changes in your animation, any selection you make in the Transform panel.
Figure 5.16 The Scale panel
Figure 5.17 Scaling the primitive sphere
TLFeBOOK
Experience XSI 4
Figure 5.20 Plotting keys with the Scale panel selected and the timeline at 1
10. Advance the timeline by clicking the red indicator line and dragging it to 30. Notice that the key has changed to green, indicating that there is an animation on this object, but not at this frame of the timeline (see Figure 5.22). 11. Translate the sphere to the right of the screen. The red circle shows that the key has been automatically activated, the yellow arrow points to the Translate panel, and the red arrow is showing the direction to translate the sphere, as shown in Figure 5.23. Figure 5.21 The Auto Key button
Figure 5.19 Plotting keys with the Rotate panel selected and the timeline at 1
Figure 5.22 The timeline and keyframe icon
5. Animating Your Character
Figure 5.18 Plotting keys with the Translate panel selected and the timeline at 1
121 TLFeBOOK
Experience XSI 4 12. Rotate and then scale the sphere. The red circle shows the key that has been automatically activated, the yellow arrow points to the Rotate panel, and the red arrow points to the Scale panel as shown in Figure 5.24.
5. Animating Your Character
Now it’s time to see what the animation looks like by using the Playback panel found at the bottom of the screen (see Figure 5.25). The red circle is the Play button. Directly to the left of that is the Reverse Play button, and to the left of that is the Rewind button. In the blue circle are the frame-by-frame buttons, and in the yellow circle is the button for looping the playback. To the left of that is the Fast Forward button.
122
Figure 5.23 An example of auto keying with translation
Figure 5.24 An example of auto keying with rotation and scale
Using your mouse’s left button, click the Play button to play back the animation. Playback starts at the first frame. Alternatively, use your mouse’s middle button to start the playback at the current frame on the timeFigure 5.25 line (see Figure 5.26). The Playback panel
Figure 5.26 Example of playing back an animation
TLFeBOOK
Experience XSI 4 You’ve learned some of the basics of keyframing objects by using the Transform panel, taken advantage of the Auto Key mode, and learned how to play back your animation. Now you are ready to learn how to animate the character you made using the rig you built. But first, let’s look at some other aspects of the animation process.
Using Referenced Models for Animation Chapter 2, “Designing and Modeling a Character,” discussed referenced models and how they can help you in a production environment. Before a model is complete, a referenced model can be imported to begin the animation process. While the animator starts working, the original can be completed by adding textures, hair, or almost any other element. This speeds everything up by allowing multiple artists to work on one model at the same time.
1. Open the File menu, choose Import, and select Referenced Model, as shown in Figure 5.27.
Figure 5.28 The Import dialog box Figure 5.27 Accessing a referenced model from the File menu
2. The Import dialog box opens, as shown in Figure 5.28. Click on the file of the model you want to select it. 3. Click OK. The referenced model appears in your scene. Now that the referenced model is in your scene, a property page will open (see Figure 5.29), giving you options for making changes to your character.
Using Synoptic View There are many different ways to select and animate your character. One is to use the Synoptic view you learned about in Chapter 4, “Character Setup.” If you decide to use the Synoptic view, you must select part of the rig and press the F3 key on your keyboard. This opens the Synoptic View page, as shown in Figure 5.30. From here, you can make single or multiple selections of your rig and key the selections or reset the character to its default pose. You can also store your
Figure 5.29 A property page for the referenced model
5. Animating Your Character
To import a referenced model, do the following:
123 TLFeBOOK
Experience XSI 4 animation. This can be a very powerful tool to help speed up your workflow. (For more information about Synoptic view, refer back to Chapter 4.)
Using Marking Sets to Animate
5. Animating Your Character
Another way to key the rig and have advanced control is by selecting the Figure 5.30 controller you want to key and then Synoptic view clicking on the Selection button on the right side of the interface (see Figure 5.31). When you click the button, a tree opens with all the properties of that selection. Double-click the marking set to open a window containing sliders with translations and rotations that can be adjusted and keyed.
124
Walk Cycle Animation
Figure 5.31 Using sliders to animate
Let’s take a look at how to animate the character that you have built by starting with a walk cycle. This exercise will help you better understand how to avoid overcomplicating character animation at the beginning by starting with baby steps and growing from there (see Figure 5.32). 1. Open the scene you created in the last chapter called Final_Character_Rigged_and_Weighted, as shown in Figure 5.33. 2. Get a primitive grid (Get > Primitive > Polygon Mesh > Grid) as shown in Figure 5.34. 3. Using the property page, scale the Grid value to 20 in the U Length field and 200 in the V Length field. 4. Change the Geometry Subdivision value to 40 in the V field. The U Subdivision default setting remains at 8. Figure 5.35 shows how the property page will look with the correct settings. 5. Change the number in the timeline to 0 for the first frame and 32 for the last frame. 6. Make sure the timeline indicator is at 0. This will be where the first keyframe will be placed. Figure 5.36 shows how the timeline should look.
Figure 5.32 Ready to animate
TLFeBOOK
Experience XSI 4
Figure 5.35 The grid serves as your ground and helps you make sure your character is level while animating
Figure 5.36 The timeline
Using the Rig to Put the Character in a Proper Pose for Animating
Figure 5.34 Menu path for selecting a grid
Now you can start posing the character in position to begin the walk cycle. Using the boxes you see on the rig, translate and rotate the character into a pose that appears properly balanced, as shown in Figure 5.37. Here is where you need to consider the puppeteering elements discussed earlier. Your character has to look natural, dynamic, and not in danger of falling on its face. Play with the Transform panel until you achieve a pose that looks right to you. The more you practice, the better your character will look.
The feet have three main controllers, as shown in Figure 5.38:
5. Animating Your Character
Figure 5.33 Final_Character_Rigged_and_Weighted
◆ The footroll control. This control is found at the base of the foot. Manipulating this control will give your character a natural-looking step. By rotating in X, you will notice how the leg follows though the initial movement.
125 TLFeBOOK
5. Animating Your Character
Experience XSI 4
Figure 5.37 Posing your character for a natural walk
Figure 5.38 Foot controllers
◆ The inner-foot control. This control helps distribute the tension between the knee and the ankle. ◆ The outer-foot control. This control is for the overall translation of the leg. Figure 5.39 shows an example of how the footroll will look as it is manipulated. Notice how the leg changes position to follow the initial movement of the foot. Now you can start keyframing. For now, you will keyframe the feet by repeating a cycle of five keyed poses. This will simplify the process. After you see the legs working, it will be easier to add all the other body movements that are influenced by the walk.
Figure 5.39 Showing the footroll
1. Make sure the legs are opposite of each other, left leg in back, right leg in front, and spread apart. Key the translation of the outer controllers and then the rotation of the two inner controllers—first at frame 1 and then at frame 32—without moving the legs (see Figure 5.40). Be sure to repeat each step for both feet.
126 TLFeBOOK
Experience XSI 4
Figure 5.41 Keyframing the second pose
2. Go to frame 16 on the timeline and translate the left leg to the front until it is even with the right leg. 3. Plot keys on that foot. Make sure to key all three controllers. (See Figure 5.41.) 4. With the timeline still at frame 16, translate the right leg back to the position the left leg was in for frames 1 and 32 (see Figure 5.42). The legs are now in opposite positions from where they started. 5. Go to frame 8 on the timeline and translate the left leg to a position off the ground using all three controllers. 6. Key the changes, as shown in Figure 5.43. 7. Go to frame 24 on the timeline and translate the right leg to a position off the ground using all three controllers.
5. Animating Your Character
Figure 5.40 Keyframing the first pose
8. Key the changes, as shown in Figure 5.44. Figure 5.42 Keyframing the third pose
127 TLFeBOOK
5. Animating Your Character
Experience XSI 4
Figure 5.43 Keyframing the fourth pose
Figure 5.44 Keyframing the fifth pose
Play back the animation, making sure to have the loop on so you can see the cycle (see Figure 5.45). It may look a little odd now; after the rest of the rig has animation on it, however, you’ll use the Animation Editor to clean it up and make it come to life. Now it’s time to start animating the rest of the rig, starting with the back of the creature. Play the animation back once in a while to check your progress. 1. Key frames 1, 16, and 32. 2. Set keys with the back of the rig in the same position. 3. Lift the back and key frames 8 and 24. Lifting the back gives the character the appearance of weighted momentum. 4. Start adding other keys to the shoulders, head, arms, and so on. 5. When you are happy with the animation, save it as walk_cycle.
128
Figure 5.45 Playing back the animation
TLFeBOOK
Experience XSI 4
When you are posing the various elements of the character, keep in mind the weight and balance aspects of a creature that really walks. You may want to spend some time observing various animals as they walk and move. The walk of this character should resemble that of an ostrich, a heavy animal with two legs that balances itself using head and tail.
Run Cycle Animation Now that you’ve accomplished a successful walk cycle, it’s time to try that same approach on a run cycle. Keyframe this in the same manner as before, but cut the animation time in half, using 16 frames total. Keep in mind when posing the character for a run cycle that the legs extend out further than in the walk cycle, while the body is lower to the ground. You may need to add a few more keyframes to the feet to give it the energy it needs (see Figure 5.46). When you are happy with the run cycle, save this scene as run_cycle.
The Animation Editor
Figure 5.46 Run cycle animation
Figure 5.47 The Animation Editor
5. Animating Your Character
You can use the Animation Editor, shown in Figure 5.47, to edit your animation using function curves, also known as fcurves. Fcurves are created when keyframes are set on an animated parameter. Fcurves are graphic representations of your animation. They are visible in the Animation Editor when an object that has animation applied is selected. Key points on the fcurves represent the keyframes of the animation. The curves between the key points show the interpolation between keyframes.
129 TLFeBOOK
Experience XSI 4 To open the Animation Editor, click the Animation menu at the bottom of the interface or press 0 (zero) on your keyboard. Alternatively, open the View menu, choose Views, and select Animation Editor.
5. Animating Your Character
You can select a key point by clicking it. Notice that the key points have handles when they are selected. These handles are used to manipulate the key points by controlling the slope of the fcurve, which will change the timing of your animation (see Figure 5.48). Once a key point has been selected, you can manipulate the animation by right-clicking a handle and dragging. If you slope the curve up toward the key point, the animation will accelerate. If you slope it down, it will decelerate. The key point itself can also be moved to change its values.
130
Figure 5.48 Editing key points on the fcurves
The Animation Editor is an important part of the XSI software package. While you work out your animation, there will be opportunities Figure 5.49 The Command bar on the Animation Editor to add emphasis to your character’s actions in order to make them appear more natural. If you were to attempt to tweak the animation without the Animation Editor, you would have to set keys on virtually every frame. By using the Animation Editor, you can ensure a smooth transition between movements and save time as well. At the top of the Animation Editor is the Command bar, as shown in Figure 5.49. This contains the tools to edit, save, and view the fcurve properties.
Watch for question mark icons in property pages and editing panels. Click these icons to access additional information about the page you are using.
Editing Your Animation Using the Animation Editor In this section, you’ll look at how you can use the Animation Editor to edit your animation (see Figure 5.50). You can change the timing on your animation by speeding it up or slowing it down, as well as make those fine adjustments to the
Figure 5.50 The Animation Editor within a scene
TLFeBOOK
Experience XSI 4 movements of your character that were discussed earlier. Keep in mind that small changes can produce big effects in the overall look of the animation, so work carefully. 1. Open the scene you saved called walk_cycle. 2. Select any part of the rig using the middle mouse button. This is branch selecting the entire hierarchy of the rig. Figure 5.51 shows an example of the Schematic view, which you can access by hitting the 9 key. 3. Press the 0 (zero) key on your keyboard to open the Animation Editor panel. Here, you will see all the animation fcurves of every part of the rig. It looks like a mess, and what we want to do is organize it so that it’s manageable to work with. 4. Maximize the top-right View Port by clicking the middle mouse button on the Resize button (located in the top-right corner of the View Port). 5. Take any bottom View Port and do the same. Figure 5.51 An example of a hierarchy in the Schematic view
The hierarchy of the rig refers to a method of organization in XSI that follows the basic form of a tree. The top of the hierarchy is the parent node, and under that are all its descendents. This family tree allows the animator to control multiple objects simultaneously. What affects the parent also affects the child. Additionally, changes made farther down the hierarchy only affect what lies beneath it, not what’s above.
5. Animating Your Character
6. Click the View menu in the top-left corner of the lower View Port and select Animation Editor. Your windows should look like the ones in Figure 5.52, with the character on top and the Animation Editor on the bottom. This will make it easier to see the changes to the fcurves and how those changes influence the character.
7. Select the main foot controller on the left foot in the top View Port. This opens the tree representing the animation applied on this selection. You can now see the tree in the Animation Editor in the bottom View Port. Figure 5.52 Starting to edit the animation
131 TLFeBOOK
Experience XSI 4
Figure 5.53 The fcurve changes
Figure 5.54 Changing the fcurve to a linear interpolation
8. On the left side of the panel, maximize the kine (short for kinematics, which controls all the Global and Local Transform properties) by clicking on the plus sign. 9. Maximize the local (click the plus sign again) and click the posz button. This is the fcurve of the translation for the foot in the z-axis.
5. Animating Your Character
10. In the main Animation Editor screen, select the key point of frame 16. 11. Grab the handle on the left of the key point and move it up ever so slightly, as shown in Figure 5.53. Keep in mind that it is very sensitive; it doesn’t take much tweaking to see changes in animation. By carefully manipulating this key point, you can achieve an appearance of thrust when your character’s foot hits the ground. Take a look by playing back the animation. 12. Change the fcurve between frames 16 and 32 to a linear interpolation as indicated by the red arrow in Figure 5.54. This will ensure that when you translate the character forward, the foot won’t slide when it is planted on the ground.
XSI fcurves have a default setting known as spline interpolation. This setting curves the transition between the keyframes to create a smooth change known as ease in and ease out. For some aspects of animation, particularly a walk, this creates a sliding effect that makes the character look as if it is walking on ice. If you select a linear interpolation, the timing between the keyframes remains constant. As a result, the foot doesn’t slide when it touches the ground. This change won’t be very obvious until the entire character has been translated forward. After you’ve mixed the character later in this chapter, you can translate the character forward on the grid to see the effect of the linear interpolation. To translate it forward, remember to use the triangle underneath the character (its globalSRT), which is the parent of the entire model. For now, leave this animation as a cycle in one place.
13. After you’ve finished editing, save the animation as walk_cycle_edited.
132 TLFeBOOK
Experience XSI 4
The Dopesheet The Dopesheet, shown in Figure 5.55, is another great tool for editing and viewing your animation. It shows you every frame of the entire animated sequence and makes it easy to see where all your keyframes are on the timeline. With the Dopesheet, you can change the timing of your animation by scaling (dragging the keyframe with the left mouse button while holding the Shift key down), or you can copy, paste, or delete keys. The Dopesheet can be found in any of the View Port menus or in the Animation Editor under the Editor tab. You can even see the timeline as a Dopesheet. To do this, click the Playback tab at the bottom of the interface and then click Dopesheet.
Storing Your Animation
Figure 5.55 The Dopesheet
To start storing your animation, do the following: 1. Open the scene you saved called walk_cycle_edited. 2. Select the entire rig by right-clicking anywhere on it. 3. On the left side of the interface, on the Animation toolbar under Actions, click Store and choose Animation Parameters—Fcurves & Expressions. 4. A property page opens for storing your actions. In the middle of the page, in the Action Name field, type walk_cycle. 5. Click OK.
If you try to play back the animation now, you’ll find that there isn’t one. That’s because the property page’s Remove Original Animation check box is checked by default. This ensures that there isn’t a conflict when you re-apply the animation in the Animation Mixer. Figure 5.56 Storing your animation
5. Animating Your Character
Storing your animation, also known as storing actions, enables you to duplicate actions as many times as you want (see Figure. 5.56). You can build a library of actions, such as walk cycles, run cycles, or anything you may want to save and apply later to your character. These actions can then be loaded into the Animation Mixer, where you can use them to modify your animation.
133 TLFeBOOK
Experience XSI 4 6. Press the 8 key on your keyboard to open the Explorer page. 7. Select the rig again using the right mouse button. 8. With your cursor over the Explorer page, press the F key on your keyboard. This frames whatever you have selected—in this case, the globalSRT. 9. Just above the globalSRT is the Animation Mixer. Maximize it by clicking on the plus sign. 10. Maximize Sources, then Animation, and then double-click walk_cycle. This opens the Store Action property page (see Figure 5.57). 11. Click on the Save button at the top of the Store Action property page and save the action in a file. 12. Name the file walk_cycle (use the Action Name field).
5. Animating Your Character
Now that you’ve saved your walk cycle into a file that you can access later on from the Animation Mixer, do the same for the run_cycle animation by opening it and repeating the process outlined in the preceding numbered list, but name it run_cycle.
Figure 5.57 The Store Action property page
Working with the Animation Mixer The Animation Mixer, shown in Figure 5.58, gives you a high level of control over your animations. Layering sequences of animation and mixing them together gives you a more complex animation that can be fine-tuned in a non-destructive way. The Animation Mixer is a very powerful and easy-to-use tool. It can also be used for mixing shape animation and audio files. To get the hang of using the Animation Mixer, do the following: 1. Open the scene saved as Final_Character_Rigged_and_Weighted. 2. Horizontally maximize the character in the top view, and make the bottom view the Animation Mixer. (This is found in the viewport under the Viewport menu.) 3. Select the rig, and in the Animation Mixer, click the Refresh button (see Figure 5.59). There should now be two animation tracks visible. 4. With the cursor anywhere in the top track, right-click the mouse and choose Load Source From File. 5. Select walk_cycle and click OK. The clip should appear in the track.
Figure 5.58 The Animation Mixer
134 TLFeBOOK
Experience XSI 4
Figure 5.60 Positioning the actions in the Animation Mixer
6. Click the clip you just imported and press the M key on your keyboard. This translates the clip to frame 1. 7. Right-click anywhere in the lower track and choose Load Source From File. 8. Select run_cycle and click OK. 9. Translate the run_cycle clip so that the beginning of the clip is almost touching the end of the walk_cycle clip, as shown in Figure 5.60. 10. Press the T key (activating the Transition tool) on your keyboard to instruct XSI to create a transition between two clips that you select. Your cursor will now have a small step symbol next to it. 11. Click the top-right area of the first clip box and then click on the top-left of the lower clip box to select the two clips (they will remain separate clips, just connected).
5. Animating Your Character
Figure 5.59 Loading the actions into the Animation Mixer
12. Play the two clips back to see how your walk cycle transitions into a run, as shown in Figure 5.61. Figure 5.61 Transition between the two clips
135 TLFeBOOK
Experience XSI 4 You can also make quick cycles by clicking on the bottom-right area of the clip and translating it to the right (see Figure 5.62). That way, the action will repeat as often as you want. The farther you move it to the right, the more cycles it will produce. Always move from the first clip to the next reading right. If you go in the opposite direction, you won’t achieve a blend between the clips.
5. Animating Your Character
Shape Animation Overview Shape animation gives you the ability to change the shape of an object over time. By saving different shapes made from the same object, you can re-apply them to the original model in the Animation Mixer as shape clips, which can then be mixed and tweaked (see Figure 5.3). Shape animation is useful for facial expressions such as eye blinks, lips, or muscles. Shape animation can also be used to change a shape on a character making a particular movement that deforms the body in some way, such as flexing the muscles.
Figure 5.62 Making cycles
When saving your shapes using Mixed Weight mode (which is the default mode), you create a custom parameter slider set (see Figure 5.64), which you can use to animate your shape instead of using the Animation Mixer. There are many ways to work with shape animation, but there are three basic ways to key them: ◆ Saving shape keys saves shape changes on the current timeline. ◆ Storing shape key saves shape clips that can be inserted into the Animation Mixer anywhere on the timeline. ◆ Selecting shape keys allows you to select duplicate objects with different shapes that are stored and can then be re-applied in the Animation Mixer.
Storing Your Shapes 136
To get the hang of using shape animation and storing your shapes, you’ll learn how to animate an eye blink:
Figure 5.63 An example of shape animation
TLFeBOOK
Experience XSI 4
Figure 5.65 Activating the Proportional Modeling tool
1. Open the scene saved as Final_Character_Rigged_and_Weighted. 2. Press the P key on your keyboard in order to be able to move your mouse up and down to zoom in and out. 3. Click the Proportional Modeling button, as shown in Figure 5.65. 4. Right-click the Proportional Modeling button to open the tool’s property page (see Figure 5.66). 5. Check the Consider Neighborhood check box.
When the Consider Neighborhood check box is checked, any modeling you do will affect only the points that are connected to the ones you are manipulating. This allows you to control the effect and prevents you from making unwanted changes to points that are close by but not connected. Figure 5.66 The Proportional Modeling tool’s property page
5. Animating Your Character
Figure 5.64 A custom parameter slider set for shape animation
137 TLFeBOOK
Experience XSI 4 6. Close the property page. 7. Select the character. 8. Press the U key on your keyboard. 9. Drag to select the eyelid area of your character. 10. Press the F key on your keyboard to zoom in, framing only the eyelid, as shown in Figure 5.67. 11. Let’s save a base shape first (see Figure. 5.68). Select your character and, under Deform on the Animation toolbar, click Shape and choose Store Shape. 12. Name the base shape base_shape (see Figure 5.69). 13. Close the property page.
5. Animating Your Character
14. Press the M key on your keyboard to activate the Move Point tool. When this tool is activated, you can see a circle on the surface of your model wherever the cursor is; this shows you the size of the area influenced by the tool.
138
Figure 5.68 Saving the base shape of the eyelid
Figure 5.67 A framed eyelid
Figure 5.69 Naming the base shape
TLFeBOOK
Experience XSI 4
When the Move Point tool is activated, you can press the R key on your keyboard to resize the area influenced by the Move Point tool.
15. Model the eyelid to make it appear closed, as shown in Figure 5.70. 16. Repeat steps 11–13 to save this shape, but name it eye_lid_closed.
Working with Shape Animation Now that you have saved the two eyelid base shapes, you can insert them in the Animation Mixer to create the animation of the blinking eye. Do the following: 1. Open the Animation Mixer. The easiest way to do so is to press Alt+0 (zero). 2. Click Track on the Edit panel then select Add Shape Track from the menu. Figure 5.70 The closed eyelid
4. Right-click the top shape track, choose Insert Source, and select base_shape. 5. Right-click the lower shape track, choose Insert Source, and select eye_lid_closed. 6. Click Insert Shape Track to insert a base shape again. 7. Right-click the top shape track, choose Insert Source, and select base_shape. You should now have two base_shape tracks on the top and one eye_lid_closed track on the bottom. 8 On the top track, move the base_shape clips apart from each other and the eye_lid_closed clip between them (see Figure 5.71). 9. Add a transition between the shape clips in the same manner as you did the action clips.
5. Animating Your Character
3. Right-click anywhere in the track you just made and choose Insert Shape Track from the pop-up menu that appears. You now have two tracks to work with.
10. Play the animation back and see the results; the eye appears to blink.
Figure 5.71 Using the Animation Mixer to create shape effects
139 TLFeBOOK
Experience XSI 4 11. If you like, move the tracks apart from each other to change the timing of the blink. 12. Save these shapes in the same manner as the clips and reapply them to your walk cycle in the Animation Mixer to heighten your animation effect.
Summary
5. Animating Your Character
This chapter covered basic keyframing and looked at how to make selections and set keys using various tools such as the Synoptic view. You learned how to use marking sets to key your selection on custom parameter slider sets. You looked at how using referenced models in a production environment can enable many people to work on the same model at once without disrupting the workflow. You took your model and keyframed a walk cycle and a run cycle, which you then imported into the Animation Editor to edit using the fcurve editing tools. After that, you learned how to save your animation as action clips, which you then loaded into the Animation Mixer and mixed. You learned how to use the Animation Mixer to cycle your animation. From there, you learned how to use shape animation and applied it to your character. All these features have many options that are beyond the scope of this book; now that you have a basic understanding of the tools, however, you can explore and discover the many possibilities that XSI offers for high-level character animation.
140 TLFeBOOK
Experience Experience XSI 4
chapter 6
Scripting in XSI cripting in XSI is a broad and exciting topic. If you start with the idea that 3D is a world that encompasses everything you can see and imagine, then, at a fundamental level, what scripting adds is the ability to automate and speed up the labor performing tasks.
S
Simple Scripting It’s fun to think of making scripts as creating magic spells, but in reality scripts are nothing more than a list of instructions. Computers have fantastic focus when reading such lists and will do exactly what the list tells them. The downside of computers is that they are very fussy and unintelligent when it comes to figuring out what you’re trying to say to them, so you should get in the habit of making clear and exact lists of instructions for the computer—that is, scripts. If you’re new to programming, scripting may seem foreign at first—but don’t worry, it doesn’t take long to get in the habit of spoon-feeding a computer. In fact, scripting can become addictive if you’re the kind of person who enjoys exercising your mind.
Figure 6.1 The tireless fingers of scripting
6. Scripting in XSI
For example, it’s easy to imagine making a city filled with buildings, each placed along streets and built at different heights. There are hundreds or even thousands of buildings in a city, and placing each one could take days of labor. But a simple script could go in and place all of them in a couple of seconds. Scripts are like incredibly fast fingers that pound away at the keyboard faster than you can see—sort of like the female robots in the film Ghost in the Shell who could type, search, and perform tasks thousands of times quicker than any human. Figure 6.1 shows such tireless fingers. The lure of scripting is the dream of speed or freedom from the labor of creating 3D images: all you need to learn is how to tell those fingers what to do.
141 TLFeBOOK
Experience XSI 4 To get started with scripting, just press the Script Editor button in the bottom-left corner of the screen (it looks like a curled scroll). The Script Editor is divided into two parts. The gray log window at the top records what commands you are using in XSI and logs messages. The white part at the bottom is where you enter scripts. If you want to copy from the gray, recorded commands at the top just select them and drag and drop them into the white area. If you want to make a sphere, you can record the logged instruction for making a sphere and drag it into the scripting window, like this: CreatePrim("Sphere", "MeshSurface", null, null);
Running this script makes a sphere. If you placed it three times: CreatePrim("Sphere", "MeshSurface", null, null); CreatePrim("Sphere", "MeshSurface", null, null); CreatePrim("Sphere", "MeshSurface", null, null);
XSI can handle many different scripting languages (such as JScript, VBscript, Python, and Perl) depending on what is installed and what operating system you are using. The scripting language you want to use can be changed under File > Preferences > Scripting > Scripting Language. For this chapter, I’m going to do everything in JScript, which is, I believe, the best language for doing 3D tasks and moving to the Behavior package.
it would make three spheres. So, by only knowing how to drag and drop commands and understanding how scripting reads a list and loops, you can make an incredible amount of tools. For example, let’s say that you wanted to create a Select Right Hand button. All you’d do is the following:
6. Scripting in XSI
1. Select the hand of any character rig. (For example, the hand from Primitive > Model > Biped - Rig.) 2. Drag and drop the command from the gray part of the Script Editor (the log window) into the white part of the Script Editor, which executes scripts. 3. Make a new toolbar (Application > Toolbars > New Custom Toolbar). Call the toolbar whatever you want. 4. Select all of the text in the Script Editor (the white part) by pressing Ctrl+A. 5. Drag and drop the selected text to the toolbar, and the Add Script Command shown in Figure 6.2 will pop up. 6. Change the button name and script command name to Select Right Hand and the filename to Select_Right_Hand (just replacing the spaces with underscores). It’s good to be in the habit of filling in all these names properly because doing so will make your life easier later when you want to transfer scripts between computers and call them from hot keys. Now, every time you press that button, the right hand of the character will be selected.
Figure 6.2 Adding a script command to make a button
142 TLFeBOOK
Experience XSI 4
Passing a Scripting Object If you are just interested in using XSI for simple macros, then getting passed what you are working with can be useful. For example, let’s say you create a new sphere and want to change the wireframe color to green. You might do this: CreatePrim("Sphere", "MeshSurface", null, null); AddProp("Display Property", "", "", ""); SetValue("sphere.display.wirecol", 368, null);
If you look closely, you can see there’s a bit of a problem here. This list of instructions assumes that the sphere is called “sphere” in the third line. If you have an empty scene, this script will work perfectly, but if you already have an object called “sphere” then this script will be named “sphere1” and will change the wire color on the wrong object. To get around this problem, you don’t really want to work with explicit names—you need to be passed the object as a variable. You can think of this object-passing process as runners passing a baton—where the baton is a link to the 3D object regardless of its name. Here’s a simple example of passing an object: CreatePrim("Sphere", "MeshSurface", null, null); AddProp("Display Property", "", "", ""); SetValue("sphere.display.wirecol", 368, null);
If you run this script over and over again you will notice that only the object named “sphere” is getting the wire color change, not the newly created sphere. You could fix the script above to:
Now the way this process of passing objects really becomes useful is when you start working with the selection. Let’s say you wanted to make a script that turned the first object you have selected to a green wire color. You’d do this: var a = Selection(0); AddProp("Display Property", a, "", ""); SetValue( a + ".display.wirecol", 368, null);
You can probably guess that Selection is an object in scripting from which you can just lift pointers to the selected 3D objects. If I had used selection(1), it would have gotten the second object in the selection.
6. Scripting in XSI
var a = CreatePrim("Sphere", "MeshSurface", null, null); AddProp("Display Property", a, "", ""); SetValue( a + ".display.wirecol", 368, null);
You also might have noticed that there is no error checking in the simple macros you have made so far. In the snippet above, if nothing is selected in 3D, then the script will return an error because there is no first object in the selection. But don’t worry—you can make many productive macros without worrying about error checking. Let’s keep expanding your knowledge of what can be done with simple lists of commands.
143 TLFeBOOK
Experience XSI 4
Tweaking between the Commas After you’ve been experimenting with making simple macros for a while you’ll probably notice that all of the commands have lists of different options separated by commas. For example, if I change the frame in XSI, it will log: SetValue("PlayControl.Current", 30, null);
You’ll notice that the SetValue command comes up a lot. For example, when setting IK/FK blending: SetValue("Biped_Rig.LBicep.chain.blendik", 1, null);
And when changing rendering to NTSC:
Figure 6.3 A parameter table from XSI’s scripting Help
SetValue("Passes.Default_Pass.RenderOptions.PictureStandard", 9, null);
If you look closely, you’ll see that the command SetValue is a list of what to change and what value to change it to (followed by an empty value you are not using). If you want to know exactly what XSI is doing with SetValue, all you have to do is select the text SetValue and click on the ? button for Help. Inside the HTML Help that opens up is a chart telling you exactly what the entries (or arguments) between the commas are.
6. Scripting in XSI
SetValue (Target, Value, [Frame])
This process of getting help and analyzing the Help definition might seem intimidating at first, but once you get your bearing, it will open up a huge new range for what you can create and automate. The Help function is the most useful aid imaginable when learning scripting; it is your guide to knowing exactly what syntax the XSI is looking for, and it’s also a map that hints at what’s possible. Look closely at the See Also section at the bottom of this Help Web page for related commands. Here you can see another command with which to lift values from parameters—in this case, GetValue. With this knowledge, you can make a new kind of tool, one that reads and writes values. So with this information, let’s copy the position x from the first object in your selection to the second. If you look on the local transform of your object (select a 3D object in XSI and hit Ctrl+K) and move the Position x slider, then the gray logging area of the Script Editor will log: SetValue("torus1.kine.local.posx", -2.533, null);
So now you know the parameter, and you can write your tool in two lines: var px = GetValue(Selection(0) + ".kine.local.posx"); SetValue(Selection(1) + ".kine.local.posx", px, null);
144
Now the next question you may ask is, “How do I get this working with a selection of many objects, rather than just one as I have up until now?” The answer is by creating loops. TLFeBOOK
Experience XSI 4
Looping My description of computers as fussy and unintelligent machines that only read simple lists line after line is, for the most part, true. But languages also have added instructions to get them to read one part of the list over and over with small changes. This is called looping. For example, to get JScript to count from 1 to 3, you’d do this: for(j = 1;j <= 3; j ++){ logmessage(j); } returns: //INFO : "1" //INFO : "2" //INFO : "3"
You can see that the part of the list being read over and over is the part between the curly brackets {}. Each time it’s read, the variable j becomes a higher value. If you look at the for command in the example above, you will see that between the semicolons it has been told the following: 1. The starting value 2. When to stop 3. How the variable changes every update If you wanted to count even numbers 0 to 10, you could use:
Loops, or repeating cycles of list reading, are the most fundamental structure in programming. You can think of all applications and programs as giant patterns of loops within loops. Making loops is also very useful for making simple 3D tools. Almost everything in 3D is a list: the selection, groups, polygon IDs, rendered pictures in a folder, fingers on a character, and so on. You can save an enormous amount of time by having scripts loop through these lists and perform redundant work. Here’s a simple example that logs the selection: for(j = 0;j < Selection.count; j++){ logmessage(Selection(j)); }
6. Scripting in XSI
for(j = 0;j <= 10; j = j + 2){ logmessage(j); }
Here you tell XSI to stop looping when you are smaller than the size of the selection list (Selection.count) and log the name of the selected object.
145 TLFeBOOK
Experience XSI 4 Our previous script that gave the first object in the selection a green wireframe could just as easily do so for the entire selection now: for(j = 0;j < Selection.count; j++){ AddProp("Display Property", Selection(j), "", ""); SetValue( Selection(j) + ".display.wirecol", 368, null); }
Keep in mind that you can learn and use all of this information at your own pace. If you’re approaching this book purely from the art side, then this may be a good point at which to end this chapter; the knowledge covered so far will save you a lot of time making simple tools. Otherwise, let’s move forward to broader and more detailed topics.
Types of Containers and Lists In the 3D world in XSI, a number of ways exist to set up a list, or a container of objects. You can make a group, a layer, or selection. You can also think of parenting as a form of grouping. In scripting there are quite a few different kinds of lists. The first is called a collection.
Collections A collection is a type of container that comes from XSI; it is basically a list of 3D objects. So, in our previous example in which you got the selection from XSI, you were actually being handed a collection. When you asked for the size of a collection, you used the .count method to figure out how big it was.
6. Scripting in XSI
To see all of the methods available for a collection, just type XSI collection in the scripting window and then hit the ? button. You can see that there are a bunch of tools that let you see how big this container is in the Web page that comes up in the Help; make sure that there are no repeats in the list and add and remove items.
146
Almost everything XSI does returns a collection. For example, let’s list all of the children of the first selected object: var children = Selection(0).children; for(j = 0;j < children.count; j++){ logmessage(children(j)); }
As you’re past the beginning stages now, you should be able to do a bit of error checking. You can see the script above fails if nothing is selected. To fix this problem, add a line: if(Selection.count > 0){ var children = Selection(0).children; for(j = 0;j < children.count; j++){ logmessage(children(j)); } }
You won’t execute the inner part of the if statement unless you have more than 0 objects selected (that is, if something is selected).
TLFeBOOK
Experience XSI 4 Another example of a collection is a list of all of the animated parameters in a scene: var animated = ActiveSceneRoot.AnimatedParameters(siFcurveSource); for(i=0;i
A scene with only a right thumb x animated returns RThumb.kine.local.posx
This is pretty useful, but it returned a parameter collection (that is, channels that could be modified by get and setvalue) instead of an object collection. If you want to know more about parameter collections type ParameterCollection and hit the ? button. Now, what if you wanted to get from one type of collection to another? Or what if you just wanted to select all of the objects that were animated by fcurves in the scene? To start, you know that the script above is logging the whole parameter. The first thing to figure out is how to get an object from a parameter. By accessing the Help function on the word parameter in the scripting window you’ll get a list of methods you can use on a parameter; one of those methods is .parent. If you change your script to say animated(i).parent, then it returns RThumb.kine.local
Trying animated(i).parent.parent logs: Rthumb.kine
RThumb
A lot of scripting is like this—you know what you want and you just poke around a bit looking at the Help and experimenting to get it. Most of the time, I open up a second copy of XSI to perform little experiments like this while I solve bigger problems. All you have to do now is build an XSICollection yourself (rather than being passed it by XSI and filling it with the objects): // start with a cube containing animation CreatePrim("Cube", "MeshSurface", null, null); SaveKey("cube.kine.local.posz", 1, null, null); DeselectAll();
6. Scripting in XSI
And animated.parent.parent.parent logs:
var aniObjects = new ActiveXObject("XSI.Collection"); var animated = ActiveSceneRoot.AnimatedParameters(siFcurveSource);
147 TLFeBOOK
Experience XSI 4 for(i=0;i
Here you have two collections: animated, which contains parameters, and aniObjects, which is filled with objects. To really make a proper script here, you should throw in a newCollection.Unique = true;
before you find the objects so that you don’t grab the same object multiple times.
Arrays Another common way of making lists is using the arrays that come with the JScript language. Here’s a simple example: var character1 = new Array("Bob", 5.8, "grey"); for(i=0;i < character1.length;i++){ logmessage(character1[i]); }
6. Scripting in XSI
You can no doubt spot a couple of key differences: the size is .length, not .count, and you use square brackets when indexing the array.
If you want to see all of the methods used in JScript arrays, check out http://msdn.microsoft.com/scripting, or, if you are on a Windows machine, install the script documentation for download from the same site.
In the JScript Help, you’ll notice that arrays use .push instead of the .add found in collections, as well as lots of great methods for sorting and reversing this data list. Entries in an array can be assigned to anything from XSI, including parameters, objects, and even collections. Arrays are much more flexible than collections. They can hold numbers and vectors, other arrays—anything you want, really. For the purpose of comparison, let’s make a tool that performs the same task as the script above to select the animated parameters with an array instead of a collection: var aniObjects = new Array(); var animated = ActiveSceneRoot.AnimatedParameters(siFcurveSource); for(i=0;i
You’ll notice above that to pass the list of objects back to XSI, you have to convert it to text separated by commas. So, in many cases where you just want a list of objects, using collections is a better bet than using arrays. Also, arrays don’t have that .unique function you get in collections.
148 TLFeBOOK
Experience XSI 4 Let’s look at some other tasks that show what JScript arrays can do that collections can’t. What if you wanted to output your first selected object’s position in the y-axis over time to a file to be used by another program? // start with an example cube CreatePrim("Cube", "MeshSurface", null, null); Translate(null, 1, 2, 3, siRelative, siView, siObj, siXYZ)var verticalPositions = new Array() for(i=0;i<15;i++){ SetValue("PlayControl.Current", i, null); verticalPositions[i] = Selection(0).posy.value; } var textOut = verticalPositions.join('\r'+ "\n"); var fso = new ActiveXObject("Scripting.FileSystemObject"); // if you are on Linux change the file path below var f1 = fso.CreateTextFile("c:\\testfile.txt", true); f1.Write(textOut); f1.Close();
You can see that this array of values has been joined together into a text file with the line feed '\r' and carriage return \n symbols and the new string has been dumped into a file. There are just a few more things you need to understand about programming before you can fully grasp the broader relationships between scripting and the 3D world. The first is the structure of scripting and programming.
Scripting Structure and Organization
Functions Functions are pretty simple. The idea behind them is that you make a little sub-list or custom command in your program. Here’s a basic function that adds three numbers together: var num = addThreeNumbers(7,8,1); logmessage(num); function addThreeNumbers(inA, inB, inC){ return inA+inB+inC; }
You can see that the function is set up to take in three arguments—in this case numbers—and return the result of them added together. When a function is called, the script searches for it, runs everything inside curly brackets then passes back whatever data follows the statement return. Interestingly enough, there’s really no difference in the commands you are calling in XSI (GetPrim, SetValue, Translate, and so on) and the custom commands that you are making yourself.
6. Scripting in XSI
When making larger scripts, organizing your data and having a method to structure your work is critical. If you write a 1000-line script where everything is arranged in a haphazard way, it will be almost impossible for other people who need to modify or fix your script to understand what you have done—even you may not remember. To avoid this kind of “spaghetti code,” two critical tools exist in scripting: functions and objects.
149 TLFeBOOK
Experience XSI 4 Here’s an example of a function that’s a little more 3D-oriented. It gets all of the position constraints on an input object. // as an example constrain to cubes together CreatePrim("Cube", "MeshSurface", null, null); CreatePrim("Cube", "MeshSurface", null, null); ApplyCns("Position", "cube1", "cube", null); var posCnst = getPositionConstraints(Selection(0)); logmessage(posCnst.join(",")); function getPositionConstraints(inObj){ var returnCnst = new Array; var cnst = inObj.Kinematics.Constraints; for(i = 0;i
Although you can think of functions as mechanisms that make helper tools, their real value lies in their ability to help organize your program flow and thought processes. The flow of a program can become a tangled mess if it is not broken into clear components contained in functions. Typically these functions perform a single task and return the result from doing that task. If you don’t organize this way, it will be difficult to reuse later.
6. Scripting in XSI
Here is a good example of using functions in scripting: // this tool takes your selected objects and selects // any deformers attached through enveloping selectDeformers(); /*-------------------------------MAIN - Select Deformers --------------------------------*/ function selectDeformers(){ var sel = getSelection(); if(!sel){return} DeselectAll(); for(i = 0;i < sel.count; i++){ var deformers = getDeformers(sel(i)); SelectObj(deformers ); } } /*-------------------------------Get Selection --------------------------------*/ function getSelection(){ var sel = GetValue("SelectionList"); if(sel.count == 0) { logmessage("Please Select an Enveloped Mesh");
I recommend making each function responsible for one main task and giving the function a name that describes it as neatly as possible in two or three words. If you make good functions you will start to amass a good library and will end up saving time on future projects.
150 TLFeBOOK
Experience XSI 4 return; } return sel; } /*-------------------------------Get Deformers --------------------------------*/ function getDeformers(inObj){ var env = inObj.activeprimitive.constructionhistory.find("envelopop"); if(!env){return} var def = env.Deformers return def; }
Notice a couple of things here. First look at how the returns are working. The functions return nothing when they don’t get what they are looking for. Functions are great for error checking, because you don’t need tons of brackets—you just return nothing (that is, “return”) when things aren’t working and then check if the function failed from the place that called it (i.e. if(!sel){return}). You can see that using functions is a pretty readable way to make a tool. By naming variables and functions well and dividing tasks between functions, you can make something quite simple and clean. Also, you may notice that in the example above, I used var sel = GetValue("SelectionList");
instead of
I did this because the Selection method is a live link to what’s currently selected, and when I used Deselect way to go, because it’s a copy of the links to those objects.
All,
the link was lost. GetValue was a better
In most of the examples in this chapter, I’m using only a sketchy, prototype style of scripting in order to help you experiment and think about what you’re doing. But keep in mind that any tool you give to other people to use should be cleaned up and have good structure and checks. Okay, now you have a sense of what functions can do. Now there’s one last major structure you need to understand: objects.
Objects As a starting point, I want to distinguish between objects in 3D space and programming objects. A 3D object is something you can see in XSI. A programming object is a container that can hold either data or functions.
6. Scripting in XSI
var sel = Selection;
151 TLFeBOOK
Experience XSI 4 Let’s first take a simple look at objects that hold simple data such as text and numbers. In the array example you saw a simple list of character properties: var actor1 = new Array("Bob", 5.8, "grey");
Another way to write this would be: var actor1 = new Array(); actor1[0] = "Bob"; actor1[1] = 5.8; actor1[2] = "grey";
Now let’s say that when organizing a character tool, you wanted to know the name, height, and hair color of every character. You could, of course, put a comment at the beginning of the script, like so: // // // //
in all character arrays: [0] = name; [1] = height; [2] = hair color;
Of course, this could get a bit messy—you’d have to always remember what you were working with, and for other people to use the script you’d probably have to print out a big chart describing the connections between the numbers and the properties and tape it near your desk. The value of objects arises from the desire for convenience—people need to remember what they are looking for in a list. You can think of objects as a kind of mnemonic device.
6. Scripting in XSI
With objects, you could write: var actor1 = new Object(); actor1.name = "Bob"; actor1.height = 5.8; actor1.hairColor = "grey"; logmessage(actor1.height);
This creates a new object for the character, adds new properties on the fly, and sets their values. I think it’s pretty clear that this is a much easier way to remember what you’re doing. In fact, XSI also uses objects a great deal. Remember how we got the children of a selected object? var children = Selection(0).Children;
The process under the hood in XSI is exactly the same as how we created an object earlier. There’s a list of children on every scene object, and the line of code above is just returning it. In fact, all of the scripting in XSI is divided into two parts—the first is based on functions called commands, and the second is based on objects called the Object Model. When you click on a button and it logs: CreatePrim("Cube", "MeshSurface", null, null);
152 TLFeBOOK
Experience XSI 4 that is a function. When you get all of the constraints on your Selection through var cnsts = Selection(0).Kinematics.Constraints;
that is using objects. In the Help, these two areas are found in the Contents under Scripting Reference (see Figure 6.4). The way you’ve been making your own objects so far in this chapter has been pretty arbitrary. It’s cool that JScript allows you to add properties on the fly (especially when you consider that other languages like C++ don’t), but some tasks require you to be a bit more organized. For example, if you had several hundred different characters processed by the previous script example, you’d probably want to make sure that the definition of properties stays the same for every character. You could ensure that they were identical in structure by using the following: var actor1 = new character("Bob", 5.8, "grey"); logmessage(actor1.height); //--------- character definition -------------function character(inName, inHeight, inColor){ this.name = inName; this.height = inHeight; this.color = inColor; }
This is pretty convenient because every time you need a different character all you have to do is call:
Figure 6.4 Contents of Programmer’s Reference in the scripting Help
So far, you’ve only looked at the potential of objects to hold data through properties. But there’s a whole other side of object functionality you should understand—methods. Methods are not just hanging data—they go and perform tasks. For example, in XSI, if you wanted to add a null to your first-selected 3D object, you’d use this: Selection(0).AddNull("characterCenter")
What’s happening here is that the AddNull method is performing the task of adding a null as a child of your selection and calling it characterCenter.
6. Scripting in XSI
var heroInShot12 = new character("Eddie the Knife", 6.2, "black");
Let’s say you wanted to add a method to your character definition that scales the character’s height. The way to do it is: var actor1 = new character("Bob", 5.8, "grey"); logmessage(actor1.height); actor1.scaleHeight(2);
153 TLFeBOOK
Experience XSI 4 logmessage(actor1.height); //--------- character definition -------------function character(inName, inHeight, inColor){ this.name = inName; this.height = inHeight this.color = inColor; this.scaleHeight = scaleHeightMethod; } //---------- the scaleHeight method ----------function scaleHeightMethod(inScale){ this.height = this.height * inScale; }
You don’t have to use the word Method in your name for the function being called by the method, but it’s good to stick to some conventions like that to keep you organized. If you wanted to get a variable back from calling the scaleHeightMethod, you could just stick a return in that function. It’s worth keeping in mind that all of these different techniques can be combined together however you want. You can have an object with a list of properties that are all arrays (for example, lists of fcurves or mesh data), or you could have an array filled with objects (for example, an array of vectors). Okay, so now you’ve got the basic structures of scripting together in your head; let’s step back and look at the big picture of what scripting can be used for once again.
Approaching Problems with Scripting
6. Scripting in XSI
Scripting can be used to help solve a great number of problems in 3D. Although there is no short path to the famous, mythical Make Animation button, a good starting point is a sense of how production is using scripting today.
A Broad Overview of Scripting Tasks There are three main areas that scripting is used for: automation, organization, and complex tasks that require scripting to make decisions. The next subsections will discuss these scripting areas.
Automation At first glance, the most obvious use of scripting is to reduce your 3D button-clicking. A perfect example of this is character setup. If you’re always making a similar footroll setup, it makes a lot of sense to write a macro-based script that creates the setup for you. Scripting for automation is based on copying exactly the tasks you want performed and putting them into lists. After reading this chapter, you should know how to do almost anything this way—especially if you make use of the Help for JScript and the XSI Script Editor.
Organization Another important opportunity with scripting is the computer’s ability to sort and process data. For example, finding every bone in a large scene would take you a long time. But a script could do it fairly quickly using:
154 TLFeBOOK
Experience XSI 4 var allObj = ActiveSceneRoot.FindChildren(); var bones = new ActiveXObject("XSI.Collection"); for(i=0; i < allObj.count;i++){ if(allObj(i).type == "bone"){ bones.add(allObj(i)); } } SelectObj(bones);
When setting up a pipeline for making a movie or a game, scripting is the best resource available for keeping organized. You can read/write files and control objects and referencing in the scene by name, type, grouping, or hierarchy/constraint/operator association. Rendering and moving animation around are other areas wherein an organizational approach to scripting is key.
Decision-Making One of the hardest parts of scripting is using scripts to make decisions. While it might be easy to say, “I’m going to place all of these buildings so that they follow the road as it curves around the river,” actually doing so is a difficult task in scripting. To do it, you need a tool that can figure out exactly where to place and orient each building so that they don’t overlap. When using scripting to make decisions, all of the big-picture logical steps to figure out what’s needed have to come from you. These include the following: ◆ What the problem is and how to approach it. ◆ How to break the problem into smaller tasks. ◆ How to use mathematics, algorithms, and heuristics to calculate the tasks.
Part of the challenge and excitement of learning scripting is getting to the point where this process becomes second nature to you. The more experience you have, the closer you can come to making little machines that can think. I’ll get into much more detail about literally doing this in Chapter 8, “Making Crowds and Character Logic with Behavior.” Mathematics is a toolkit and set of relationships that can be a huge help in constructing these machines. For this reason, I’m a huge believer in learning more mathematics to grow your ability in scripting. And what’s great about XSI is that the object model and architecture are set up to make this easy without getting bogged down writing tons of equations on paper.
Controlling Space with Math Let’s start off by looking at some of the major uses of math in 3D: vectors, curves, and rotations. Of course, there are many more math tools you need in order to get serious in this area, but these three will give you a good foundation from which to grow your knowledge.
6. Scripting in XSI
◆ How to visualize what you are doing in order to correct errors.
155 TLFeBOOK
Experience XSI 4
Vectors I’ve already discussed the fact that XSI scripting passes a lot of programming objects back and forth with the core architecture. The most fundamental of these objects is a transform: var trans = Selection(0).Kinematics.Global.Transform;
which stores the position, scale, and rotation of an object at a given frame. But before I get into too much detail about this multi-faceted object, it might be better to start with something simpler, like a vector (see Figure 6.5). You probably know that a vector is a change in position. So a position in space can be described as a vector from the origin to the current position. Instead of just reading the posx of an object with commands using var x = GetValue(Selection(0) + ".kine.local.posx");
or by using shortcuts, like var x = Selection(0).posx;
you gain a lot of advantages for serious scripts by using the entire vector:
6. Scripting in XSI
var vec = XSIMath.CreateVector3(); Selection(0).Kinematics.Global.Transform.GetTranslation(vec); logmessage(vec.x);
Figure 6.5 Vectors. Both A and B are identical vectors (5,2), even though B starts at the origin and A at (0,3). They are identical because vectors don’t have a start—they only describe an offset from one place to another. For this reason, all coordinates in global space can be thought of as a vector from the origin.
The reason is that there are 41 different methods for manipulating these vectors that can save you tons of time. To see them, look in Scripting Reference > Objects > SIVector3 in the Help. Here’s a quick example: Let’s say you wanted to place a null 50 percent between the first two objects in our selection; looking at the Help for SIVector3, you can see that there’s a method called LinearlyInterpolate. From there, it’s pretty easy to make: var vec0 = XSIMath.CreateVector3(); var vec1 = XSIMath.CreateVector3(); Selection(0).Kinematics.Global.Transform.GetTranslation(vec0); Selection(1).Kinematics.Global.Transform.GetTranslation(vec1); var middle = XSIMath.CreateVector3(); middle.LinearlyInterpolate (vec0, vec1, .5) var newNull = ActiveSceneRoot.AddNull("inBetween"); var trans = newNull.Kinematics.Global.Transform; trans.setTranslation(middle); newNull.Kinematics.Global.Transform = trans;
If you have two things selected, this will place a null between them (see Figure 6.6). The only trick to this is that you must read and set back the entire transform rather than trying to do the following:
156
newNull.Kinematics.Global.Transform.SetTranslation(middle);
TLFeBOOK
Experience XSI 4 The reason that this doesn’t work is that under the hood, XSI is processing entire transforms on objects every update, and scripting is dealing with a copy—so you need to fill an entire transform and transfer it to the 3D object. Of course, you could use: newNull.posx = middle.x; newNull.posy = middle.y; newNull.posz = middle.z;
But it’s worth getting in the habit of passing transforms back and forth to objects. Let’s take this a bit further and place nine nulls between the objects. The result is shown in Figure 6.7. var vec0 = XSIMath.CreateVector3(); var vec1 = XSIMath.CreateVector3(); Selection(0).Kinematics.Global.Transform.GetTranslation(vec0); Selection(1).Kinematics.Global.Transform.GetTranslation(vec1); for(i = 1; i < 10; i++){ var middle = XSIMath.CreateVector3(); middle.LinearlyInterpolate (vec0, vec1, i/10) var newNull = ActiveSceneRoot.AddNull("inBetween"); var trans = newNull.Kinematics.Global.Transform; trans.setTranslation(middle); newNull.Kinematics.Global.Transform = trans; }
Figure 6.6 Placing a null between two selected objects
6. Scripting in XSI
Really the only important thing here is to be fussy about getting the nine divisions right. You are cycling from 1 to 9 (bailing out when you aren’t smaller than 10) and dividing the result by 10. It’s good to be fussy about this sort of thing because it’s a common place for programming errors, even with something simple like division of segments across a span. Let’s make one more change. Let’s divide the span 30 times and say every fifth object is a cube instead of a null. Now to do this, you don’t need to look at the vector methods; you must look at some basics of mathematics: modular arithmetic. Modular arithmetic is just the math of remainders, or what’s left over. In JScript, the mod symbol is the percent symbol (%). for(i =0; i < 30; i++){ logmessage(i % 5); } Figure 6.7 Using looping and division for linear subdivision of space
157 TLFeBOOK
Experience XSI 4 So if you run this, it’s just a long repeat of //INFO : "0" //INFO : "1" //INFO : "2" //INFO : "3" //INFO : "4" What this is saying is: When I divide 0 by 5 I have When I divide 1 by 5 I have When I divide 2 by 5 I have When I divide 3 by 5 I have
0 1 2 3
leftover. leftover. leftover. leftover.
6. Scripting in XSI
You know that when the remainder is 0 you are at a multiple of 5. So to switch every fifth object as in Figure 6.8, the new script becomes:
158
var vec0 = XSIMath.CreateVector3(); var vec1 = XSIMath.CreateVector3(); Figure 6.8 Selection(0).Kinematics.Global.Transform.GetTranslation(vec0); Modular arithmetic places a cube every fifth loop when dividing Selection(1).Kinematics.Global.Transform.GetTranslation(vec1); space for(i = 1; i < 30; i++){ var middle = XSIMath.CreateVector3(); middle.LinearlyInterpolate (vec0, vec1, i/30) if (i % 5 == 0){ var newObj = ActiveSceneRoot.AddPrimitive ("cube", "Marker"); newObj.parameters("length").value = 1; } else{ var newObj = ActiveSceneRoot.AddNull("inBetween"); } You can see that the var trans = newObj.Kinematics.Global.Transform; script above changes the trans.setTranslation(middle); length parameter of the newObj.Kinematics.Global.Transform = trans; } cube. If you want to know
This gives you a general sense of dividing up linear space with vectors, but what if you wanted to do something harder? How about if you wanted to take a two-bone IK chain and find a line that’s perpendicular to the plane (these are the kind of problems that come up when making character setup tools)? To do so, you need a cross-product (see Figure 6.9).
how to quickly find such parameters and properties yourself, use the SDK Explorer found under Application > Views > (SampleRV) SDK Explorer.
Figure 6.9 The cross product of A and B is a vector perpendicular to both
TLFeBOOK
Experience XSI 4 A cross-product returns a perpendicular vector (also know as a plane normal), given two vectors as input. For example, let’s find the vector perpendicular to (1,0,0) and (0,1,0): var v1 = XSIMath.CreateVector3(); var v2 = XSIMath.CreateVector3(); v1.set(1,0,0); v2.set(0,1,0); v3 = XSIMath.CreateVector3(); v3.Cross(v1,v2); logmessage(v3.x +","+v3.y+","+v3.z);
And it returns //INFO : "0,0,1"
like you expected. You can see here what’s so powerful about having a strong math library like XSI’s—you can do stuff like calculate perpendicular vectors without going into a lot of detail about how the math works. You can treat these methods exactly the same way you would character setup tools. Let’s take on the task you started with and draw a line parallel to a selected IK chain (shown in Figure 6.10). Again, I’m not doing proper error-checking on these scripts, in order to keep things light.
Figure 6.10 The cross-product of a chain
6. Scripting in XSI
var chain = GetSkeleton(Selection(0), null); var p1 = XSIMath.CreateVector3(); var p2 = XSIMath.CreateVector3(); var p3 = XSIMath.CreateVector3(); chain(1).Kinematics.Global.Transform.GetTranslation(p1); chain(2).Kinematics.Global.Transform.GetTranslation(p2); chain(3).Kinematics.Global.Transform.GetTranslation(p3); // get the vectors from the root to the second bone +var v1 = XSIMath.CreateVector3(); var v1 = XSIMath.CreateVector3(); var v2 = XSIMath.CreateVector3(); v1.sub(p2, p1); v2.sub(p3, p1); var perpendicular = XSIMath.CreateVector3(); perpendicular.cross(v1,v2); perpendicular.addinPlace(p1); DrawLine(p1, perpendicular); /*-------------------------------Draw Line --------------------------------*/ function DrawLine(inStart, inEnd){ var s = inStart; var e = inEnd; var curvePoints = new Array(s.x,s.y,s.z,1,e.x,e.y,e.z,1); var knots = new Array(0,1); var line = ActiveSceneRoot.AddNurbsCurve(curvePoints, knots, 0, 1, 1, siSINurbs); }
159 TLFeBOOK
Experience XSI 4 There will be a couple of things you’ll notice if you run this. First, your vector is probably much bigger than the one in Figure 6.10. You can scale it down by normalizing to a unit vector and making it a bit bigger with perpendicular.NormalizeInPlace(); perpendicular.ScaleInPlace(5);
before the addinPlace. You haven’t yet looked at GetSkeleton, which is a really useful command. The rest of it is just getting the vectors from the first bone (skeleton(0)) to the elbow and the effector. One trick I always use when getting a vector from one object to another is to say to myself, “Where I’m going to, minus where I’m coming from.” So getting the vector from the effector to the elbow is
GetSkeleton is really handy for getting
a chain when only one piece of it is selected. In XSI, effectors can be reparented, so using GetSkeleton guarantees getting the root, then bones, then the effector, in a list regardless of scene configuration.
NewVec.sub(elbow I'm going to, effector I'm coming from);
Or in this case: v1.sub(p2, p1);
The last point is that there’s a helper function there for drawing the line. I can’t stress how useful it is to have these helper scripts that allow you to visualize what you are doing.
6. Scripting in XSI
Another really useful vector tool is the dot product (see Figure 6.11). All a dot product does is multiply together all of the x’s, y’s, and z’s and add them together, but it has the extremely useful property of acting like a projection when divided by the length of a vector squared. When I’m making tools, I always think of the dot product as a component of a projection. Let’s say that we have a vector (.5,.5,0) and we want to project it (that is, cast a shadow) onto the vector (1,0,0). All we have to do is this: var A = XSIMath.CreateVector3(); var B = XSIMath.CreateVector3(); A.set(1,0,0); B.set(.5,.5,0); var dot = A.Dot(B); var ScaleChange = dot/Math.pow(A.Length(),2); A.ScaleInPlace(ScaleChange); logmessage(A.x +","+A.y+","+A.z);
The steps necessary to do a projection are pretty simple. 1. Get the dot product of the two vectors. 2. Divide the dot product by the length squared of the vector you are projecting.
160
Figure 6.11 The dot product
3. Scale the vector onto which you are projecting by that result.
TLFeBOOK
Experience XSI 4 With this in mind, you can make a tool that projects your selection’s position onto a vector (1,2,1) from the origin. var A = XSIMath.CreateVector3(); A.set(1,2,1); var origin = XSIMath.CreateVector3(); DrawLine(origin,A); var B = XSIMath.CreateVector3(); var trans = Selection(0).Kinematics.Global.Transform trans.GetTranslation(B); var dot = A.Dot(B); var ScaleChange = dot/Math.pow(A.Length(),2); A.ScaleInPlace(ScaleChange); trans.SetTranslation(A); Selection(0).Kinematics.Global.Transform = trans; /*-------------------------------Draw Line --------------------------------*/ function DrawLine(inStart, inEnd){ var s = inStart; var e = inEnd; var curvePoints = new Array(s.x,s.y,s.z,1,e.x,e.y,e.z,1); var knots = new Array(0,1); var line = ActiveSceneRoot.AddNurbsCurve(curvePoints, knots, 0, 1, 1, siSINurbs); }
What’s nice about this kind of projection is that it’s almost all you need to project onto a plane. To do that, just find the normal of the plane, project onto it, and then subtract the result from your original vector. The leftover part will be the projection on the plane.
Curves Let’s go back for a moment to our early goal of placing buildings that follow a curve. Aside from helping layout, knowing how to do this would also help solve a lot of character setup problems. What would it take to be able to place the buildings along a curve? Well the first thing you would need to know is the length of the curve. That’s fairly straightforward; looking at the Help on NurbCurve, you can tinker together var myCurve = Selection(0); var len = myCurve.ActivePrimitive.Geometry.Curves(0).Length; logmessage(len);
The examples in this chapter, however, are dealing with single curves, so only Curves(0) interests you here.
XSI has all the curves as lists, so you could draw multi-curved shapes or curved networks of muscles very easily. For this reason you access Geometry.Curves(0) above, specifying the first curve list on the geometry. If you check out the Help for NURBSCurveList, you’ll see that there are many other interesting methods, such as GetClosestCurvePosition, for looking up the closest position to a point.
6. Scripting in XSI
I think this section has given you a bit of an introduction to using vectors. It’s also probably valuable to look at working with curves as well, as special relationships in 3D are often not linear.
161 TLFeBOOK
Experience XSI 4 The next thing you need to know is the position at different increments. Again, if you look at the methods in the Help, you’ll find a useful method: EvaluatePositionFromPercentage. Let’s do as before and place nulls along the curve as shown in Figure 6.12: var myCurve = Selection(0).ActivePrimitive.Geometry.Curves(0); for(i=0; i <= 100; i = i + 10){ var pos = myCurve.EvaluatePositionFromPercentage(i).toArray(); var newObj = ActiveSceneRoot.AddNull("inBetween"); var trans = newObj.Kinematics.Global.Transform; trans.setTranslation(pos[0]); newObj.Kinematics.Global.Transform = trans; }
6. Scripting in XSI
There are a couple of things to notice here. You went through the object model hierarchy to get Curve(0) from the selection outside your loop. This saves time because you don’t have to look it up every cycle. Also, if you look at the EvaluatePositionFromPercentage method, you’ll see that it’s returning an array of vectors (position, tangent, normal, bi-normal). In JScript, when you’ve passed arrays from scripting you usually need to throw a .toArray() on the end to index the return because you’re being passed a VBArray (Visual Basic array) from scripting, and this converts the return to a JScript array. After that we have a JScript array (position, tangent, normal, bi-normal), and you can access it with square brackets later.
Figure 6.12 Subdividing a curve
Instead of converting to a JScript array, you could have just read the VBArray in JScript (but we can’t write to it because JScript has read-only access to VBArrays). So you could have substituted the following two changes: var pos = new VBArray(myCurve.EvaluatePositionFromPercentage(i));
and trans.setTranslation(pos.getItem(0));
Subbing in these changes actually would have been a bit faster because you don’t make a second copy of the array in memory. Either way works fine, but in the future when you pull arrays that you want to copy, change, and write back—as when writing a deform—you should use the .toArray() method. Back to our project. The next thing you need to worry about is orientation. How can you get the buildings to align with the curve? This really brings us into the world of rotations.
162 TLFeBOOK
Experience XSI 4
Rotations Rotations are probably the hardest subject in 3D. The fact that Euler rotations can double up in Gimbal Lock and cause unpredictable interpolation is an unending source of pain and wasted hours for almost everyone working in 3D. In fact, the problem is big and complicated enough that we will only touch the surface in this discussion. Chapter 4, “Character Setup,” also covers a lot of detail on how Softimage is tackling such problems through tools and interface. In your first building-placement problem, you can avoid all of the trauma by treating the problem as a 2D rotation problem. 2D rotations are quite simple: an object is rotating clockwise or counter-clockwise, and there are no surprises. In the spirit of simplicity, let’s assume that the curve was drawn in the top view and the buildings you are placing are being rotated in the y-axis to follow the curve. Let’s also say that the building is pointing forward on the x-axis (1,0,0) and you want to rotate that axis to align with the tangency of the curve. If you go back to the SIVector3 Help, you can see that there are all kinds of methods dealing with relationships between rotations and vectors. First look at the angle method. Given two vectors, let’s get the angle between them: var A = XSIMath.CreateVector3(); var B = XSIMath.CreateVector3(); A.set(1,0,0); B.set(.5,.5,0); logmessage(A.angle(B));
The result,
may confuse you at first, as it appears in radians. To solve the conversion problem, use XSIMath to switch your result to degrees: var A = XSIMath.CreateVector3(); var B = XSIMath.CreateVector3(); A.set(1,0,0); B.set(.5,.5,0); var ang = XSIMath.RadiansToDegrees(A.angle(B)); logmessage(ang);
6. Scripting in XSI
//INFO : "0.785398163397448"
If you are working on a scripting project and everything is spinning around many times faster than it should, then you probably have a conversion problem. Just remember that the math objects (transforms, vectors, rotations, quaternions, and so on) read and feed radians. Parameter reading/setting and the XSI interface is in degrees.
This is exactly what you would expect: 45 degrees. Okay, so now use this technique to get the angle between (1,0,0) and the tangency of your curve and rotate the nulls that amount in y:
163 TLFeBOOK
Experience XSI 4 var myCurve = Selection(0).ActivePrimitive.Geometry.Curves(0); var alignAxis = XSIMath.CreateVector3(); alignAxis.set(1,0,0); for(i=0; i < 100; i = i + 5){ var pos = myCurve.EvaluatePositionFromPercentage(i).toArray(); var newObj = ActiveSceneRoot.AddNull("inBetween"); var trans = newObj.Kinematics.Global.Transform; trans.setTranslation(pos[0]); var tangent = pos[1]; var rot = XSIMath.CreateVector3(); rot.y = alignAxis.angle(tangent); trans.SetRotationFromXYZAngles(rot); newObj.Kinematics.Global.Transform = trans; }
If you select a curve with both convexity and concavity (that curves in and out) and run this (shown in Figure 6.13), you will notice that sometimes it works perfectly, while at other moments it is rotating the wrong way. This is because you are not checking sign. All the .angle method does is tell you what the angle is between those two vectors. It doesn’t tell you whether you should rotate clockwise or counter-clockwise.
6. Scripting in XSI
There are a couple of different ways we could go about solving the problem of which direction a rotation is spinning, and they all involve getting the crossproduct (that is, the perpendicular vector) between those two vectors. What we are taking advantage of is the fact that the cross-product flips direction if you go from A to B or from B to A. Let’s go back to the simple cross-product example, var v1 = XSIMath.CreateVector3(); var v2 = XSIMath.CreateVector3(); v1.set(1,0,0); v2.set(0,1,0); v3 = XSIMath.CreateVector3(); v3.Cross(v1,v2); logmessage(v3.x +","+v3.y+","+v3.z);
that returns //INFO : "0,0,1"
If you rotate the other way, changing the line that does the cross-product to this: v3.Cross(v2,v1);
it flips to the other side: //INFO : "0,0,-1"
Figure 6.13 Rotating along a curve without checking rotation sign
164 TLFeBOOK
Experience XSI 4 This is very useful information. Since we are rotating the plane normal to the global y-axis, all we need to see is whether the cross-product between the two vectors is positive or negative, making our tool the following: var myCurve = Selection(0).ActivePrimitive.Geometry.Curves(0); var alignAxis = XSIMath.CreateVector3(); alignAxis.set(0,0,1); for(i=0; i < 100; i = i + 5){ var pos = myCurve.EvaluatePositionFromPercentage(i).toArray(); var newObj = ActiveSceneRoot.AddNull("inBetween"); var trans = newObj.Kinematics.Global.Transform; trans.setTranslation(pos[0]); var tangent = pos[1]; var rot = XSIMath.CreateVector3(); var cp = XSIMath.CreateVector3(); cp.cross(alignAxis, tangent); var sign = 1; if(cp.y < 0){sign = -1} rot.y = alignAxis.angle(tangent) * sign; trans.SetRotationFromXYZAngles(rot); newObj.Kinematics.Global.Transform = trans; }
You can see that the variable cp is a vector pointing up or down, depending on whether you are rotating positively or negatively. If you are pointing down, then cp.y is less than zero and your rot.y becomes multiplied by a negative number. Now that you’ve done the hard stuff, you can always finish it off by making a little calculation that figures out how many buildings you can place along the length. For this example I’m just going to use cubes:
6. Scripting in XSI
var buildingSize = .5; var spaceBetyouen = .3; var myCurve = Selection(0).ActivePrimitive.Geometry.Curves(0); var len = myCurve.Length; // figure out how many buildings you can get across that length var nbBuildings = Math.floor(len/(buildingSize + spaceBetyouen )) var alignAxis = XSIMath.CreateVector3(); alignAxis.set(0,0,1); var increment = 1/nbBuildings * 100; for(i=0; i < 100; i = i + increment){ var pos = myCurve.EvaluatePositionFromPercentage(i).toArray(); var newObj = ActiveSceneRoot.AddPrimitive ("cube", "building"); newObj.parameters("length").value = buildingSize; var trans = newObj.Kinematics.Global.Transform; trans.setTranslation(pos[0]); var tangent = pos[1]; var rot = XSIMath.CreateVector3(); var cp = XSIMath.CreateVector3()
165 TLFeBOOK
Experience XSI 4 cp.cross(alignAxis, tangent); var sign = 1; if(cp.y < 0){sign = -1} rot.y = alignAxis.angle(tangent) * sign; trans.SetRotationFromXYZAngles(rot); newObj.Kinematics.Global.Transform = trans; }
You can see that by fudging around with the building size and the spaces between, you can figure out how many buildings you need and the increment you need to go up every loop, so you can feed EvaluatePositionFromPerentage a number between 0 and 100. The function Math.Floor is just chopping off the decimal points when you get the number of buildings. The result of this script is shown in Figure 6.14. If this is a simple rotation problem, what does a hard one look like? Basically, the difficulty comes in when the rotx, roty, rotz are treated as separate animation channels. To illustrate, let’s get two objects to interpolate between:
6. Scripting in XSI
var startMan = GetPresetModel("Man", "Man", null, null); var endMan = GetPresetModel("Man", "Man", null, null); endMan.rotx = -60; endMan.roty = 100; endMan.rotz = -130;
Figure 6.14 Placing objects along a curve by checking cross-product sign and available length
If you look at the second character model in Add rotation mode (just go into Rotate mode after running this script and make sure the rotation mode below the Main Control panel says Add), you will see that the rotation axes are doubled up pretty badly. So when you try to interpolate between them in a style similar to how you worked with positions, like this: var startMan = GetPresetModel("Man", "Man", null, null); var y = XSIMath.DegreesToRadians(-60); var x = XSIMath.DegreesToRadians(100); var z = XSIMath.DegreesToRadians(-130); var rot1 = XSIMath.CreateVector3(); rot1.set(x,y,z); var trans = XSIMath.CreateTransform(); var newRot = XSIMath.CreateVector3(); var zeroRot = XSIMath.CreateVector3(); for(i=1; i <= 10; i++){ var man = GetPresetModel("Man", "Man", null, null); newRot.LinearlyInterpolate(zeroRot, rot1, i/10); trans.SetRotationFromXYZAngles(newRot); man.Kinematics.Global.Transform = trans; }
166 TLFeBOOK
Experience XSI 4 the result (shown in Figure 6.15) is very bad. Basically, the script runs across the Gimbal Lock as the rotation interpolates the xyz channels and makes a big mess. As you step through the rotation, it gets there in the end, but the rotation interpolation is not smoothly divided and doesn’t follow any reasonable curve between the two characters. If you try different values, you can see that some work okay (especially very low values), but the closer you get to Gimbal, the more irregular C, S, and looping curves you will see in the interpolation. No wonder keying rotations is such a nightmare. Sometimes you get wrapped up in a problem where it’s the approach that was flawed. If you run the same script with quaternions, and, intead of using LinearlyInterpolate on vectors you use .Slerp on quaternions (which also subdivides rotation, except it works on a rotation object), you get a great result (shown in Figure 6.16):
Figure 6.15 Poor rotation interpolation using Euler angles
6. Scripting in XSI
var startMan = GetPresetModel("Man", "Man", null, null); var y = XSIMath.DegreesToRadians(-60); var x = XSIMath.DegreesToRadians(100); var z = XSIMath.DegreesToRadians(-130); var quat1 = XSIMath.CreateQuaternion(); quat1.SetFromXYZAngleValues(x,y,z); var trans = XSIMath.CreateTransform(); zeroQuat = XSIMath.CreateQuaternion(); var newQuat = XSIMath.CreateQuaternion(); for(i=1; i <= 10; i++){ var man = GetPresetModel("Man", "Man", null, null); newQuat.slerp(zeroQuat, quat1, i/10); trans.SetRotationFromQuaternion(newQuat); man.Kinematics.Global.Transform = trans; }
Keep in mind that approach is an important thing when making tools. My favorite way to think about rotations is that famous Einstein quotation: “You cannot solve a problem with the same mind that discovered it.” That is, you cannot solve the tangled mess of Euler angles by thinking about Euler angles—you have to step outside of the problem. Poking around in the SIQuaternion and SIRotation methods can give you an idea of what’s possible, but for the most part, quaternions are a tool for blending rotations. I hope you understand the general flow of how the different math objects work and are getting used to looking in the Help to discover what’s going on. I also suggest you take a look around the XSIMath object, which has some good methods for converting objects between different spaces (local, global, and so on).
Figure 6.16 Rotation interpolation using quaternions
167 TLFeBOOK
Experience XSI 4
I should also point out that in the scripts above, all of the XSIMath.CreateSomething lines are placed before the loop. This is a great habit to get into with your tools. Creating objects is fairly slow, so putting them outside as much as possible is a good speed optimization technique. Be careful though—many cases arise in which you need the objects to be made within a loop. Consider the case wherein you need any array of vectors: if you do the vector creation outside the loop and then just assign them, the vectors will all be identical and pointing to the same object with the last value you assigned to it.
Let’s broaden the approach a bit and look at how to create geometry and use some of the techniques you’ve learned to manipulate arrays of data.
Making Geometry Making geometry in XSI is pretty simple once you get your head around it. One of the most visually fulfilling things you can do with scripting is to be the architect of a piece of matter that unfolds and changes as you adjust sliders.
6. Scripting in XSI
In fact, you’ve already passed by one simple geometry-making example with the Draw
Line
function you saw earlier:
/*-------------------------------Draw Line --------------------------------*/ function DrawLine(inStart, inEnd){ var s = inStart; var e = inEnd; var curvePoints = new Array(s.x,s.y,s.z,1,e.x,e.y,e.z,1); var knots = new Array(0,1); var line = ActiveSceneRoot.AddNurbsCurve(curvePoints, knots, 0, 1, 1, siSINurbs); }
Basically, there’s an AddNurbsCurve method, available on any X3Dobject, that you can fill with an array of points, knots, and a couple of details about curve type and it will go make a new curve for you. How would you go about making polygons, then? This is also fairly straightforward. All you need to do is get a list of the point positions you are going through, such as: Point1.x, Point1.y, Point1.z, Point2.x, Point2.y, Point2.z, Point3.x, etc….
and a list that groups the points in each polygon followed by their number in the position list. It’s a bit like sewing together a quilt. If you want to make a single four-point poly at (0,0,0), (0,1,0), (1,1,0), (1,0,0) on the front gridline, all you need to do is:
168
var points = new Array(0,0,0, 0,1,0, 1,1,0, 1,0,0); var groups = new Array(4,0,1,2,3); ActiveSceneRoot.AddPolygonMesh (points, groups, "newMesh")
TLFeBOOK
Experience XSI 4 In the groups array in the script above, you first enter the number 4 to describe the number of points in the polygon; then four array entries after this list the lookup indicies in the points array. So the script stitched a four-sided polygon, starting with the 0 index coordinate, then the first index, then third, and finally the fourth. Next let’s look at the case of shared points. What if two polygons share a point? All you have to do is list that index multiple times and make sure the order of the points you describe it with are spinning in the same direction as the polygon you share points with. var points = new Array(0,0,0, 0,1,0, 1,1,0, 1,0,0, 2,1,0, 2,0,0); var groups = new Array(4,0,1,2,3, 4,3,2,4,5); ActiveSceneRoot.AddPolygonMesh (points, groups, "newMesh")
That’s all there is to it. The shared edges are defined by using the points over again in different polygons. All you need to do in order to make meshes is to get good at making little quilting programs that figure out where the mesh points are placed and how to group them together. Let’s take all of the experiments you’ve already done in dividing up a curve and make an extrude tool. To keep things simple again, keep with the assumption that you drew the selected curve in the top view and are extruding y up. In fact this isn’t difficult at all to get the result shown in Figure 6.17:
Figure 6.17 A simple extrude tool
6. Scripting in XSI
var height = 1; subdivision = 30; var points = new Array; var groups = new Array; var myCurve = Selection(0).ActivePrimitive.Geometry.Curves(0); for(i=0; i <= subdivision; i++){ var perc = (i/subdivision) * 100; var pos = myCurve.EvaluatePositionFromPercentage(perc).toArray(); points.push(pos[0].x); points.push(pos[0].y); points.push(pos[0].z); points.push(pos[0].x ); points.push(pos[0].y + height); points.push(pos[0].z); if (i != 0){ groups.push(4); groups.push(i*2 - 2); groups.push(i*2 - 1); groups.push(i*2 + 1); groups.push(i*2); } } ActiveSceneRoot.AddPolygonMesh (points, groups, "newMesh")
169 TLFeBOOK
Experience XSI 4 That’s it. The script starts figuring out the positions and doesn’t start grouping polys until the second time through the loop, always making the rectangles starting with the positions from the last loop. Just be a little bit fussy about what numbers are running through the loop, feeding the EvaluatePositionFromPercentage a number between 0 and 100, and making sure the group’s pointing to the right point indices. I hope that after making the script above, you can understand why I’ve spent so much time on ways to span and interpolate space. A 3D program is mostly a bunch of tricks that interpolate animation values, points on surfaces, hair and volume shaders, and so on. 3D is a big, empty world and a large part of the magic of scripting (and 3D programming in general) is learning how to fill it.
Creating User Interfaces One major aspect of 3D that I haven’t touched on at all so far is the question of interface. So far, any time you’ve wanted to set a value you just did it in a variable at the beginning of script, which is what you do when roughing out a design. But in 3D, most tasks (making a face, for example) are just too complicated to figure out that generally, and a smart way to approach 3D problems is to provide as much interface as possible. Describing all the different ways and details of making user interfaces in XSI could take a whole chapter or more. But let’s go over some of the basics so that you can get started collecting information from people using your tools.
Making Sliders
6. Scripting in XSI
The most basic tool for collecting information with the sliders in XSI is called the custom parameter. First make a custom parameter set (a blank dialogue page) and then the slider (shown in Figure 6.18), like this: var pset = ActiveSceneRoot.AddProperty( "CustomProperty", false, "myTool" ) ; var num = pset.AddParameter3( "number", siInt4, 3 ) ; InspectObj (num);
You stuck the parameters set (i.e. a new dialog box) under the scene root, calling it myTool. The InspectObj line pops up the dialog box, and the siInt4 just told it you wanted an integer. If you run this over and over you’ll see that it’s adding a huge pile of sliders under the scene root.
Figure 6.18 A simple slider
If you close the slider, it doesn’t go away—it’s grafted onto the scene root and you can re-open it whenever you want. This is great for complex tools that you want around for a while, but for simple scripts you’ll often want to pop up a dialog box, get some information, and run your script. To do this, replace the InspectObj line above with: InspectObj (num, null, null, "siModal");
When you inspect a dialog box in “siModel” mode it creates it with OK and Cancel buttons. If you hit Cancel you will see that the InspectObj line in the Script Editor is highlighted red as it errors; to detect whether the button pressed was Cancel and clean up properly, you have to do some error checking. Here’s an example that uses model dialogs and makes a user-defined number of cubes, shown in Figure 6.19:
170 TLFeBOOK
Experience XSI 4 makeCubes() /*-------------------------------Make Cubes --------------------------------*/ function makeCubes(){ var num = getUI(); if(!num){return} for(i=0;i
Figure 6.19 A model slider
Formatting The next stage of UI is formatting. For example, if you wanted to have two sliders grouped on the same line, you could use: var pset = ActiveSceneRoot.AddProperty( "CustomProperty", false, "myTool" ) ; var fingers = pset.AddParameter3( "finger number", siInt4, 3 ) ; var toes = pset.AddParameter3( "toe number", siInt4, 3 ) ; var layout = pset.PPGLayout layout.Clear() ; layout.AddRow(); var item1 = layout.AddItem( "finger_number") ; var item2 = layout.AddItem( "toe_number") ; layout.EndRow(); InspectObj (pset);
6. Scripting in XSI
The JScript command try attempts the InspectObj, and if it gets an error message back (that is, you canceled), then the catch(e) line exits the function. Once you start doing UI, you really want to make sure you are using functions and doing proper error checking—at this point you are past the prototyping stage.
171 TLFeBOOK
Experience XSI 4 You can see even that after you add those parameters, scripting was instructed to wipe out how it was being displayed (with layout.Clear) and defined where you wanted rows. You may have noticed the green divots on the slider; these are for keying, but they are not useful for the UI display. You can get rid of them (as shown in Figure 6.20) by adding the following lines: toes.Animatable = false; fingers.Animatable = false;
right after you make the toe parameters. Creating combo boxes is also straightforward:
Figure 6.20 Grouping parameters
var pset = ActiveSceneRoot.AddProperty( "CustomProperty", false, "myTool" ) ; var hands = pset.AddParameter3( "type", siInt4, 0) ; hands.Animatable = false; var layout = pset.PPGLayout var difHands = Array( "Toon", 0, "Human", 1, "Alien", 2) var item1 = layout.AddEnumControl("type", difHands, siControlCombo ); item1.Label = "Hand Type" ; InspectObj (pset);
Logic
6. Scripting in XSI
Let’s say that in the example of the combo box for the hands given above, you wanted to put some logic into the UI. What if you know a toon hand has three fingers and a human has five, but when someone switches to the Alien option another set of sliders appears below? To do that, you have to use some new methods and add logic.
172
First let’s do an example where changing the combo calls a logmessage: var pset = ActiveSceneRoot.AddProperty( "CustomProperty", false, "myTool" ) ; var hands = pset.AddParameter3( "handtype", siInt4, 0) ; var layout = pset.PPGLayout layout.Logic = handtype_OnChanged.toString(); layout.Language = "JScript" ; var difHands = Array( "Toon", 0, "Human", 1, "Alien", 2) var item1 = layout.AddEnumControl("handtype", difHands, siControlCombo ); item1.Label = "Hand Type" ; InspectObj (pset); function handtype_OnChanged(){ logmessage ("Combo was changed"); }
You can see that the layout.Logic line has converted a function on your script into a piece of code run in your dialog box. This “callback” function is triggered by a change in the dialog box. The only thing to be aware of is that you can’t really pass variables to the functions (except by hiding the data under the scene root) but variables have full access to the scene just like regular scripts. The result is shown in Figure 6.21. TLFeBOOK
Experience XSI 4 var pset = ActiveSceneRoot.AddProperty( "CustomProperty", false, "myTool" ) ; var hands = pset.AddParameter3( "handtype", siInt4, 0) ; var fingers = pset.AddParameter3( "fingerNumber", siInt4, 3 ) ; hands.Animatable = false; fingers.Animatable = false; var layout = pset.PPGLayout layout.Logic = OnInit.toString() + handtype_OnChanged.toString(); layout.Language = "JScript" ; InspectObj (pset); function OnInit(){ handtype_OnChanged() } function handtype_OnChanged(){ var layout = PSet.Inspected(0).PPGLayout ; layout.Clear() var difHands = Array( "Toon", 0, "Human", 1, "Alien", 2) var item1 = layout.AddEnumControl("handtype", difHands, siControlCombo ); item1.Label = "Hand Type" ; if(handtype.value == 2){ var item2 = layout.AddItem( "fingerNumber" ) ; item2.Label = "Finger Number" ; } PSet.Refresh() ; }
Figure 6.21 A combo box layout with logic
By running this, you will be able to see that the dialog is drawn every time you change the combo box, and that when you have an alien hand you can adjust the number of fingers as shown in Figure 6.21. The layout and redraw are all done in the handtype_OnChanged function. None of the layout was done in the main script; instead, the same layout was called when opening the dialog up using the OnInit() function.
In XSI 4.0 there are two great new UI types that you can take advantage of. The first is custom fcurves, which is a great UI tool for anything that has a distribution over space or length, like roll division on a tentacle or the varying length of a row of teeth. var oPSet = ActiveSceneRoot.AddProperty( "CustomProperty", false, "testFcurve" ) ; oPSet.AddFCurveParameter( "Curve" ) ; inspectObj(oPSet);
You can inspect the fcurve source like this: var oPSet = ActiveSceneRoot.AddProperty( "CustomProperty", false, "testFcurve" ) ; oPSet.AddFCurveParameter( "Curve" ) ; inspectObj(oPSet); var fCurve = oPSet.Curve.Value; var cube = CreatePrim("Cube", "MeshSurface", null, null); var dups = Duplicate("cube", 15, 2, 1, 1, 0, 0, 1, 0, 1); dups.add(cube); var trans = XSIMath.CreateTransform();
6. Scripting in XSI
Advanced UI
173 TLFeBOOK
Experience XSI 4 for(i=0;i< dups.count;i++){ var perc = (i/(dups.count-1))*100; var height = fCurve.Eval(perc); trans.SetTranslationFromValues (8*i,height,0) dups(i).Kinematics.Global.Transform = trans; }
Finally, the new 2D Grid Data is extremely useful for doing spreadsheet-type layouts and setting up two-dimensional arrays in JScript. You can find more details in the Scripting Help under “GridData.”
Summary For beginning scripters, the trick is to approach scripting as a simple list of instructions and get used to making small changes in the command arguments. For the intermediate users the first hurdle is to understand arrays, collections, and object-oriented scripting. Once you start writing graphics tools, it is useful to see a problem as a series of atomic 3D tasks that make use of the math library. Finally, constructing tool UIs is a matter of getting used to the syntax of adding sliders and adjusting the layout.
6. Scripting in XSI
Scripting can do many things in XSI that I could not cover in the confines of this book: events, relationship programming at an interface layout level, scripted operators, synoptics, interfacing with files and other programs, and so on. However, having a grasp on how to think and problem-solve in the manner covered in this chapter will make those areas easier to work within when the time comes.
174 TLFeBOOK
Experience Experience XSI 4
Lighting, Rendering, and Compositing Your Character omputer animation software has revolutionized the process of creating dramatic images. With the help of a computer and a full-featured software like XSI, you can now realize worlds that before existed only in the imagination. In this chapter I’ll discuss the importance of lighting and show you how to use lighting in the rendering and compositing process. I’ll cover many of the different types of lights available in XSI and show you how to use them. I’ll also discuss different ways to match your background plate using various lighting techniques.
C
I will also go over different techniques of rendering, from Raytracing to Scanline, and I’ll discuss Global Illumination, Final Gathering, and Caustics, and how these rendering techniques can enhance your scene. Finally, you’ll take the character you built, light it, and render out different passes that can then be composited together into your background using the FX Tree (see Figure 7.1).
Lighting Overview Lighting in the movie industry was influenced by the Old Masters. These great painters used lighting to create images that possessed incredible depth of feeling. From the composition of the light to the color and intensity, great painters used light to influence their audience. Today’s film artists are continuing the legacy. Scenes in movies can create a tremendous emotional impact on audiences through the use of light. In most situations, filmmakers use light in three different ways: as key, fill, and rim (see Figure 7.2). These terms represent aspects of natural light that artists try to reproduce and even enhance to dramatic effect. The key light is the dominant light in the scene. It can represent the sun or any other bright light. The fill light helps soften and extend the key light and is usually the dimmest of all the lights. The rim light defines the edge of your subject so that the dark, shadowed areas around the edge are not lost in the background (see Figure 7.3).
7. Lighting, Rendering, and Compositing Your Character
chapter 7
175 TLFeBOOK
7. Lighting, Rendering, and Compositing Your Character
Experience XSI 4
176
Figure 7.1 Example of a character lit, rendered, and composited
TLFeBOOK
Experience XSI 4
Figure 7.3 Rendering using the key, fill, and rim lights Lighting in computer animation is vision. When you create a scene, the lighting you use creates the visual experience for the viewer (see Figure 7.4). Movie-makers manipulate light, animators create it. It’s important to realize that you are controlling the visual aspect of your audience’s experience. A quick and easy way to view the lights in your scene is to use the Render Region in XSI. This is a great tool To achieve more accurate control over the lighting in your scene, you should for quickly previewing any modifications to your have a proper understanding of the illumination within your scene, whether you lights, effects, or any objects that have a material or shot it on film or built it inside the computer. If the scene was shot on film, make texture that can’t be viewed in OpenGL. To use the note of where the key light is in the scene and where any other lights or lighting Render Region, hold down the Q key on your keyboard source, including bounce cards (a white card that bounces light back on the and, with the left mouse button, drag the cursor subject), may be. across the area of the screen you would like to preview. If you need to increase the resolution or the Keeping track of the light is much easier if you’re on set while the plates (a aliasing of your render, you will see a small blue box background filmed for the later addition of an element) are being shot, but in on the upper-right-hand side of the region. This is the some situations you won’t have this luxury and if no one from set has made the Resolution Slider. Sliding up increases the resolution, proper lighting assessment, it will be up to you to really examine the shots and sliding down decreases it. ensure the accuracy of the lighting configuration. If it is a scene that is entirely built within the computer, then you have total control over the lights.
7. Lighting, Rendering, and Compositing Your Character
Figure 7.2 Example of using key, fill, and rim lights
177 TLFeBOOK
7. Lighting, Rendering, and Compositing Your Character
Experience XSI 4
178
Lighting in XSI is much like lighting in the real world. The light casts rays that illuminate the scene or an object at which the light is pointing. The light will cast shadows in the scene (if shadowing is enabled) and can also be made to bounce off other objects, casting light in many different directions. The intensity or color of the light can also be changed.
Different Types of Lights in XSI There are many different types of lights in XSI, and each light has a unique function. When you open an XSI scene, there is a light already present. If you view the scene elements in Explorer (hot key 8), you will notice that there is a small capital H over the Light icon; this means that the light is hidden. If you want to see the light, you must select the Light icon, then hit the H key on your keyboard. This default light is the Infinite light. This light is best used as sunlight, and you can delete it and add a different light to suit your purpose.
Figure 7.4 Example of dramatic lighting on our creature
Infinite light simulates light that’s far from the subject. The position of the light cannot change, only the direction the rays are being cast in. Figure 7.5 shows an example of Infinite light. The Light Box simulates a light defused with a white fabric, much like a studio light. Figure 7.6 shows an example of the Light Box. The Neon light simulates a real-world neon light. Figure 7.7 shows an example of it.
Figure 7.5 The Infinite light in XSI
Figure 7.6 Example of the Light Box
TLFeBOOK
Experience XSI 4
Figure 7.8 Example of the Point light
Figure 7.9 Example of the Spot light
The Point light casts rays in all directions from the position of the light and is more like a light bulb. Figure 7.8 shows an example of the Point light. The Spot light illuminates light in a cone shape, simulating a spotlight. See Figure 7.9 for an example.
Setting Ambience for Your Scene Ambience is the overall contrast of your scene. This applies to all objects within the scene. Ambience works with the light of the scene to enhance shadows or diffuse color. When you are matching an effect to the real world light of filmed material, the ambient feature allows you to match the nuanced look of real light. The Ambience property page can be found in the Render panel on the left side of the screen under Modify > Ambience. The default value is .2. If you decrease the Ambience setting to 0, then the entire scene will have more contrast (see Figure 7.10).
You will notice the RGB (red, green, blue) sliders in any of the property pages where you have the option to change the color intensity. These values can be changed or adjusted by moving the individual sliders left or right. You can move all of the sliders at once, thereby keeping all of the color values the same but changing the intensity of the light, by holding down the Ctrl key on your keyboard and using the left mouse button to slide left or right.
If you increase the Ambience setting to 1, then the entire scene will have less contrast (see Figure 7.11).
Using Volumic and Lens Flares for Lighting FX Volumic is an effect that can be applied to a light to make it glow or cast rays. It is one of the Volume shaders, and it is easy to apply. To do so, first select the light, then in the Render toolbar, select Get > Property > Volumic; the Volumic property page (see Figure 7.12) will open. Changing some of the Reflectance values will increase the intensity of the glow. If you enable the shadows, then the light will cast shadows off any object that is blocking the light.
7. Lighting, Rendering, and Compositing Your Character
Figure 7.7 Example of the Neon light
179 TLFeBOOK
7. Lighting, Rendering, and Compositing Your Character
Experience XSI 4
180
Figure 7.10 Example of Ambience settings at 0
Figure 7.12 Appling Volumic to your light
To break up the light rays, enable Shards. Shards will add breaks in the light, adding a realistic look to the effect. Another way to break up the light rays while having more control is to use a grid that has an alpha-transparent texture, such as leaves or branches from a tree, applied to it (see Figure 7.13). Make sure that you enable the transparency from the property page. Otherwise, light rays will not be cast through any object, even with a transparent material applied to it. This is the default mode of the program. Volumetric lighting effects work well with a Spot light (see Figure 7.14). To achieve a glow like that from a light bulb or the sun, it’s best to use a Point light with Volumic applied to it, as in Figure 7.15.
Figure 7.11 Example of Ambience settings at .1
A lens flare is an artifact of traditional filming. A lens flare occurs when the camera passes at an angle before a light source and creates the effect of a sunburst or ring in the scene. The human eye doesn’t perceive these light rings but the camera does, making the lens flare a subtle effect that you can add to your scene in XSI to
TLFeBOOK
Experience XSI 4
Figure 7.15 Example of Volumic lighting effect from a Point light
mimic a film-like quality. Despite the fact that some camera operators would like to eliminate the artifact, audiences are accustomed to seeing the effect, and you can exploit that expectation to enhance your work. Lens flares can be applied to a light in XSI in the same way Volumic is applied. There are many different styles of lens flares in XSI (see Figure 7.16 for an example); you can apply the flares or change the type you’re using via the Flare tab under the Flare file (see Figure 7.17).
Basic Light Adjustments Let’s look at how to do some basic light adjustments. First get a Spot light under any of the panels under Get > Light, or under Light on the Main menu bar at the top of the screen. Now select Spot light; the light’s property page will open (see Figure 7.18). Figure 7.14 Example of Volumic lighting effect from a Spot light
The Spot light property page offers many options for adjusting your light. At the top of the page there are tabs called General, Shadow Map, Area, and Photon. At the
7. Lighting, Rendering, and Compositing Your Character
Figure 7.13 Example of Volumic lighting effect with shadows from alpha-transparent textures
181 TLFeBOOK
7. Lighting, Rendering, and Compositing Your Character
Experience XSI 4
182
Figure 7.16 Example of a lens flare in XSI
Figure 7.18 Lights property page
top of the General page is the Cone Angle option. This option changes the overall size of the cone of light. To see the cone in wire frame without having to render out an image, click on the eye icon at the top-middle of any of the view ports. This opens up a list of elements that can be made visible within your scene. If there is no check next to an element, then that element will not be visible in that view port. Place a check next to Cones, found near the bottom. Now you can see the wire frame cone of your Spot light, and when you make changes to the cone angle, the change will be visible. Returning to the light’s property page, halfway down is the Spread Angle option. This is for the inner cone, which represents the start of the light’s falloff point. The outer cone is the end falloff point. By adjusting the spread angle, you can change the inner cone of the light. This means that the most intense portion of the light will stop where you indicate.
Figure 7.17 Example of Flare properties
Above the Spread Angle option are the Color and Intensity of the light options. Color is the RGB; this can be changed or adjusted by moving any of the sliders left or right. The Intensity option controls how bright the light is. The higher the number, the brighter the light.
TLFeBOOK
Experience XSI 4
Now click on the Area tab and enable area lights by placing a check next to it. This will give the shadows of your light a more realistic appearance, with a softer falloff from the object; it will also give the shadows a darker appearance where two objects are touching. This is known as a contact shadow. Getting the shadow effect right in the scene is another way to create a subtle, life-like appearance in your work. Samples, under area lights, controls the resolution of the Area Light; Scaling, under Sampling, will give you different effects. Scaling up will help diffuse and soften the light and scaling down will sharpen the light.
Watch for question mark icons in XSI property pages. Click on these icons to access additional information about the tool you’re using.
Figure 7.19 Getting the scene for lighting
There are many other adjustments you can make to the properties of the lights, some of which I’ll cover later. For now, let’s move on to setting up lights for the character you built earlier.
Setting Up Lights for Your Character Lighting for a scene in XSI can be achieved in many different ways and with many different types of lights. There are no set rules for lighting. How to achieve the look or technique for lighting your scene is up to you. To help you better understand how to set up lights for a scene, let’s run through some exercises. First, get the character you built and textured in previous chapters (see Figure 7.19). Open the scene called walk_cycle_edited. Make sure that the window you’re in is the camera’s view; if it isn’t, change it to Camera view under the view port menu, found at the top left-hand side of the view port. Once you achieve the camera view, adjust the camera to see your character better. Next get a primitive sphere by selecting from the Render toolbar, Get > Primitive > Surface > Sphere (see Figure 7.20).
Figure 7.20 Getting a primitive sphere
7. Lighting, Rendering, and Compositing Your Character
In the middle of the Lights property page, under the Spread Angle option, are the Shadows options. To see shadows being cast from one object to another, enable Shadows by checking the Enable box. The Umbra option controls how dark the shadows will be. The lower the number, the darker the shadow.
183 TLFeBOOK
7. Lighting, Rendering, and Compositing Your Character
Experience XSI 4
184
Now, in the Sphere’s property page to the right of Radius, scale the sphere up to 100 (see figure 7.21). You will use this sphere as your background, for reflection, and as an ambient light source. Next we will add a constant material to the sphere. Go to Render > Get > Material > Constant (see Figure 7.22). These materials, when applied, will always illuminate the object they are applied to, even without a light in the scene. On the property page under the Illumination tab, change the RGB to white by holding down the Ctrl key on your keyboard and advancing the sliders to the right until all of the sliders have a value of 1. Alternatively, you can type 1 in all of the sliders. After you have applied your material to the sphere, it’s time to add a texture. You can find textures under Render > Get > Texture > Image. This opens the texture property page. Click on New in the Texture Projection area. This will access a pull-down menu. Give the texture a spherical projection by clicking Spherical (see Figure 7.23). You will notice that SphericalXY now appears next to Texture Projection.
Figure 7.22 Appling a constant material
Figure 7.21 Adjusting the sphere’s radius
Figure 7.23 Applying a texture coordinate
TLFeBOOK
Experience XSI 4
7. Lighting, Rendering, and Compositing Your Character
Figure 7.24 Example of using an HDR map on a reflective surface
Using HDR Maps You need an image to place in the sphere. This image, called Spherical_HDR_Background, should be downloaded from the Web site. Download the image into the Pictures folder you created in Chapter 1. Unlike normal image formats taken by the standard methods of photography, HDR, which stands for High Dynamic Range, is a format that has multiple exposures compressed into one image. This gives the image a better accuracy in mimicking realworld lighting (see Figure 7.24). Now get your image (see Figure 7.25). At the top of the Image property page, next to Image, click on New > New From File > Pictures > Spherical_HDR_Background. Turn off the visibility (see Figure 7.26) of the primary rays and the shadows of the sphere: 1. With the sphere selected, hit the 8 key on your keyboard to open the Explorer.
Figure 7.25 Getting your HDR map
185 TLFeBOOK
7. Lighting, Rendering, and Compositing Your Character
Experience XSI 4
186
2. With the cursor over the Explorer window, hit the F key on your keyboard. This frames what’s selected—in this case, the sphere. 3. Now click the + sign next to the word sphere in the Explorer. This expands its properties. 4. Double-click on Visibility. The Visibility property page will open. 5. In the Visibility property page, uncheck Primary Rays. This makes the object invisible when rendered, but with Secondary Rays on, the reflections are visible onto other objects. That’s what you want. 6. Next uncheck Shadows. This will ensure that the sphere doesn’t clip any lights from the scene. 7. Uncheck View Visibility. Now you’ll be able to see your Rotoscope image.
Matching the Rotoscope to Your Lighting Now let’s get your Rotoscope image. This will be the image to which you’ll match your lights and ultimately use as your background. Rotoscope is the process of putting video or film images in the background of your scene. Rotoscope can be used to match lighting or camera angles, track shots, or trace from for modeling or moving images. To get a Rotoscope image, look for the Display Type menu in the top-right corner of any view port. Whatever view you are on will be indicated by its name in the field. Click on the field to maximize the menu, then click Rotoscope (see Figure 7.27). This opens the Rotoscope property page, which you will use to input your image.
Figure 7.26 Turning off the visibility
First find the image, called Background_Image, on the Web site and then download it into the Pictures folder from the project you completed in Chapter 1 (see Figure 7.28). Next, in the Rotoscope property page click on Image > New > New From File > Pictures > Background_Image. Now you will see the image in the background of the view port. You can rotate and pan the camera to better line up your character with the image. Set up your interface to be more efficient by horizontally maximizing the top view port (the camera view with your Rotoscope), and then set the bottom-left view port as a user window in Hidden Line. Turn the view port to the right into a property editor. Figure 7.27 Accessing a Rotoscope view
TLFeBOOK
Experience XSI 4
You will most likely have to reposition your character to line up better with your image. If you’re not sure about the proper angle of the camera, you should get a primitive grid and line it up to the horizon of the image.
Now get a point light, and, in the User window, translate the light to the left of the screen, as shown in Figure 7.30. This is just a rough position to start with. This light will represent the key light, which in this case simulates the sun. I rename lights to keep them better organized. To rename your light, open the Explorer window (hot key 8) then right-click on the word Point. A list of commands will appear. Click on Rename and type in Key.
Figure 7.28 Getting the background image
Next Enable Shadows in the Light property editor, set the Umbra to 0.1 and the Intensity to 1. Now preview the lighting by holding down the Q key on your keyboard and dragging the cursor across the top view port. You can increase the resolution of the preview by using the slider to the right of the region. As you can see in Figure 7.31, you’ll need to add more lights to your scene. 1. Get another point light and name this light Fill. 2. Change the color of the light in RGB to 0.532, 0.685, and 0.800, respectively. 3. Set the Intensity to 0.399, enable Shadows, and set the Umbra to 0.178. 4. Finally, translate the light over to the upper-right of the scene in order to simulate ambient light from the sky (see Figure 7.32).
7. Lighting, Rendering, and Compositing Your Character
As you can see, the character is spilling over the background image; to fix this, the camera must be adjusted to the same ratio as the image. Click on the Camera icon at the top of your camera view port. Next, click on Properties and change the Pict. Ratio setting to 1.924, the Pixel Ratio setting to 1, and the Field of View Angle setting to 19. The camera will now be set to the same ratio as the image (see Figure 7.29).
Now duplicate the Fill light and rename it Rim, then translate it to the upper-back of the character. This is to simulate more light from the sky (see Figure 7.33). Figure 7.29 Changing your cameras settings
187 TLFeBOOK
7. Lighting, Rendering, and Compositing Your Character
Experience XSI 4
188
Figure 7.30 Getting a light
Figure 7.32 Previewing adjustments to the Fill light
Figure 7.31 Previewing adjustments to the Key light
Figure 7.33 Previewing adjustments to the Rim light
TLFeBOOK
Experience XSI 4
1. Get a Point light and change the RGB to 0.359, 0.414, and 0.340, respectively. 2. Set the Intensity to 0.287, and enable Shadows. 3. Translate the light to a position below the character. When you preview your render, you will notice that the shadows have hard edges. You can soften them by enabling area lights, which you’ll do before your final render. 4. Adjust the positioning of your lights. Try to match the image in Figure 7.33. 5. Save this scene as Lighting.
Using the Light Rig from Image Feature
Figure 7.34 Previewing adjustments to the Bounce light
Before we move on to the rendering process, I should briefly talk about using the Light Rig from Image feature, which you can find at the bottom of the Light menu (see Figure 7.35). You can use the Light Rig from Image feature to generate a simulation of the lights from an HDR or PIC file image. The lights that are created from the image will mimic the color, intensity, and direction of the lights from the original image. In some lighting situations, such as scenes with multiple set lights, Light Rig from Image can be a fast and helpful tool.
Rendering Overview Rendering is the process of bringing all the elements of your scene—lighting, textures, and effects—together. You can render either single frames or a sequence of frames from an animation. Rendering can be looked at as similar to developing film. When you render a scene, the camera is the “eye” through which the elements come together. Much as in real-world photography, XSI cameras utilize many styles of lenses— from telephoto to wide-angle. This flexibility comes in handy when you’re trying to place a character in a scene that was shot on film. With XSI, you can match the
Figure 7.35 Example of using the Light Rig from Image tool
7. Lighting, Rendering, and Compositing Your Character
The last light you’ll add is similar to a bounce light, which imitates the bounce of light off of the ground (see Figure 7.34).
189 TLFeBOOK
7. Lighting, Rendering, and Compositing Your Character
Experience XSI 4
190
lens that was used during real-world shooting, creating a seamless transition between real life and your creation. Using the cameras, lenses, and shaders in XSI, you can render your scene in as many different styles as you like, from film-like realism to the surrealism of cartoons. Rendering can be done in one pass (or element of a scene) or it can be done in multiple passes. Some commonly used passes are highlights, shadows, specular and reflection. There are also many different techniques for rendering, from Scanline and Raytracing to Global Illumination, Final Gathering, and Caustics. All of these various passes and rendering techniques will be covered in this section, along with instructions on setting up and adjusting your render options. Additionally, I will show you how to render-separate passes of your character that you will composite together using the FX Tree. Rendering in XSI is a blend of art and technology. By understanding the basic tools available, you can go wherever your imagination takes you.
Figure 7.36 Example of Raytracing rendering
Different Rendering Techniques Rendering can be done in many different ways, using many different techniques. What’s great about the rendering process—as with many of the other processes in XSI—is that there are no set rules; it’s up to you to decide what will work best for what you’re trying to achieve. For instance, if you have a scene with many colors in it, you may or may not want to add colored lights to mimic the colors. If not, you might want to use the Final Gathering tool, which takes an image—and the color and intensity of that image—and projects it back onto your object. The ways in which you can achieve your rendering goal are almost limitless. Let’s look at some of the basic techniques.
Raytracing Raytracing is a process of rendering in which rays are reflected and refracted and shadows are calculated from objects, giving your render a realistic appearance (see Figure 7.36). Raytracing is the default rendering mode in XSI. To change the Raytracing settings or to change to another method for rendering, go to the Options menu found under Render > Render > Options and click on the Optimization tab. See Figure 7.37 for the Raytracing options.
Figure 7.37 Example of Raytracing options
TLFeBOOK
Experience XSI 4
7. Lighting, Rendering, and Compositing Your Character
Scanline Scanline is another mode for rendering; it is used by default with Raytracing, If Raytracing is de-activated, then XSI will render only using Scanline (see Figure 7.38). Using only Scanline will increase the speed of your renders, but Scanline alone cannot calculate the reflection or the refraction of objects. It also can’t calculate shadows unless you use Shadow Maps (for a detailed explanation of Shadow Maps or any other features of rendering, access the question mark at the top of the Render Options property page), which are not as accurate as the Raytracing shadows, but in some situations they serve the same purpose. Scanline is also found under the Render Options on the Optimization tab, above Raytracing. If you want to enable shadows using Scanline, click on the Shadows tab. You will also have to enable the lights you want to cast shadows from; the options to do so are found in the Lights property page on the Shadow Map tab. See figure 7.39 for the Scanline options.
Figure 7.38 Example of Scanline rendering
Global Illumination Global Illumination is a rendering process wherein light rays emit photons that bounce off objects, projecting the color and intensity of the light source onto other objects in the scene (see Figure 7.40). Using Global Illumination can be somewhat render-intensive but the effect is as close to real-world lighting as you can get in the CG world. To use Global Illumination, you must enable your objects and lights within your scene to transmit or receive it. With your object selected, click the Selection button above Transform on the right side toolbar, then click Visibility. This opens a property page. Under Global Illumination, put a check next to Transmitters and Receivers (Figure 7.41). To enable your lights, go to the property page of the particular light. Under the Photon tab check Global Illumination (see Figure 7.42). Finally, enable Global Illumination under the Photon tab of the Render Options property page (see Figure 7.43).
Final Gathering Final Gathering is faster than Global Illumination at providing a realistic rendering (see Figure 7.44). Final Gathering uses the object’s material and textures to illuminate the scene, without using the light’s photons. To use Final Gathering, you need at least one light that has its RGB at 0 and an object within the scene that has a material with an ambient color at a very low number. Then enable Final Gathering under the Photon tab of the Render Options property page. See figure 7.45 for Final Gatherings options.
Figure 7.39 Example of Scanline options
191 TLFeBOOK
7. Lighting, Rendering, and Compositing Your Character
Experience XSI 4
192
Figure 7.41 Checking Global Illumination in the Visibility property page
Figure 7.42 Checking Global Illumination in the Render Options property page
Figure 7.40 Example of Global Illumination
Figure 7.43 Checking Global Illumination in the Lights property page
Figure 7.44 Example of a Final Gathering render
Figure 7.45 The Final Gathering options
TLFeBOOK
Experience XSI 4
Caustics uses light to emit photons through transparent or translucent objects. The light, now refracted, generates a distorted light that is projected onto other objects (see Figure 7.46). Caustics can create a similar effect with objects that reflect light, such as water or metal.
Figure 7.47 Checking Caustics in the Visibility property page
To use Caustics, follow the same pattern as Global Illumination, the only difference is that you enable Caustics instead of Global Illumination (see Figures 7.47, 7.48, and 7.49).
Setting Up a Render for Your Character
Figure 7.46 Example of a Caustics render
Now let’s get the scene, called Lighting, that you lit earlier. The lights in the scene must be enhanced to ensure the best result and accurate blend into the background. This will make it easier when you render all of your passes and want to composite them all together without having to make too many adjustments. First enable the area lights, starting with the Key light. 1. Click the light’s property page Area tab. 2. Place a check next to Area Light to enable it, and select Sphere from the Geometry drop-down menu. 4. Under Samples, type 9 in both U and V. 5. Under Area Transformation, change the Scaling values to 5. Now, when you preview the image, you will notice that the shadows from the Key light look more natural, but that the render time has increased (see Figure 7.50). 6. Repeat steps 1–5 for the Fill and Rim lights, but increase the Scaling in all values to 60. This will help soften the other shadows (see Figure 7.51).
Figure 7.48 Checking Caustics in the Render Options property page
Figure 7.49 Checking Caustics in the Lights property page
7. Lighting, Rendering, and Compositing Your Character
Caustics
193 TLFeBOOK
7. Lighting, Rendering, and Compositing Your Character
Experience XSI 4
194
In this exercise you will only render one frame. As the character has animation on it, you can enable Motion Blur, giving the character the appearance of motion. As you’re using the Render Region to preview all of your setting changes, go ahead and enable Motion Blur in the Render Region Options (see Figure 7.52). 1. Click on Render > Region > Options > Motion Blur.
Figure 7.50 Applying area lights to the Key light
2. Click Enable and change the Shutter Speed to 3 and the Sampling Threshold to 0.207 in all of the values. 3. Next, in the Motion Blur Controls section, click on the Motion Transformation drop-down menu and select Evaluate Motion SRT at shutter speed, and then click on the Motion Deformation drop down menu and select Consider Shape changes in Motion Blur. Keep in mind that Motion Blur is very render-intensive.
Figure 7.51 Applying area lights to the Fill and Rim light
Rendering Different Passes Passes are different layers of images from your renders that can be combined into a scene using a compositing program. You can render as many passes as you need. The main reason for rendering separate passes is to ensure the accurate blend of your elements into your background. This gives you total control over the highlights, reflections, and shadows as well as many other details that you want to enhance. When you first open a scene in XSI, a default pass, known as the Beauty Pass, is enabled. The Beauty Pass will process all of the elements of your scene when it renders. To see the Beauty pass, click on Render Toolbar > Pass > Default_Pass. View the other pass options by selecting Pass > Edit > New Pass, as shown in Figure 7.53.
Figure 7.52 Applying Motion Blur
TLFeBOOK
Experience XSI 4
The first pass you’ll render is the Beauty Pass. 1. Click on the Render button on the Render toolbar and then select Options. The Render Options property page will open (see Figure 7.54). 2. Next, click on the button called Copy Options from Region at the top of the page. All of the settings from the Region Options will be copied and applied to the Render Options. 3. Next click on the three dots to the right of Image Filename. This opens the browser showing the path the image will take to render. Make sure that this is the Render_Pictures folder of your project. Type in the name Beauty_Pass in the File Name field and click OK. 4. Next, under Frames, type 10 in both the Start and End boxes. This will ensure that you only render one frame of your animation, frame 10. You can always render the entire sequence if you like, but it is not necessary for this exercise.
Figure 7.53 Where to find passes
Now you need to copy the camera properties so that the render will be in the right format (see Figure 7.55). 1. First click on the Lock icon at the right of the Render Options property page. By locking the property page you’ll be able to open another property page at the same time. Having two pages on the screen at once makes it easy to copy from one to the other. 2. Click on the Camera icon at the top of your camera view port. 3. Next, click on Properties on the pull-down menu. When the camera’s property page opens, look under Format and right-click the number next to Pict. Ratio. The Mouse Options menu will open. 4. Select Copy, then in the Render Options property page click on the Format tab. 5. Right-click in the box next to Picture Ratio and select Paste. Make sure that the Maintain Picture Ratio under Image Resolution is checked.
7. Lighting, Rendering, and Compositing Your Character
Beauty Pass
6. Now, under Image Resolution, change the Pixel Ratio to 1. 7. Close the Camera property page and click off the Lock icon of the Render Options.
Figure 7.54 Setting up the render options for the Beauty Pass
195 TLFeBOOK
7. Lighting, Rendering, and Compositing Your Character
Experience XSI 4
196
Figure 7.56 Final Beauty Pass render
Figure 7.55 Copying the camera settings to the render settings
Now you can complete the render of your Beauty Pass. Go back to the Render Options property page and under the Output tab, click on Render Current Pass (see Figure 7.56). This is when you can take a break because the rendering process with area lights and Motion Blur on can be very render-intensive.
It is possible to speed up the render. You can go into the Optimization tab (see Figure 7.57) and increase the Memory Limit, which is the limit of RAM used for rendering, or you can adjust the BSP (Binary Space Partitioning) settings. BSP saves you time by reducing the number of computations needed to render a scene. The Raytracing Depth, Reflection, Refraction, and Maxium Ray Depth settings can all be adjusted to lower numbers in order to speed up the render, but only if they are not needed in the render. Figure 7.57 Optimizing your render
TLFeBOOK
Experience XSI 4
Now let’s render the Highlight pass. 1. First click on Edit > New Pass, then select Highlight under Pass on the Render toolbar. In the Render Options property page you will notice it says Highlight Pass. 2. Change the Picture Ratio again. You could do this as you did before on the Camera property page, but this time, instead, just click on the Back arrow at the top of the Render Options. This will take you back to the last page that was visible, the Beauty Pass. 3. Now click on the Format tab, right-click in the Picture Ratio box and copy its settings. 4. Click on the Forward arrow at the top of the property page and paste the Picture Ratio settings from the Beauty Pass into the Picture Ratio box in the Highlight Passes property page. Make sure that Maintain Picture Ratio is checked and change the Pixel Ratio to 1 (see Figure 7.58).
Figure 7.58 Setting up the render options for the Highlight Pass
Next, change the output settings. 1. First change the image filename to Highlight_Pass. 2. Then, under Frames, type 10 in both the Start and End boxes. 3. Now click on Render Current Pass. The rendering of the Highlight Pass will start. I tried to keep this exercise simple by not having you render many different passes, but if you’d like to render other passes, such as Reflection, Ambient, Defuse, or Shadows, you can do it in the same way you did with the Highlight Pass.
7. Lighting, Rendering, and Compositing Your Character
Highlight Pass
As you can see, rendering out passes is very easy and gives you more flexibility in fine-tuning your final composite image (see Figures 7.59 and 7.60). Figure 7.59 Rendering the Highlight Pass
197 TLFeBOOK
7. Lighting, Rendering, and Compositing Your Character
Experience XSI 4
198
Figure 7.60 Final Highlight Pass render
Compositing Overview Compositing is the process of bringing all the elements that you have rendered together as layers, then overlapping and blending them into a single image. Compositing is the final stage, in which all your hard work comes together.
Figure 7.61 Example of the Compositing program
Using the FX Tree to Composite Your Character XSI uses an FX Tree for the compositing process (see Figure 7.61). This section will cover the basic aspects of compositing in XSI, then take you through compositing the different passes you have just completed rendering.
FX Tree Overview The FX Tree is XSI’s compositing software, in which you bring a network of linked operators to composite and create effects for your images that have been rendered. The compositing software consists of three main parts. The first is the FX Tree, wherein a node or tree-like representation of all the elements is available (see Figure 7.62). This is basically where all of the compositing takes place. The next part of the compositing software is the FX Operator Selector. The Operator Selector is a view that lists all of the available compositing and effects operators (see Figure 7.63). Clicking on an operator displays its available inputs and outputs and what kind of image each input or output requires.
Figure 7.62 Example of the FX Tree
TLFeBOOK
Experience XSI 4
Figure 7.64 Example of the FX Viewer
Last is the FX Viewer, where you can view the results of the connections from the FX Tree and see how the operators contribute to the overall effect (see Figure 7.64).
Bringing Passes In and Rendering the Final Composite Using the FX Tree Open a new scene and let’s start compositing the passes using the FX Tree. Maximize one of the lower view ports and make it an FX Tree. Click on the arrow icon at the top of the FX Tree toolbar. This opens a browser with which you can import images. Import the background image first, as shown in Figure 7.65. Now optimize your workflow by horizontally maximizing the bottom view port and making it an FX Tree. Make the top view port an FX Viewer and also maximize it horizontally. By having the FX View on top, you can view the results of your changes to the FX Tree. Figure 7.65 Importing the first image in the FX Tree
7. Lighting, Rendering, and Compositing Your Character
Figure 7.63 Example of the FX Operator Selector
199 TLFeBOOK
7. Lighting, Rendering, and Compositing Your Character
Experience XSI 4
200
Now, in the FX Tree, import both the Beauty Pass and Highlight Pass (see Figure 7.66). By clicking on the v button on the bottom-right of any of the image nodes you can see the image in the FX Viewer. Click on Ops in the FX Tree toolbar to expand its menu. Select Composite > Over. This will drop an Over Node in the FX Tree window (see Figure 7.67). Now click on the small, red arrow on the bottom of the background image and drag it over to the green arrow at the top-left of the Over Node to connect them (see Figure 7.68). Next, do the same to the Beauty Pass, connecting it to the righthand green arrow of the Over Node. Click on the V button on the bottom-right of the Over node to view the results in the FX Viewer. Next get another Over Node and connect the first Over Node to it by connecting the red arrow of the first node to the top-left green arrow of the new node (see Figure 7.69). Then connect the Highlight Pass to the other green arrow of the new Over Node. As you continue adding and changing things, remember to click on the V button of the last node in order to view the results.
Figure 7.67 Getting an Over Node
Figure 7.66 Importing more images in the FX Tree
Figure 7.68 Connecting images to the Over Node
TLFeBOOK
Experience XSI 4
Figure 7.70 Adjusting the color of the composite
To change the color of the composite, get another node under Ops > Color Adjust > Color Correct and connect the last node to the left-hand green node of the Color Correct Node (see Figure 7.70). In this property page you can change the overall look and color of your composite. You can change the Gain or Gamma. You can also connect this node to just one of the image’s nodes, thereby affecting only that image and not the overall composite. This is a good idea when trying to match an image to a background plate when they weren’t rendered in the same colors or values. You can also add an overall grain to your composite to help take the edge off the CG look and give it a more film-like appearance (see Figure 7.71). This also works if you’re trying to match the grain of the background that was shot on film. There are many different effects that you can add in the FX Tree to enhance your composite. Once you’re happy with the results of the composite, it’s time to render the results. To do so, go to Ops > Image > File Output and connect the last node of
Figure 7.71 Adding more effects
7. Lighting, Rendering, and Compositing Your Character
Figure 7.69 Connecting the Highlight Pass to an Over Node
201 TLFeBOOK
7. Lighting, Rendering, and Compositing Your Character
Experience XSI 4 the composite to the File Output node. In this node, you can select from many different file types and choose the amount of frames you want to use to render your image. Once you’ve made and named your selection and given the file a destination, hit Render and you’re done (see Figure 7.72). The FX Tree has many features that I’m not able to cover here. Features like FX Paint, Brushes, and Painterly Effects are all worth exploring on your own.
Summary In this chapter you took a look at the many different lights and learned how to light a scene. You also got to examine the rendering process and the many different rendering techniques XSI offers. Then you took your lit scene and rendered passes that you brought into the FX Tree to composite together and apply some final effects to the completed image. This chapter, like all of the other chapters in this book, shows only a small portion of what you can do in XSI once you have some experience. By picking up some basic skills and familiarizing yourself with some of the advanced tools in XSI, you will gain the knowledge necessary to discover your potential, and bring it to life.
Figure 7.72 Rendering your composite
202 TLFeBOOK
Experience Experience XSI 4
Making Crowds and Character Logic with Behavior rogramming character behavior is a new and exciting topic in 3D. As the animation industry moves from hand animating the action of single characters to developing workflow for larger and larger multi-character scenes, choreography and the interaction of the characters’ movements becomes a major challenge.
P
XSI has many tools, such as Motion Deform and the Animation Mixer, that help you approach this problem, explicitly directing the motion of each character one after another. But another way to think about the problem is as the mass of characters as an entire group, and general instructions guide the mass of characters as an entire group. This idea of directed group motion, which is then recorded, is in many ways similar to how live action filming is done. The director (along with the script) tells all of the actors their instructions for movement and motivation and then steps back and records the process. Softimage has a product separate from XSI called Softimage|Behavior, which is solely focused on this process of directing a large group of characters through scripting and state machines. The rest of this chapter will focus on the workflow to program crowds of XSI characters in Behavior. Behavior is an event-based system where logic defines character actions, and when something changes, an event is triggered and a new action takes place. Behavior also contains a system to warp character animation to follow paths and walk over terrain. So as you assign goals and different motion blends Behavior will automatically take care of the complex details to get the animation to warp and align properly. In some ways, blending these crowd goals, obstacles and conditions for motion change is a bit like making an ant farm. Carve out the right tunnels and put food in the right place and you can control ant motion.
8. Making Crowds and Character Logic with Behavior
chapter 8
Behavior Introduction As Behavior is primarily a scripting-based event toolkit, I’ll start with a technical comparison with scripting in XSI. The rest of the chapter will focus on the workflow for preparing a character in XSI, getting it over to behavior, setting up a crowd, and rendering.
203 TLFeBOOK
Experience XSI 4
8. Making Crowds and Character Logic with Behavior
Dropping a Cube in XSI Let’s say your scripting task is to create a cube at (10,0,0) and drop it without acceleration so that every update/frame it falls .5 down. When it falls below zero, you want it to stop dropping. Simple enough. In XSI scripting you’d do this: var cube = ActiveSceneRoot.AddPrimitive("cube", "polymsh"); cube.posy = 10; var channels = new Array(); channels[0] = cube + ".kine.local.posx" channels[1] = cube + ".kine.local.posy" channels[2] = cube + ".kine.local.posz" var cString = channels.join(","); for (i=0;i<100;i++){ ActiveProject.Properties.Find("PlayControl").current = i; if (cube.posy.value < 0){break} cube.posy = cube.posy.value - .5;| SaveKey(cString, null, null, null); }
Basically you make the cube, set up a loop wherein you run through time, drop the cube each setup of the loop, and then key it into place.
Dropping a Cube in Behavior If you wanted to drop a cube in Behavior, your approach would be closer to setting up a diagram of actions and events that trigger change. First, open Behavior 1.5 or above. Next, choose File > New Project > Behavior and make a new working folder called CubeProject; this is where you’ll create your Behavior projects. The first obvious difference between XSI and Behavior is that you can’t make cubes in Behavior. Behavior is a choreography environment, but it doesn’t create content. It only instances actors. So the first thing you’ll have to do is make a cube in XSI and bring it over to Behavior as an actor.
Loading Actors in Behavior
Figure 8.1 The Behavior Exporter toolbar
Open your file system, and then, in the CubeProject > Content > Actors folder, make a new subfolder called Cube. Then open XSI and do the following: 1. Make a cube.
204
2. Make the cube a child of a null.
TLFeBOOK
Experience XSI 4 3. Put the null in a new model. 4. Select the null, open the Behavior Exporter toolbar and then choose Actor > Initialize.
This setup may seem a little awkward at first, but this process is streamlined for character hierachies, not for cubes. Let’s switch back to Behavior and click on the Import Actor button in the top left. Now if you just want to view the cube in 3D—or at any actor in Behavior—you can do so using the Viewer. Open up the Viewer by choosing Tools > Startup XSI Viewer. Then drag and drop your new cube from the file tree on the top left into the Viewer. If you experiment with the hot keys a bit you’ll see that the Viewer functionality is very similar to that of XSI; the Viewer uses the same keys to orbit, pan, translate, and rotate.
Scripting in Behavior
Figure 8.2 The Behavior Project Explorer
Now let’s start off with a simple script to place the cube at (10,0,0) like you did in XSI. The first thing to note is that Behavior uses a scripting language called Piccolo, which you can think of as a light version of JScript. The language syntax is basically the same as JavaScript, although its standard library is not as extensive. The advantage of having Piccolo is that it’s very fast and very easy to extend. To find out more about Piccolo, look in the Behavior Help under Piccolo Reference > Piccolo. The other point to note is that Behavior always starts a simulation by looking for the startup.pc file in the project and then running the lines of script in the function named main() for that file. This is similar to how a Web browser looks for an index.html page when entering a URL. To create the startup.pc file, right-click on the Piccolo folder in the Project Explorer view and select Create New Piccolo. In the dialog that pops up, enter startup.pc and click OK. The file startup.pc is created and added to the project and appears in the Project Explorer view. To open the file in the editor, select it in the view and hit Enter (or double-click). To get the cube to appear at (0,10,0), open the startup.pc file in the Piccolo editor and type the following lines of script: use constants "drive_constants"; function main() { engine.RunScript("rtk", nil); global var world = engine.GetCurrentWorld(); var cube = engine.LoadActor("cube", world); var T = cube.GetRootNode().GetGlobalTransform(); T.position.y = 10; cube.GetRootNode().SetGlobalTransform(T); }
8. Making Crowds and Character Logic with Behavior
Then export the cube into the Cube folder you made in Behavior by choosing Behavior Exporter > File > Export Actor.
You can also click Tools > Import XSI Actor to import your cube from XSI.
205 TLFeBOOK
Experience XSI 4
8. Making Crowds and Character Logic with Behavior
Once this is typed in, compile the script by clicking the Build button (or press F8). Now open the viewer and hit Play. The cube actor should appear in the viewer at location (0,10,0). You can see here that getting transforms and setting values in Behavior is not exactly the same as in XSI, but it’s pretty similar. To check the Help on scripting objects such as GetGlobalTransform work, choose Help > Contents in the Behavior main menu; this will launch the Behavior documentation—look in the API Reference book. You can also see that you have a GetCurrentWorld, which is similar to ActiveProject in XSI, and that you’ve loaded up your aactor. Your next step is to animate the cube to fall to (0,0,0).
Activities in Behavior In XSI you can explicitly create a loop and change the position of the cube through each iteration of the loop. In Behavior, this loop (called the simulation loop) is created implicitly and access to its inner workings must be obtained indirectly. On each simulation loop iteration, three things happen: a list of activities is updated with the current time of the simulation, events are handled, and the scene is rendered according to the current position and orientation of all the actors. To animate your cube, you’ll make use of an activity to tap into the loop and update the cube position. An activity is an object associated with an actor that is responsible for updating its state (that is, the position or orientation of the actor’s skeleton). There are many different kinds of activities that can be applied to an actor, each one with a different set of instructions for how to animate the actor. It’s like handing a list of goals to a robotic truck. The list has a set of instructions on how to drive and where to go, and you don’t think about it again after telling it what to do. The next time you think about it is when it tells you it’s finished or halfway through you tell it to do something else. There are many activities that can be called using the activity API library that comes with Behavior. This makes commanding the actors to do things very easy. For example, to command an actor to walk forward and track the terrain underneath it, you simply create an IkLoco activity and associate it with your actor. You then add it to the list of activities that are updated on each simulation tick, and that’s it. The simulation loop and the calls to the activity to update to the current time take care of the actual animation work. For the cube example, however, you will take a slightly more complicated approach just to make the steps more clear. Instead of using one of the built-in activities (like the 3D path activity to animate the falling cube) you will use a Piccolo activity and explicitly control the cube position through scripting. The Piccolo activity is like any other activity, except that when the activity is called to update itself to the current time, rather than calling into some C/C++ code, the activity calls into a Piccolo function callback. In this function callback, you are free to script whatever it is you want in terms of updating the position of your actor.
206 TLFeBOOK
Experience XSI 4 To get the cube to animate, make the following changes to your startup.pc file:
Rebuild the script, press Ctrl+N in the viewer (new) and press Play. You should see the cube load in, drop from a height of 10 to 0, and then stop. So what’s happened is that you’ve created a Piccolo activity for our cube actor and added it to the list of activities that are updated on each simulation tick. We also specified that the callback function for our Piccolo activity be called drop. On each simulation tick, when the activity is updated, the Piccolo function named drop is called. In the drop function you lower the height of the cube by 0.5 units on each simulation tick. Finally, when the height drops below 0, you set the status of the activity to drvACTIVITY_FINISHED, which signifies that the activity is done with its task and marks it for deletion. This stops the animation of the cube. So there you have it: dropping a cube in XSI versus dropping a cube in Behavior. In XSI you can explicitly control the playback of the animation on your characters, while in Behavior you need to use the notion of activities to control the animation of digital actors in conjunction with the simulation loop that drives the playback. Now that you know how to animate actors in Behavior, the next step is to highlight the feature in Behavior that allows you to control and direct the actors in a scene. This is the important element that makes it easy to glue the action and reaction aspects of complex crowd shots together. This feature is event handling through state machines.
Creating a Simple State Machine
8. Making Crowds and Character Logic with Behavior
use constants "drive_constants"; function main() { engine.RunScript("rtk", nil); global var world = engine.GetCurrentWorld(); var cube = engine.LoadActor("cube", world); var T = cube.GetRootNode().GetGlobalTransform(); T.position.y = 10; cube.GetRootNode().SetGlobalTransform(T); cube.AddPiccoloActivityByName("drop"); } function drop(activity, time, actor){ var gt = actor.GetRootNode().GetGlobalTransform(); gt.position.y -= 0.5; if(gt.position < 0) activity.status = drvACTVITY_FINISHED; else actor.GetRootNode().SetGlobalTransform(gt); }
A state machine is a framework for defining the state of mind of an actor. One way to think of it is as a visual tool much like a flow chart, wherein blocks are used to denote the different states that the actor has, and transitions (arrows connecting the blocks) are used to define the pathways from one state to the other with events triggering these transitions. Let’s build a simple example to illustrate how this all works.
207 TLFeBOOK
Experience XSI 4
8. Making Crowds and Character Logic with Behavior
To your cube example let’s add that we’d like the X and Z values of its position to be changed to 10 and 20, respectively, when the A key on the keyboard is pressed. You will use a state machine to drive this change. At the bottom of the main() function in your example, add the following line of script code: cube.AttachHFSM("cube_brain");
This line of script sets the state machine called cube_brain as the high-level controller for the cube actor instance. To now create the cube_brain state machine, right-click on the State Machines folder in the Project view and select Create New HFSM from the menu (see Figure 8.3). In the dialog that pops up, enter cube_brain as the name of the new state machine. Double-click on the cube_brain.hfsm item in the Project Explorer to launch the state machine editor in Behavior. Create two states, one called Wait and the other called Move, with a transition connecting the two using the A keydown event as the trigger to move from the Wait state to the Move state. Also, mark the Wait state as the start state (the initial state of the cube actor’s logic when the AttachHFSM call is made). Finally, add the following lines of script to the Move state: { var G = actor.GetRootNode().GetGlobalTransform(); G.position.x = 10; G.position.z = 20; actor.GetRootNode().SetGlobalTransform(G);
Figure 8.3 Creating a new hierarchical finite state machine
}
The new state machine is shown in Figure 8.4. When you press Play, the Piccolo activity is created and it drives the cube motion down to a height of 0. In parallel, the cube_brain state machine is created and associated with the cube actor instance. The cube state is initially the Wait state. When the A key is pressed (this can happen at any time in the simulation), the key event is sent to this state machine and triggers the transition to the Move state. The embedded script code in the Move state is then executed, the result being the cube position moving to (10,Y,20). You can see though this example that using the activity objects and state machines allows you to instruct actors to take action at a very high level—that is, you eliminate a lot of micro-managing to create the desired shot. Once activities are set in action, the management of the animation can be forgotten until a change is required. In this case, an event is used as the trigger to the move into a new state where old activities can be deleted or modified or new activities created. When you start dealing with crowds and instances of many actors interacting with one another, describing the logic of these actors at this higher level makes it possible to create some very complex interactions.
Figure 8.4 The A key state machine
208 TLFeBOOK
Experience XSI 4
Making a Crowd Shot
Preparing Actors When preparing an actor in XSI for Behavior, there are a few things you need to think about. They are as follows: ◆ How to make your character as low resolution as possible, so that it plays back quickly in a crowd. ◆ Letting Behavior know what the different parts of your character (like the feet) are, using tagging. ◆ Adding data to your locomotion animation so that Behavior knows when, say, the feet are stepping.
Simplified Character Strategy The best starting point for a low-res character is to think where to place a few transforms in order to completely describe the character hierarchy. Figure 8.5 shows the process of setting up a hierarchy with a minimal number of transforms.
Figure 8.5 Making a minimal hierarchy to describe and visually represent your character
8. Making Crowds and Character Logic with Behavior
Getting a crowd shot together in Behavior is not much more difficult than dropping a cube. There are only a few extra details on setting up the actors and setting up the behavior. The extra steps are creating a character with a skeleton, tagging some key features on the character for Behavior, creating some action clips to define how the character moves, and then exporting from XSI to Behavior.
209 TLFeBOOK
Experience XSI 4
8. Making Crowds and Character Logic with Behavior
There are two ways to go about setting up your character to transfer to Behavior. The first is to use the box hierarchies from the Character menu, and the second is if you are using a custom rig. In this case you have to build a low-res version manually.
210
To build a manual minimal hierarchy, start with your high-resolution rig and place a bunch of nulls at the key joints in XSI using Transform > Match Transform. Then take your high-resolution character mesh, reduce it with Polygon Reduction, and break it apart with Match Transform. Then set up your cutup hierarchy centers so that they exactly match your minimal null hierarchy. Parent from the center of gravity down, and if your transforms are the same as the high-res rig, then it’s simple to constrain the low-res elements onto the high-resolution rig with pose constraints and then plot off the animation. Finally, add a null at the top of the hierarchy, between the feet, and put the character in a model.
Tagging Your Character To help Behavior make sense of your character, initialize it with Behavior Exporter > Actor > Initialize (see Figure 8.6).
Figure 8.6 Initializing your actor
Next, select the feet one after another and tag them using Behavior Exporter > Node > Set Foot (see Figure 8.7). Behavior will use this information to modify the stride of the actor to have the actor track the terrain underneath as it moves. Figure 8.7 shows the foot-tagging process. In addition to setting the foot nodes, you also add to the feet collision spheres that will be used to detect contact between the foot and the terrain. Any number of collision spheres can be added to represent the contact region of the foot, as shown in Figure 8.8. The last step is to create action sources for the actor that Behavior will use to drive the motion in the simulation. For example, a walk cycle source will be used in Behavior as the basis of how the actor walks in the simulation. These sources need to be tagged with information as well; for example, contact keyframes to mark where the feet of the actor come into contact with the ground during a locomotion cycle. This
Figure 8.7 Tagging the feet on your character
TLFeBOOK
Experience XSI 4 information is automatically added when action sources are converted into Behavior skills using the Exporter tool. Figure 8.9 shows the contact curves in the Fcurve editor.
Scripting a Crowd Shot Scripting the crowd shot consists of creating a script and state machine for each actor instance in the shot to define its action and reaction. As you base the behavior description of these actors on an event-based paradigm, you can create a single set of behaviors and apply it to all of the actor instances. That is, you can create generic rules about how the actors should respond to their environment and to other actors and use that to drive the simulation. There are many different strategies you can use in creating these generic rules. Because crowds and procedural shots vary so much from shot to shot, it is difficult to anticipate all of these behaviors with pre-packaging. Instead, Behavior takes a bottom-up approach to their construction to ensure maximum flexibility. This tactic is combined with a powerful toolkit of activity APIs to simplify the actual step of getting actors to animate. The idea then is to focus time and effort in the construction of these behaviors on the higher-level when and what logic of the actors, rather than on the lower-level details of how the actors will actually accomplish the task. To illustrate these ideas, let’s create an example crowd shot of some flocking dinosaurs that transitions into a stampede. To start with, let’s create and apply the behavior to only one dinosaur actor instance and build the behavior in a generic fashion so that it can be applied to many instances.
Figure 8.8 Adding collision spheres to the feet
Figure 8.9 Contact curves for the left and right feet
The first step is to import the dinosaur actor from XSI into a Behavior project. You can then load one instance of the dinosaur actor into a scene with some hilly terrain, as shown in Figure 8.10. The dinosaur actor has one walking locomotion skill (an action source of a walking cycle). We will use this to drive its motion. To get the dinosaur flocking across the terrain, you simply add a script call to the Behavior function InitializeSimpleFlock and specify a goal for the flocking at the other end of the terrain. If you run this behavior, you’ll see the dinosaur actor walking across the terrain, as shown in Figure 8.11.
8. Making Crowds and Character Logic with Behavior
The actor can now be exported from XSI and brought into Behavior for creating crowd shots.
211 TLFeBOOK
Experience XSI 4 The beauty of the call is that you can add other instances of the dinosaur actor into the scene and without changing any scripts you can run the simulation and this time see a flock of dinosaurs crossing the terrain, as in Figure 8.12.
8. Making Crowds and Character Logic with Behavior
InitializeSimpleFlock
212
Let’s go back to the onedinosaur scene and finish the Figure 8.10 Figure 8.11 A dinosaur actor walking across the terrain Adding a dinosaur actor to a hilly terrain behavior. At some point in the simulation—say, triggered off a key being pressed—you’d like the dinosaurs to start stampeding. In this example, you don’t have a charging locomotion skill, so instead you tap into the activity framework and simply speed up the playback rate of the walk cycle. Also, with many instances in mind, you don’t want all the dinosaurs to start stampeding at once; you want to have a propagation of dinosaurs starting to stampede. The way to control this is to have each dinosaur look to the dinosaurs in front of it and when it sees that Figure 8.13 Figure 8.12 The stampede behavior A crowd of dinosaur actors walking across the terrain they are stampeding, then it, too, will start stampeding. Add some random noise to give each instance a different reaction time to this event. The state machine to control this is shown in Figure 8.13. The Wait state is the initial state of this state machine and is the holding state until the key triggering the stampede is pressed. When the key is pressed, this event triggers the transition into the Monitor state where, on a timer event, a transition into the Check state occurs. In the Check state there is script code to check for the neighbors in front of the actor running this behavior. If all of the neighbors are stampeding, then an event is posted that causes the transition into the Stampede state; otherwise, a different event is posted that causes the transition back into the Monitor state where the checking process is repeated (waiting for the next timer event). In the Stampede state, the playback rate for the walking animation is sped up by a factor of two to represent the stampeding motion.
TLFeBOOK
Experience XSI 4 Again, you can apply this same state machine to all of the actor instances in a large crowd shot and watch the simulation play out as desired (see Figure 8.14).
Once the simulation has been tuned and the resulting animation is deemed final, the last step is to render the shot. There are a number of ways in which to proceed. For small crowd shots, the motion data can be recorded in the dotXSI format and brought into XSI, where it can then be applied to reference models and rendered. In cases where there is a custom crowd-rendering pipeline, it is easy enough to write a custom output driver in Behavior using the scripting language to record the crowd motion in the necessary format for the rendering pipeline. Finally, for large crowd scenes in particular, there is a direct-to-Mental Ray pipeline from Behavior.
Figure 8.14 Stampeding dinosaurs
Let’s examine the Mental Ray pipeline with respect to rendering the dinosaur crowd shot. This rendering pipeline is very simple in that it writes out the Mental Ray MI file for each frame of the crowd shot (the MI file is the file format for describing a scene to Mental Ray for rendering). Now, rather than trying to include all of the actor data into the MI file (this would make the file ridiculously large), you make use of a geometry shader to add the actor instances into the shot during the rendering. A geometry shader is type of Mental Ray shader that feeds the mesh of one or more objects. So, in this setup, our geometry shader is transforming and placing characters in the rendering environment, and moving them with the file data generated by Behavior. Now the steps for getting the shot rendered: The first step is to create a final rendering model for the dinosaur actor that can use the motion data coming from Behavior. The easiest way to do this is to take the high-resolution mesh of the dinosaur and apply it to the Behavior version of the dinosaur. Figure 8.15 shows the final rendering model of the dinosaur (note that the joint meshes are hidden). Keep in mind that the deformers that drive the high-res mesh need the same names and transforms as the low-res mesh. Typically, the underlying structure should be the same, with mesh resolution being the main difference. This means you have to use a setup that is Behavior-compatible and can’t use scripted operators, XSI expressions, or any deformations other than enveloping. Once the final rendering model is created, export it to dotXSI (call it dino.xsi). This file will be used by the geometry shader for the description of the geometry of the dinosaur actor and will be the basis of generating the envelope of each dinosaur instance in the shot. When you set up a render script inside Behavior,
Figure 8.15 Final rendering dinosaur model
8. Making Crowds and Character Logic with Behavior
Rendering a Crowd Shot
213 TLFeBOOK
8. Making Crowds and Character Logic with Behavior
Experience XSI 4
214
you can correlate your Behavior actor and a high-res mesh contained in an .mi2 file. This same assignment script can also be used to distribute characters with different geometry and shaders randomly. The next step is to set up the shot with the camera and lighting in XSI. The background environment can be included as well. Then export the setup to an MI file (call it env.mi2). If the camera moves in the shot, then a sequence of MI files for the sequence must be created (e.g. env.0.mi2, env.1.mi2, and so on). You then load the dinosaur into the scene and export a MI file of the dinosaur (call it dino.mi2). The rendering pipeline will use these MI files to describe the Mental Ray settings for the shot. The same assignment script used to control character distribution is used to link in the environment. Figure 8.16 Final rendering dinosaur model You then run the simulation and enable the output of the MI files for each frame. Behavior will then create an MI file for each frame, combining elements from the env.mi2 file and dino.mi2 file and adding references to the geometry shader for each dinosaur instance. In addition, a separate file is created containing a snapshot of each dinosaur pose on a frame-by-frame basis.
The final step is the rendering. First place the geometry shader that goes with this pipeline in the appropriate folder where Mental Ray can find it. Then send Mental Ray the output MI file. When the file is rendered, our geometry shader is called upon to generate the geometry of each instance. The dino.xsi file is used to get the mesh description and the snapshot data for the instance is read and applied to the envelope to get the instance geometry. The material and other shading definition for the instance is taken from the dino.mi2 file. The result is the rendered image as seen in Figure 8.16.
Summary As an event system, Behavior gives you the power to throw instructions into a character’s brain and set conditions to layer or switch action. Behavior takes care of the mechanics of walking on terrain, as well as motion blending and gait switching under the hood, making it simpler to program at a high level. Getting a large number of characters calculated quickly drives the rest of the workflow, which consists of plotting your motion to low-res hierarchies and using standalone rendering techniques. TLFeBOOK
Experience Experience XSI 4
Image Gallery On the following pages you will find a gallery of some of the work I have produced in recent years.
—Aaron Sims
All images copyright Aaron Sims.
Image Gallery
The images reflect a range of approaches developed for various film projects, as well as for my personal projects.
215 TLFeBOOK
Image Gallery
Experience XSI 4
216 TLFeBOOK
Experience XSI 4
Image Gallery 217 TLFeBOOK
Image Gallery
Experience XSI 4
218 TLFeBOOK
Experience XSI 4
Image Gallery 219 TLFeBOOK
Image Gallery
Experience XSI 4
220 TLFeBOOK
Experience XSI 4
Image Gallery 221 TLFeBOOK
Image Gallery
Experience XSI 4
222 TLFeBOOK
Experience XSI 4
Image Gallery 223 TLFeBOOK
Image Gallery
Experience XSI 4
224 TLFeBOOK
Experience XSI 4
Image Gallery 225 TLFeBOOK
Image Gallery
Experience XSI 4
226 TLFeBOOK
Experience XSI 4
Image Gallery 227 TLFeBOOK
Image Gallery
Experience XSI 4
228 TLFeBOOK
Experience XSI 4
Image Gallery 229 TLFeBOOK
Image Gallery
Experience XSI 4
230 TLFeBOOK
Experience XSI 4
Image Gallery 231 TLFeBOOK
Image Gallery
Experience XSI 4
232 TLFeBOOK
Experience XSI 4
Image Gallery 233 TLFeBOOK
Image Gallery
Experience XSI 4
234 TLFeBOOK
Experience XSI 4
Image Gallery 235 TLFeBOOK
Image Gallery
Experience XSI 4
236 TLFeBOOK
Experience XSI 4
Image Gallery 237 TLFeBOOK
Image Gallery
Experience XSI 4
238 TLFeBOOK
Experience XSI 4
Image Gallery 239 TLFeBOOK
Image Gallery
Experience XSI 4
240 TLFeBOOK
Experience XSI 4
The following 3D images were created by Michael Isner, Head of Special Projects at SoftImage.
Image Gallery
Images copyright Michael Isner.
241 TLFeBOOK
Image Gallery
Experience XSI 4
242 TLFeBOOK
Experience XSI 4
Image Gallery 243 TLFeBOOK
This page intentionally left blank
TLFeBOOK
Experience Experience XSI 4
Index Symbols ? icon, 1 3D paint programs, 68–69
A
Index
activities (behavior), 206–207 actors.See characters aliasing rendering, 177 textures, 49 Alienbrain, 114 alignment (rigging), 86–87 ambient light, 179–180 ambient pass, 197 ambient values, 46–48 anatomy, 42 angles light, 182 modeling cameras, 28 design, 42 Animate toolbar, 4–5
animation Animation Editor, 129–132 Animation Mixer, 134–140 behavior activities, 206–207 actors, 204–205 loops, 206–207 overview, 203–204 Project Explorer, 205 scripting, 205–206 state, 206–207 state machines, 207–208 Consider Neighborhood, 137 crowd shots collision spheres, 210–211 geometry shader, 213 hierarchy, 209–210 Mental Ray pipeline, 213 MI files, 213 overview, 209 rendering, 213 scripting, 211–213 tagging, 210–211 walk cycles, 210–211
245 TLFeBOOK
Index
Experience XSI 4
246
curves, 132 dopesheets, 133 easing, 132 editing, 129–133 eyes, 136–140 feet, 41, 125–129 frames, 133 function curves, 129–132 interpolating curves, 132 key points, 130 keyframes, 132 applying, 118–123 Auto Key, 120–122 overview, 116–118 playback, 122 preferences, 119 property pages, 118–119 timeline, 121 keys, 136 legs, 125–129 marking sets, 124 modeling, referencing, 123 overview, 115–116 parenting, 131 playback, 133 rigging, 125–129, 131 run cycles, 129 shapes, 136–140 sliders, 124 storing, 133–140 synoptics, 123–124 timing, 133 walk cycles, 116, 124–129, 132 weighting, 129 Animation Editor, 129–132 Animation Mixer, 134–140 applying keyframes, 118–123
approximation geometry, 54 area light, 183, 193–194 arms fingers modeling design, 41 textures, 74–75 modeling, 35–38 nails modeling, 41 textures, 74–75 textures, 65–67 arrays, 148–149, 174 asset management, 113–114 attaching rigging, 92–97 shaders, 52 Auto Key, 120–122 automation, scripting, 154
B background light, 186–189 textures, 64 beauty pass, 194–196 Behavior activities, 206–207 actors, 204–205 crowd shots collision spheres, 210–211 geometry shader, 213 hierarchy, 209–210 Mental Ray pipeline, 213 MI files, 213 overview, 209 rendering, 213 scripting, 211–213 tagging, 210–211 walk cycles, 210–211
TLFeBOOK
Experience XSI 4 mouths, modeling design, 39 polygons, 25–27 nails modeling, 41 textures, 74–75 modeling, 29–43 necks, 32 primitives, 18 spines, rigging, 98 tails modeling, 30–32 rigging, 98–99 bottom toolbar, 9 bounce light, 189 BSP, 196 bump factors, 51–53 bump maps, 51–53, 70
C cage deformations, 105–106 cameras angles, 28 lens flares, 179–182 caustics, 193 characters anatomy, 42 animation Animation Editor, 129–132 Animation Mixer, 134–140 Consider Neighborhood, 137 curves, 132 dopesheets, 133 easing, 132 editing, 129–133 eyes, 136–140 feet, 41, 125–129
Index
loops, 206–207 overview, 203–204 Project Explorer, 205 scripting, 205–206 state, 206–207 state machines, 207–208 bodies anatomy, 42 arms modeling, 35–38 textures, 65–67 eyes animation, 136–140 modeling, 27–28, 40–42 textures, 72–74 faces primitives, 18 textures, 58–62 fingers modeling design, 41 textures, 74–75 hair guide hairs, 75 Hair toolbar, 5–6 rigging, 110 textures, 74–78 heads modeling, 29–43 polygons, 24–29 textures, 74–75 horns, 28–29 legs animation, 125–129 feet, 41, 125–129 modeling, 34–38 rigging, 99 textures, 66–67 toes, 41
247 TLFeBOOK
Index
Experience XSI 4 frames, 133 function curves, 129–132 interpolating curves, 132 key points, 130 keys, 136 legs, 125–129 marking sets, 124 modeling, referencing, 123 overview, 115–116 parenting, 131 playback, 133 rigging, 125–129, 131 run cycles, 129 shapes, 136–140 sliders, 124 storing, 133–140 synoptics, 123–124 timing, 133 walk cycles, 116, 124–129, 132 weighting, 129 behavior activities, 206–207 actors, 204–205 loops, 206–207 overview, 203–204 Project Explorer, 205 scripting, 205–206 state, 206–207 state machines, 207–208 bodies.See bodies crowd shots collision spheres, 210–211 geometry shader, 213 hierarchy, 209–210 Mental Ray pipeline, 213 MI files, 213 overview, 209
rendering, 213 scripting, 211–213 tagging, 210–211 walk cycles, 210–211 importing, 205 keyframes, 132 applying, 118–123 Auto Key, 120–122 overview, 116–118 playback, 122 preferences, 119 property pages, 118–119 timeline, 121 light background, 186–189 HDR maps, 185–186 overview, 183–184 Rotoscope, 186–189 loading, 204–205 modeling.See modeling primitives, 18–19 Project Explorer, 205 rendering.See rendering setup.See rigging state machines, 207–208 textures.See textures collections, 146–148 collision spheres, 210–211 color color maps, 70 RGB light, 179 values, 47–48 values, 179 color maps, 70 commands, 144 compositing, 198–202
248 TLFeBOOK
Experience XSI 4 curves animation, 129–132 function curves animation, 129–132 scripting, 147 interpolating animation, 132 Euler, 100 modeling copying, 20–21 creating, 19–21 design, 30–33 editing, 19–20 lofting, 21 polygons converting, 22 extruding, 28–29 modeling, 28 primitives, 16 scripting, 147, 161–162
D Data Grids, 174 Deep Paint 3D textures, 68–69 deformations enveloping, 88–89, 101–103 rigging cage deformations, 105–106 construction stack, 105 control splines, 106–108 elasticity, 106–108 enveloping, 101–103 hair, 110 overview, 101
Index
cone angle, 182 Consider Neighborhood, 137 Constrain toolbar, 9 constraints primitives, 17 rigging, 94–95 construction modes, 88 construction stack, 105 contact shadows, 183 containers (scripting), 146–154 control splines.See splines controllers, 85–86 converting curves, polygons, 22 coordinates modeling, 57–62 textures, 50–51 copying curves, 20–21 Cosine Law equation, 100 creating.See also rendering; scripting modeling.See modeling projects, 11 rigging, 84–87 state machines, 207–208 tools, scripting, 142 crowd shots collision spheres, 210–211 geometry shader, 213 hierarchy, 209–210 Mental Ray pipeline, 213 MI files, 213 overview, 209 rendering, 213 scripting, 211–213 tagging, 210–211 walk cycles, 210–211
249 TLFeBOOK
Index
Experience XSI 4 point controls, 106–107 rotation offsets, 107 rotation overlap, 102–103 shapes, 108–109 shearing, 102–103 shrink wrapping, 103–105 smoothing, 110 springs, 110 tracer controls, 106–107 troubleshooting, 102–103 weighting, 103 deleting polygons, 34 deselecting polygons, 62–63 design (modeling), 13–15 anatomy, 42 angles, 42 arms, 35–38 bodies, 29–43 curves, 30–33 deleting polygons, 34 eyes, 40–42 fingers, 41 heads, 29–43 instances, 34, 42 legs, 34–38 loading, 30 mirroring, 32–34 mouths, 39 nails, 41 necks, 32 referencing, 42 Rotoscope, 30 symmetry, 42–43 tails, 30–32 toes, 41 views, 30
diffuse materials, 48 diffuse pass, 197 diffuse values, 46–48 displacing shaders, 53–55 distortion textures, 59–61 values (materials), 46–48 dopesheets, 133 drawing.See creating duplicating curves, 20–21
E easing animation, 132 edges (polygons), 25–27 Edit toolbar, 9 editing.See also troubleshooting animation, 129–133 curves, 19–20 light, 181–183 meshes, 37–38 textures, 50–56 elasticity (rigging), 106–108 enveloping, 88–89, 101–103 equation (Cosine Law), 100 error checking (scripting), 143, 146 Euler curves, interpolating, 100 expressions, rigging, 95 extruding curves (polygons), 28–29 eyes animation, 136–140 modeling design, 40–42 polygons, 27–28 textures, 72–74
250 TLFeBOOK
Experience XSI 4
F
G
faces eyes animation, 136–140 modeling, 27–28, 40–42 textures, 72–74 mouths, modeling design, 39 polygons, 25–27 primitives, 18 textures, 58–62 fcurves.See function curves feet, 125–129 nails modeling, 41 textures, 74–75 toes, 41 fill light, 175–177, 187–188 final gathering light, 191–192 fingers modeling design, 41 nails modeling, 41 textures, 74–75 textures, 74–75 FK rigging, 99–100 flipping (rigging), 100 formatting (scripting), 171–172 frames (animation), 133 freezing operator stack, 27 function curves animation, 129–132 scripting, 147, 173–174 functions (scripting), 149–151 FX Operator Selector, 198 FX Operator Viewer, 199 FX Tree, 198–202
geometry approximation, 54 geometry shader, 213 scripting, 168–170 geometry shader, 213 Get properties (toolbars), 4 global illumination, 191–192 guide hairs, 75 guides, rigging, 80–84
H
Index
hair guide hairs, 75 Hair toolbar, 5–6 rigging, 110 textures, 74–78 Hair toolbar, 5–6 HDR (high dynamic range) maps, 185–186 head light, 24, 37 heads eyes animation, 136–140 modeling, 27–28, 40–42 textures, 72–74 faces primitives, 18 textures, 58–62 hair guide hairs, 75 Hair toolbar, 5–6 rigging, 110 textures, 74–78 horns, 28–29
251 TLFeBOOK
Experience XSI 4 modeling design, 29–43 polygons, 24–29 mouths, modeling design, 39 polygons, 25–27 necks, 32 textures, 74–75 Help (scripting), 144 hidden light, 178 hierarchy crowd shots, 209–210 rigging animation, 131 high dynamic range (HDR) maps, 185–186 highlight pass, 197–198 history (polygon modeling), 27 horns, modeling, 28–29 hot keys, 1–4
Index
I icons.See toolbars IK rigging, 99–100 implicit primitives, 17 importing actors, 205 incandescence values, 49 infinite light, 178 instances modeling, 34, 42 polygons, 24–25 intensity (light), 182 interfaces overview, 1–2 rigging, 113 scripting arrays, 174 Data Grids, 174
formatting, 171–172 function curves, 173–174 logic, 172–173 overview, 170 sliders, 170–171 spreadsheets, 174 interpolating curves, 100, 132 ISL (textures), 58–59
K key light, 175–177, 187–188 key points (animation), 130 keyboard mapping, 4 keyboard shortcuts, 1–4 keyframes (animation), 132 applying, 118–123 Auto Key, 120–122 overview, 116–118 playback, 122 preferences, 119 property pages, 118–119 timeline, 121 keys (animation), 136 kinematics, 99–100
L languages, 142, 205–206 layers (textures), 55–56 Layers toolbar, 7 left-side toolbars, 4–7 legs animation, 125–129 feet, 41, 125–129 modeling, 34–38
252 TLFeBOOK
Experience XSI 4 rendering caustics, 193 characters, 193–194 final gathering, 191–192 global illumination, 191–192 motion blur, 194 overview, 189–190 raytracing, 190 scanline, 191 RGB, 179 rigging, 189 rim light, 175–177, 187–188 samples, 183 scaling, 183 selecting, 178 shaders attaching, 52 geometry shader, 213 overview, 46–50 realtime, 48 surfaces, 46 views, 47 volume shader, 71–72 shadows contact shadows, 183 light, 179, 183 shadows pass, 197 softening, 189 textures, 54–55 shards, 180 spot light, 179–181 spread angle, 182 studio light, 178 sunlight, 178–180 transparency, 180 types, 178–179 volumic, 179–182
Index
nails modeling, 41 textures, 74–75 rigging, 99 textures, 66–67 toes, 41 lens flares, 179–182 libraries (rigging), 113 light ambient, 179–180 angles, 182 area light, 183, 193–194 bounce light, 189 characters background, 186–189 HDR maps, 185–186 overview, 183–184 Rotoscope, 186–189 color values, 179 cone angle, 182 contact shadows, 183 editing, 181–183 fill light, 175–177, 187–188 head light, 24, 37 hidden, 178 infinite light, 178 intensity, 182 key light, 175–177, 187–188 lens flares, 179–182 light box, 178 light bulbs, 179–180 neon light, 178–179 overview, 175–178 point light, 179–181, 187–189 property page, 181–182 reflection, 179–182 render region, 177
253 TLFeBOOK
Experience XSI 4 light box, 178 light bulbs, 179–180 lists (scripting), 146–154 loading actors, 204–205 modeling, 30 lofting curves, 21 logic behavior.See behavior scripting, 172–173 loops behavior, 206–207 scripting, 145–146 simulation loops, 206–207
Index
M Main Command Area toolbars, 7–9 Main Menu bar toolbar, 9 mapping coordinates, 57–62 keyboard, 4 marking sets animation, 124 rigging, 87 materials ambient values, 46–48 diffuse values, 46–48 distortion values, 46–48 incandescence values, 49 nodes, 52–54 overview, 46–50 phong, 47–50 previewing, 49 reflection values, 46–49 refraction values, 46–48
RGB values, 47–48 selecting, 45–46 shaders attaching, 52 geometry shader, 213 overview, 46–50 realtime, 48 surfaces, 46 views, 47 volume shader, 71–72 specular values, 46–48 tranparency values, 46–48 translucency values, 49 math Cosine Law, 100 geometry approximation, 54 geometry shader, 213 scripting, 168–170 scripting, 155 curves, 161–162 geometry, 168–170 rotations, 163–168 vectors, 156–161 maximizing/minimizing.See opening/closing memory limit (rendering), 196 Mental Ray pipeline, 213 merging points, 59–61 meshes editing, 37–38 polygon meshes modeling, 21–22 primitives, 16–17 surface meshes, 21–22 textures, 58 methods (scripting), 148, 153–154
254 TLFeBOOK
Experience XSI 4 edges, 25–27 extruding curves, 28–29 eyes, 27–28 freezing operator stack, 27 heads, 24–29 history, 27 horns, 28–29 instances, 24–25 modes, 24 mouths, 25–27 polygon meshes, 21–22 proportional modeling, 26–27 rotating, 24 scaling, 24–25 selecting, 24–27 selection mode, 38 smoothing, 25–26 snapping surfaces, 28 subdividing, 38 subdivision surfaces, 25–26 symmetry maps, 24 translating, 24–25 primitives bodies, 18 characters, 18–19 constraints, 17 curves, 16 faces, 18 implicit, 17 models, 18–19 null, 16 overview, 15–16 patches, 17 polygon meshes, 16–17 rigging, 17 surfaces, 17 proportional modeling, 23, 26–27, 60 referencing, 123 saving, 43
Index
MI files, 213 mirroring.See symmetry Model toolbar, 4–5, 15 modeling coordinates (Texture Editor), 57–62 creating, 19 curves, 19–21 design, 13–15 anatomy, 42 angles, 42 arms, 35–38 bodies, 29–43 curves, 30–33 deleting polygons, 34 eyes, 40–42 fingers, 41 heads, 29–43 instances, 34, 42 legs, 34–38 loading, 30 mirroring, 32–34 mouths, 39 nails, 41 necks, 32 referencing, 42 Rotoscope, 30 symmetry, 42–43 tails, 30–32 toes, 41 views, 30 editing meshes, 37–38 light (head light), 24, 37 Model toolbar, 15 overview, 15 points, 23 polygons camera angles, 28 creating, 22–24 curves, 28
255 TLFeBOOK
Experience XSI 4 sculpting, 15 selecting, 38 shaping, 38 softening, 38 surface meshes, 21–22 transparency, 37 views, 24 wireframe, 37 zooming, 39 models (primitives), 18–19 modes construction modes, 88 polygons, 24, 38 toolbars, 4–7 modifying.See editing motion blur, 194 mouths, modeling design, 39 polygons, 25–27 moving.See animation multiple points, 23
Index
N nails modeling, 41 textures, 74–75 naming projects, 11 necks, 32 neon light, 178–179 Netview, 113 nodes materials, 52–54 textures, 52–54 Non-Uniform Rational B-Splines.See curves null primitives, 16 NURBs.See curves NxN Alienbrain, 114
O objects, 153–154.See also polygons; shapes passing, 143 rigging, 111 opening/closing projects, 11 textures, 62–63 views, 24, 47 Operator Selector, 198 operator stack, freezing, 27 Operator Viewer, 199 optimizing rendering, 196 organization (scripting), 154–155
P paint programs, 68–69 Palettes and Display Types toolbar, 6–7 panels.See toolbars parameters (scripting), 144, 147 parenting animation, 131 rigging, 92 scripting, 146–147 passes (rendering) ambient pass, 197 beauty pass, 194–196 diffuse pass, 197 highlight pass, 197–198 overview, 194–196 reflection pass, 197 shadows pass, 197 passing objects (scripting), 143 patches (primitives), 17 phong material, 47–50 Photoshop, 68–69 Piccolo, 205–206 pivots, 92–94
256 TLFeBOOK
Experience XSI 4 polygon meshes modeling, 21–22 primitives, 16–17 primitives bodies, 18 characters, 18–19 constraints, 17 curves, 16 faces, 18 implicit, 17 modeling, 15–16 models, 18–19 null, 16 patches, 17 polygon meshes, 16–17 rigging, 17 surfaces, 17 rotating, 24 scaling, 24–25 selecting, 24–25, 47 smoothing, 16, 25–26 symmetry maps, 24 translating, 24–25 preferences (keyframes), 119 previewing textures, 49 primitives.See also objects; polygons; shapes bodies, 18 characters, 18–19 constraints, 17 curves, 16 faces, 18 implicit, 17 modeling, 15–16 models, 18–19 null, 16 patches, 17 polygon meshes, 16–17 rigging, 17 surfaces, 17
Index
playback animation, 133 keyframes, 122 point controls, 106–107 point light, 179–181, 187–189 points merging, 59–61 multiple, 23 polygon meshes modeling, 21–22 primitives, 16–17 polygons.See also objects; shapes creating, 22 curves converting, 22 modeling, 28 deselecting textures, 62–63 instances, 24–25 modeling camera angles, 28 creating, 22–24 deleting, 34 edges, 25–27 extruding curves, 28–29 eyes, 27–28 freezing operator stack, 27 heads, 24–29 history, 27 horns, 28–29 mouths, 25–27 proportional modeling, 26–27 selecting, 24–27, 47 selection mode, 38 smoothing, 16, 25–26 snapping surfaces, 28 subdividing, 38 subdivision surfaces, 25–26 modes, 24
257 TLFeBOOK
Experience XSI 4 problem-solving (scripting), 154–155 production (rigging), 110–114 programs (textures), 68–69 Project Explorer, 205 projection coordinates.See coordinates projections (textures), 59–61 projects, 10–11 properties, Get, 4 property pages, 1, 4 keyframes, 118–119 light, 181–182 proportional modeling, 23, 26–27 polygons, 26–27 textures, 60 puppets.See rigging
Index
R raytracing, 190 real-time assembly rigging, 113 real-time shaders, 48 referencing modeling animation, 123 design, 42 rigging, 112–113 reflection, 179–182 reflection pass, 197 reflection values, 46–49 refraction values, 46–48 render regions light, 177 textures, 49 Render toolbar, 5 render trees, 50–56, 70–78
rendering.See also creating; scripting aliasing, 177 BSP, 196 compositing, 198–202 crowd shots, 213 light caustics, 193 characters, 193–194 final gathering, 191–192 global illumination, 191–192 overview, 189–190 raytracing, 190 scanline, 191 memory limit, 196 motion blur, 194 optimizing, 196 passes ambient pass, 197 beauty pass, 194–196 diffuse pass, 197 highlight pass, 197–198 overview, 194–196 reflection pass, 197 shadows pass, 197 resolution, 177 shadows, 189 speed, 196 textures.See textures resolution rendering, 177 textures, 49 RGB light, 179 values, 47–48
258 TLFeBOOK
Experience XSI 4 kinematics, 99–100 legs, 99 libraries, 113 light, 189 marking sets, 87 mirroring, 87 Netview, 113 NxN Alienbrain, 114 object-oriented, 111 overview, 79–80 parenting, 92 pivots, 92–94 primitives, 17 production, 110–114 real-time assembly, 113 referencing, 112–113 scaling, 86 scripted operators, 95–97 scripting, 110–112 SDK, 111–112 spines, 98 springs, 97 synoptics, 90–91 tails, 98–99 templates, 80 tips, 85, 97 trees, 110 two-bone chains, 100 weight maps, 88–89 workflow, 114 right-side toolbars, 7–9 rim light, 175–177, 187–188 rotation polygons, 24 rotation offsets, 107 rotation overlap, 102–103 scripting, 163–168
Index
rigging alignment, 86–87 animation, 125–129, 131 asset management, 113–114 attaching, 92–97 constraints, 94–95 construction modes, 88 controllers, 85–86 Cosine Law equation, 100 creating, 84–87 deformations cage deformations, 105–106 construction stack, 105 control splines, 106–108 elasticity, 106–108 enveloping, 101–103 hair, 110 overview, 101 point controls, 106–107 rotation offsets, 107 rotation overlap, 102–103 shapes, 108–109 shearing, 102–103 shrink wrapping, 103–105 smoothing, 110 springs, 110 tracer controls, 106–107 troubleshooting, 102–103 weighting, 103 enveloping, 88–89 expressions, 95 FK, 99–100 flipping, 100 guides, 80–84 IK, 99–100 interfaces, 113
259 TLFeBOOK
Experience XSI 4 rotation offsets, 107 rotation overlap, 102–103 Rotoscope light, 186–189 modeling, 30 run cycles, 129
Index
S samples (light), 183 saving modeling, 43 scenes, 10–11 scaling light, 183 polygons, 24–25 rigging, 86 scanline light, 191 scenes, saving, 10–11 Script editor, 142 scripted operators (rigging), 95–97 scripting.See also creating; rendering arrays, 148–149 automation, 154 behavior, 205–206 collections, 146–148 commands, 144 containers, 146–154 creating tools, 142 crowd shots, 211–213 error checking, 143, 146 function curves, 147 functions, 149–151 Help, 144
interfaces arrays, 174 Data Grids, 174 formatting, 171–172 function curves, 173–174 logic, 172–173 overview, 170 sliders, 170–171 spreadsheets, 174 languages, 142 lists, 146–154 loops, 145–146 math, 155 curves, 161–162 geometry, 168–170 rotations, 163–168 vectors, 156–161 methods, 148, 153–154 objects, 151–154 passing, 143 organization, 154–155 overview, 141–142 parameters, 144, 147 parenting, 146–147 Piccolo, 205–206 problem-solving, 154–155 rigging, 110–112 object-oriented, 111 SDK, 111–112 Script Editor, 142 springs, 97 values, 144 sculpting, 15 SDK, rigging, 111–112 Select toolbar, 7–8
260 TLFeBOOK
Experience XSI 4 sliders animation, 124 scripting, 170–171 smoothing polygons, 16, 25–26 rigging, 110 textures, 51–53, 61 Snap toolbar, 8 snapping surfaces, 28 softening modeling, 38 shadows, 189 specular maps, 71 specular values, 46–48 speed, rendering, 196 spines, 98 splines control splines, 106–108 interpolating, 132 spot light, 179–181 spread angle, 182 spreadsheets (scripting), 174 springs rigging, 97, 110 scripting, 97 state (behavior), 206–207 state machines, 207–208 storing animation, 133–140 studio light, 178 subdivision surfaces, 25–26, 38 sunlight, 178–180 surface meshes, 21–22 surfaces primitives, 17 shaders, 46 snapping polygons, 28 subdivisions, 25–26 surface meshes, 21–22
Index
selecting light, 178 materials, 45–46 modeling, 38 polygons, 24–25, 47 deselecting, 62–63 modeling, 27 modes, 38 textures, 45, 50–51 shaders attaching, 52 geometry shader, 213 overview, 46–50 realtime, 48 surfaces, 46 views, 47 volume shader, 71–72 shadows contact shadows, 183 light, 179, 183 shadows pass, 197 softening, 189 textures, 54–55 shadows pass, 197 shapes.See also objects; polygons animation, 136–140 displacing, 53–55 modeling, 38 rigging, 108–109 shards (light), 180 shearing, 102–103 shrink wrapping, 103–105 Simulate toolbar, 5–6 simulation loops, 206–207 skeletons.See rigging skinning (enveloping), 88–89, 101–103
261 TLFeBOOK
Experience XSI 4 symmetry modeling, 32–34, 42–43 rigging, 87 symmetry maps, 24 textures, 61, 67–68 symmetry maps (polygons), 24 synoptics animation, 123–124 rigging, 90–91
Index
T tagging crowd shots, 210–211 tails modeling, 30–32 rigging, 98–99 templates (rigging), 80 Texture Editor, 56 modeling coordinates, 57–62 texturing, 62–68 Texture Layer Editor, 55–56 textures 3D paint programs, 68–69 aliasing, 49 arms, 65–67 attaching shaders, 52 background, 64 bump factors, 51–53 bump maps, 51–53, 70 color maps, 70 coordinates, 50–51 Deep Paint 3D, 68–69 deselecting polygons, 62–63 distortion, 59–61 editing, 50–56
eyes, 72–74 faces, 58–62 fingers, 74–75 geometry approximation, 54 hair, 74–78 ISL, 58–59 layers, 55–56 legs, 66–67 materials ambient values, 46–48 diffuse values, 46–48 distortion values, 46–48 incandescence values, 49 nodes, 52–54 overview, 46–50 phong, 47–50 previewing, 49 reflection values, 46–49 refraction values, 46–48 RGB values, 47–48 selecting, 45–46 specular values, 46–48 tranparency values, 46–48 translucency values, 49 merging points, 59–61 meshes, 58 mirroring, 61 nails, 74–75 nodes, 52–54 opening/closing, 62–63 overview, 45–46 Photoshop, 68–69 previewing, 49 projections, 59–61 proportional modeling, 60 render regions, 49
262 TLFeBOOK
Experience XSI 4 Layers, 7 left-side, 4–7 Main Command Area, 7–9 Main Menu bar, 9 Model, 4–5, 15 modes, 4–7 Palettes and Display Types, 6–7 Render, 5 right-side, 7–9 Select, 7–8 Simulate, 5–6 Snap, 8 timeline, 9 top, 9 Transform, 8 Weight, 6–7 tools, scripting, 142 top toolbar, 9 tracer controls, 106–107 tranparency values, 46–48 Transform toolbar, 8 transformations (keyframes), 132 applying, 118–123 Auto Key, 120–122 overview, 116–118 playback, 122 preferences, 119 property pages, 118–119 timeline, 121 translating polygons, 24–25 textures, 58 translucency values, 49 transparency light, 180 modeling, 37
Index
render trees, 50–56, 70–78 resolution, 49 selecting, 45, 50–51 shaders attaching, 52 geometry shader, 213 overview, 46–50 realtime, 48 surfaces, 46 views, 47 volume shader, 71–72 shadows, 54–55 shapes, displacing, 53–55 smoothing, 51–53, 61 specular maps, 71 symmetry, 67–68 Texture Editor, 56 modeling coordinates, 57–62 texturing, 62–68 Texture Layer Editor, 55–56 translating, 58 transparency maps, 71 views, 50–51 volume shader, 71–72 timeline, 9, 121 timing (animation), 133 tips, rigging, 85, 97 toes, 41 toolbars ? icon, 1 Animate, 4–5 bottom, 9 Constrain, 9 Edit, 9 Get properties, 4 Hair, 5–6
263 TLFeBOOK
Experience XSI 4 transparency maps, 71 trees, rigging, 110 troubleshooting.See also editing animation playback, 133 rigging deformations, 102–103 flipping, 100 two-bone chains, 100 types of light, 178–179
viewing/hiding.See opening/closing views, 10–11 FX Operator Selector, 198 FX Viewer, 199 maximizing/minimizing, 24, 47 modeling, 30 shaders, 47 textures, 50–51 volume shader, 71–72 volumic light, 179–182
U–V W–Z walk cycles animation, 116, 124–129, 132 crowd shots, 210–211 weight maps, 88–89 Weight toolbar, 6–7 weighting animation, 129 rigging deformations, 103 weight maps, 88–89 windows.See views wireframe modeling, 37 workflow, rigging, 114 zooming, 39
Index
UV coordinates.See coordinates values color (light), 179 materials ambient, 46–48 diffuse, 46–48 distortion, 46–48 incandescence, 49 reflection, 46–49 refraction, 46–48 RGB, 47–48 specular, 46–48 tranparency, 46–48 translucency, 49 scripting, 144 vectors, 156–161 view ports.See views
264 TLFeBOOK
Professional ■ Trade ■ Reference
Write, direct, produce, shoot, edit, distribute, tour with, and sell your own no-budget DIGITAL movie!
We’re entering a new era. Mini-DV filmmaking is the new folk, the new punk rock, the new medium where anyone can tell his story. $30 Film School is an alternative to spending four years and a hundred thousand dollars to learn the trade. It is influenced by punk rock’s Do-It-Yourself spirit of just learning the basics and then jumping up on a stage and making a point, and by the American work ethic back when it was pure, before it became all about corporations crushing the little guy. Throw in the hacker idea that information wants to be free (or at least very cheap) and you’ve got our deal. Inside you’ll find many interviews from insightful independent filmmakers and artists, as well as a host of practical advice, knowledge, and resources.
$30 Film School ISBN: 1-59200-067-3 ■ $30.00
Call 1.800.354.9706 to order Order online at www.courseptr.com TLFeBOOK
Professional ■ Trade ■ Reference
CREATE AMAZING GRAPHICS AND COMPELLING STORYLINES FOR YOUR GAMES!
The Dark Side of Game Texturing
ISBN: 1-59200-350-8 ■ $39.99 Charred ruins, bullet holes, rusted metal—if you ’re a fan of 3D first-person-shooter games, then you ’re familiar with those amazing, ominous textures that draw you into your character’s surroundings. Get ready to analyze—and re-create—the textures and graphics used in these games. All you need is a decent PC, Photoshop, and a digital camera. Once you learn how to create the textures within this book, you can create any texture for any game. Not a born artist? That’s okay. You’ll learn how to let Photoshop do most of the work. Begin with texturing basics, including pixel sizes, color modes, and alpha channels. Then jump right into hearty texture tutorials as you create everything from sci-fi backgrounds and molten lava to medieval castle walls and dragon skin. If you’re ready to travel to the grim back alleys of your imagination, then you’re ready for The Dark Side of Game Texturing.
Shaders for Game Programmers and Artists
ISBN: 1-59200-092-4 ■ $39.99 Shaders for Game Programmers and Artists—the title says it all. This book does something that other shader books don’t. It focuses solely on shaders and their creation. You’ll use ATI’s RenderMonkey platform, giving you an easy-to-use framework for shader development and allowing you to focus your energy on shader development rather than the development of framework applications. Cover simple techniques, from the basics of color filters to more advanced topics, such as depth of field, heat shimmer, and high-dynamic range rendering. Extensive excercises at the end of each chapter allow you to test your skills by expanding upon the shader you’ve just developed. Whether you are an engineer or a technically minded artist, you’ve finally found the ideal guide for mastering shaders!
Character Development and Storytelling for Games
ISBN: 1-59200-353-2 ■ $39.99 Character Development and Storytelling for Games begins with a history of dramatic writing and entertainment in media outside the realm of games. It then segues into writing for games, revealing that while proven techniques in linear media can be translated to games, games offer many new challenges on their own such as interactivity, non-linearity, player input, and more. It introduces elements of the craft of writing that are particularly unique to interactive media, taking you from the relatively secure confines of single-player games to the vast open spaces of virtual worlds and examining player-created stories.
Call 1.800.354.9706 to order Order online at www.courseptr.com TLFeBOOK
Professional n Trade n Reference
Welcome to the digital revolution! “This innovative book is the definitive source for producing broadcast Flash animation.” Iwao Takamoto —Vice President, Hanna-Barbera®, Creative Design Animation as you know it is about to change. No longer satisfied to reign as the standard in animation for the Web, Macromedia® Flash™ is powering its way into television and feature films. Flash represents the future, offering an efficient way to create amazing broadcast animation. Throw in its ability to drive down the costs of production to a mere fraction of the cost for traditional methods and you’ve got a winning combination. Hollywood 2D Digital Animation introduces you to the world of Flash animation, taking you through dozens of examples and production techniques to explain how you can effectively utilize Flash for your broadcast needs. With a foreword written by two-time Disney® Academy Award® winner Richard M. Sherman, it echoes with the voice and experience of professionals in the animation industry— from feature-film directors to Web pioneers. Get ready to examine the new world of animation!
Hollywood 2D Digital Animation: The New Flash® Production Revolution ISBN: 1-59200-170-X ■ $39.99
Call 1.800.354.9706 to order Order online at www.courseptr.com TLFeBOOK
Professional ■ Trade ■ Reference
STEP INTO THE 3D WORLD OF ANIMATION WITH THE INSPIRED SERIES!
Inspired 3D Character Animation 1-931841-48-9
Inspired 3D Character Setup 1-931841-51-9
Inspired 3D Lighting and Compositing 1-931841-49-7
illed with tips, tricks, and techniques compiled by the animators of blockbuster films at Hollywood’s biggest studios, these four-color books are a musthave for anyone interested in character creation.
F
Series Editor Kyle Clark is a lead animator at Microsoft’s Digital Anvil Studios. His film credits include Star Wars Episode I—The Phantom Menace, Sleepy Hollow, Deep Blue Sea, The Adventures of Rocky and Bullwinkle, Harry Potter and the Sorcerer’s Stone, and Brute Force video game for the Xbox.
Inspired 3D Modeling and Texture Mapping 1-931841-50-0
Inspired 3D Short Film Production 1-59200-117-3
Series Editor Michael Ford is a senior technical animator at Sony Pictures Imageworks. He is a certified Level 2 Softimage instructor whose film credits include Stuart Little, Stuart Little 2, The Perfect Storm, The Mummy, Godzilla, Species II, Mortal Kombat II, and The Faculty.
Call 1.800.354.9706 to order Order online at www.courseptr.com TLFeBOOK