Power Up Your Polygons
Remy Etienne LeBeau is a dork.
You know who I'm talking about. No, not the kid that used to bully me in third grade. That was Crystal Morales and she was much shorter and could probably still send chills down my back. I'm talking about Gambit from Marvel's X-Men comics.
He first appeared in Uncanny X-Men #266 in 1990. Yeah, that's right! The guy that runs around throwing playing cards that explode. Well, to be more accurate, Remy has the mutant ability to tap into the potential energy contained within an object and transform it into kinetic energy by simply touching it. This charges the object and when thrown at a target, the object releases the energy explosively on impact.
Pretty cool power right? So what does this hack do with this magical ability? He runs around using playing cards as his preferred weapon. Not something cool like ninja stars or throwing spikes. Just plain ol' playing cards.
OK, OK, I know what you want to ask. You want to know why I know all of this about a comic book character I think is a dork. Well, to be honest, I'm jealous. That's right, I'm jealous. I'd love to have some kind of magic ability where I can take an everyday object and turn it into something more powerful. Like an old mage or druid that casts spells on rocks and turns them into fireflies that light their way, or transforms a useless stick into a magical sword.
OK, so I'm no mage and I may not have Gambit's mutant abilities, but I do have a little magic up my sleeve when it comes to 3D. I have the power to charge polygons with mutant-like properties inside of LightWave Modeler using Powergons. When loaded into LightWave Layout, polygons that have been "charged" with Powergons can release all kinds of functionality and increase productivity.
Although Powergons can be used to speed up just about every production, they are one of the most overlooked and underutilized features in LightWave. In this article, I'd like to introduce you to Powergons in LightWave 3D and show you just how useful this easy-to-use feature is. Let's get cracking shall we?
What are Powergons?
Simply put, Powergons allow you to execute a short Layout command script, which is attached to selected polygons in Modeler. Whoa... command? Script? This sounds like programming! No wonder the majority of LightWave artists stay clear of Powergons. What self-respecting artist wants to fool around with programming?
Don't be fooled like I was when I heard about this feature when it was first introduced. There's no need to panic! I promise this feature is very artist-friendly and we'll be up and running with it in mere minutes. Hell, let's start using them now so we can see just how easy Powergons truly are.
Powergons in Action
Create a Ball (Create > Primitives > Ball) with default settings (Fig.02). Select one of the polygons on the ball object and change the surface (keyboard shortcut Q) using the following attributes:
• Name: Powergon
• Color: 255, 0, 0 (Red)
By assigning a new surface to the selected polygon, we can easily keep track of which polygon we will be working with. It's important to note that you are not required to create a new surface when working with Powergons, but it can be a useful option.
With the polygon still selected, click the Add Powergon button found under the Setup tab in the Layout Tools sub-menu to open the Add Powergon Command panel (Setup > Layout Tools > Add Powergon)(Fig.03).
The Add Powergon Command dialog panel has an input field where you can enter a Layout command script. As you can see, there is already a command script in the field by default which reads:
AddSpotlight LGON\rPosition \c\rRotation \n\rParentItem \i\rCreateKey 0
What's all that mean? We'll come back to that, but for now, let's keep this default command and click OK, which will attach the command script above to the selected polygon. It will appear as if nothing has happened but this action adds a PWRG type polygon tag to any selected polygon.
Note: You can attach a Powergon to as many polygons as you'd like.
Now that we have the Powergon command attached to the polygon we selected, Save the object and load it into Layout. With the object selected, choose the Convert Powergon command located under the Items Tab in the Add sub-menu. (Items > Add > Cvt Powergons) This command will execute any command scripts that are attached to the selected object.
The default script that we added creates a spotlight named LGON, positions it at the center of the polygon, rotates it to match the polygon's normal, parents the light to the object and creates a keyframe at frame 0 (Fig.04).
Note: Once a Powergon script is executed in Layout, you can clear the object if it is unneeded otherwise. However, the default command parents the lights to the object, so be careful since you don't want to delete the children.
Understanding the Default Powergon Command Script
Now that we've seen the result of the Powergon, let's take a closer look at the script and break it into its individual components.
AddSpotlight LGON\rPosition \c\rRotation \n\rParentItem \i\rCreateKey 0
• AddSpotlight LGON simply adds a Spotlight to the scene and gives it the name "LGON".
• \r is a special "escape" character that creates a line return to signify the end of the current command and the start of the next.
• Position \c\r uses the \c special "escape" character to return the position of the polygon's center in the form "x y z". This is used to position the light at the center of the polygon we applied the Powergon to. The \r at the end is used as another line return so we can continue adding commands to this script.
• Rotation \n\r uses the \n special "escape" character to return the polygon's normal converted into heading, pitch and bank angles (bank is always 0) in the form "h p b". This rotates the Spotlight to match the polygon normal. Again we use the \r character as a line return.
• ParentItem \i\r uses the \i special character. This returns the item ID of the object containing the polygon so we can assign the Spotlight as a child to our object.
• CreateKey 0 simply creates a keyframe at frame 0. Note that the \r special "escape" character is not needed at the very end of the last command.
So now we know what the default script does, but where do these commands come from and how many different special "escape" characters are there? Let's start with the special characters since there are only six to work with and we already covered four of them. Here are the six special "escape" characters that can be used when generating a Powergon Command:
• \a returns the area of the polygon.
• \c returns the position of the polygon's center in the form "x y z".
• \d returns the polygon's normal vector as "nx ny nz".
• \i returns the item ID of the object containing the polygon.
• \n returns the polygon's normal converted into heading, pitch and bank angles (bank is always 0) in the form "h p b".
• \r creates a line return to signify the end of the current command and the start of the next. Note that it is not needed at the very end of the last command.
Once you work with Powergons for awhile you'll be able to call these six characters up from memory with ease, but what about the Layout commands? Where do they come from?
Nearly all of your actions in Layout are executed by sending discrete commands. When you click on the VIPER button (Render > Utilities > VIPER) it sends a command to Layout to open and display VIPER. We can watch what commands are being sent to Layout by using the Command History window found under the Utilities Tab (Utilities > Commands > Cmd History).
Clear the current scene and launch the Command History window (Utilities > Commands > Cmd History)(Fig.05).
Leave the Command History window open, add a Spotlight to the scene and name it "LGON" (Items > Add > Lights > Spotlight.
Once you create the light the Command History window is updated with the commands that were sent to Layout during that operation. Now let's add a Null object to the scene and name it "Gambit" (Items > Add > Null). Your Command History window should look something like Fig.06.
Click on the AddNull Gambit command in the list and it will display the command in the text field located at the bottom of the Command History window. Select the entire text string and copy it (Ctrl + C). Clear the scene and switch back over to Modeler.
In a new object (File > New Object), create a box with the default settings (Create > Primitives > Box). Select the top polygon on the box and click the Add Powergon command. Delete the default script and paste the command we just copied from Layout in its place (Fig.07).
It should read "AddNull Gambit". When executed in Layout, this command would simply add a Null object with the name Gambit to the scene, placing it at the origin. Let's dress this script up a little and tell it to place the Null in the center of the select polygon using a couple of the special "escape" character we learned about earlier (Fig.08).
Add the \r character so that we can create a line return letting Layout know that we want to perform another command after we create the Null. Then type Position \c, which will tell Layout to move the null to the center of the selected polygon. Let's give this a test run. The full script should read as follows:
AddNull Gambit\rPosition \c
Click OK to attach the script to the selected polygon, save your object and send it over to Layout. With the Box selected, choose Items > Cvt Powergons to execute the command we just created. You should now have a Null object positioned in the center of the top polygon that has been named Gambit (Fig.09).
Let's think about what just happened. We clicked one button and performed three tasks:
1. We added a Null to the Scene
2. We named the Null
3. We positioned the Null exactly where we wanted it.
Sounds like Powergons can reduce steps and increase our productivity. Not too shabby if you ask me.
OK, so we've added a spotlight and a Null using Powergons - big deal, right? Sure, these are simple tasks but we're just scratching the surface. I'll share with you three examples of how I've used Powergons to speed up past productions.
Use Powergons to quickly add and parent lights in strategic locations all over the car: headlights, break lights, turn signals and more. Why stop there? You can also add and parent a particle emitter to the tail pipe for extra detail for your scene.
Sure you could do all of this without the use of Powergons, but imagine the time you'd be wasting doing it the old-fashioned, manual way (Fig.10 - 11).
Use Powergons along with skelegons to quickly rig characters with IK goals. Attach the Powergon command to a skelegon and you can have a goal object (Null) generated in place and ready to go in no time. I've seen artists use Powergons to rig entire characters with the click of one button. Talk about a time saver (Fig.12 - 13)!
Attach scripts using Powergons that add lights to any lighting fixtures you have in your architecture work. The beauty of Powergons is that the script is stored with the object, allowing you to load lighting fixtures into new interiors and quickly add lights to them without having to hand place each light. Remember that some scenes may have hundreds of lighting fixtures, which could take quite a bit of time to place by hand.
Hopefully you're starting to see just how powerful Powergons truly are. I'm sure you're already coming up with dozens of uses for them. Before you head out and start using Powergons on your current project, I'd like to hop back over to Modeler to discuss a few more Powergon features that might come in handy.
Additional Powergon Tools
There are a few tools you'll want to add to your toolkit when working with Powergons. If you've attached scripts to polygons and would like to remove them at anytime, simply use the Clear Powergons command (Setup > Layout Tools > Clear Powergons. This command will remove scripts that are attached to any selected polygons. Remember the LightWave rule: if nothing is selected, everything is selected (Fig.14).
Another handy, must-have tool when working with Powergons is the Select Powergons feature located under the Selection tab (Selection > Specialty > Select Powergons). Since Powergons are pretty much invisible once they are applied, it can be a challenge sometimes to track down which polygons have Powergons attached to them. Use the Select Powergons option to quickly select any polygon that has a script attached to it.
If you're like most LightWave artists, you'll quickly fall in love with Powergons when working on lighting rigs. You can use standard Powergons to build these lighting rigs like we did earlier or you can use a special type of Powergon called a Luxigon.
Luxigons are Powergons that focus solely on adding lights, but also give you the added ability to set certain light properties. To use, in Modeler select the desired polygons and choose Add Luxigon (Setup > Layout Tool > Add Luxigon). When the dialog appears, select the type of light you wish to add and set its properties. Once the object is in Layout, use the Convert Luxigons command to execute the Luxigons for the selected object. You can see Luxigons being used in a video I created that covers the spinning light trick:
After you have used Powergons on a few projects, you'll wonder how you ever lived without them. They can greatly speed up mundane tasks like hand-placing hundreds of lights and allow for more accurate placement of items in a scene. Spend some time working with the Command History window by simply leaving the window open while you work, watch the commands that are displayed and you'll start coming up with all sorts of amazing uses for Powergons.
After writing about Powergons, I'm feeling a little less jealous of that playing card throwing dork, Gambit. He may have a deck of cards, but I have the Power of Powergons up my sleeve... OK, yeah, I'm a dork too!
If you're interested in learning more about Powergons, be sure to check out this introduction to the power of Powergons video I created: ftp://ftp.newtek.com/multimedia/movies/w3dw/Powergons.mov