So recently I’ve been posting some of my scripting work, but unfortunately I’ve been sidetracked from that work. Currently that distraction is a subscription to Digital Tutors. I’m sure many digital artist have gone to this site and I must say that the membership price is well worth it. I’ve started to dive into topics that I had only briefly touched before and is only adding to my knowledge, especially in Maya. Working as a production artist for many years in Maya, and I’m sure many of you will agree, you have particular rhythm working with it. Many of the features these tools provide sometimes go unused or undiscovered. I’m hoping to change for myself. I want to learn as much about this program as I can. Even though I’m not a traditional animator, I want to learn the animation tools. I’ve little experience with special FX and dynamics, but I want to know more about them. Digital Tutors so far has not disappointed. Hopefully within a few months I’ll be able to use all the new things I’ve learned and become a better digital artist. For those of you hoping to expand your skill set, I highly recommend Digital Tutors, even if for only a few months.
So my mind has drifted in a new direction and I thought what Maya script could I start working on next. One thing every game artist or maybe level designers have to deal with is building collision meshes. Well maybe we let the interns deal with it. Any way, no matter who is working on building your collision meshes, usually you want to build a quick and simple mesh to surround your object. It’s a pain to have to do this over and over manually so when not make simple shapes with MEL and go from there! Well, the script I’m currently working on will do just that, I hope. Here are the steps that my script will go through:
1. The artist, designer, or intern starts up the script and appears a small window.
2. The said person selects a mesh(es) and chooses the type of collision they want. (box, sphere, cylinder, capsule or selected vertices.
3. Using some math the type of collision mesh selected is created and moved to the center of the meshes that were selected in step 2.
That’s it! Of course I’ll probably rename the collision mesh to take the name of the selected mesh, and some other features hidden from the user. I already have the simple 6 sided cube (box) working and I’m sure the selected vertices option will take up most of my time figuring out the math and setup I need. Wish me luck…so far so good.
Happy New Year! It’s been a while since I’ve posted something new…the holiday season became extremely busy for me and I had little to no time to update what I’ve been working on. For the new year I’m hoping to continue working on more Maya scripting goodness and start sending more of my work to Creative Crash for others to download. I’m also just starting to learn more about Photoshop scripting. There aren’t many resources out there that I’ve found, but hopefully I can contribute some, please feel free to point some links in my direction if you happen to know a few resources. I’ve been working in Photoshop for over 10 years and I can’t believe I’m only just starting to learn this. I’m currently going through Adobe’s scripting guide to see what I can do. Wish me luck.
I spent a little bit of time today adding the ‘Select Faces’ right-click functionality for each material in the Meshes and Materials script I’ve been working on. With a mesh selected and a material selected in the list, right-clicking on the material will give you the option to pick. ‘Select Faces’. Picking this option will select the faces that have that material applied to them. I want to work add adding an ‘Apply Material’ option for the right-click menu, that way you can easily apply a different material from the same mesh to other faces. It will be the last thing I’ll add to this script before I move on to something else. I’ll let you know what that is once I finish my work on Meshes and Materials.
This week I’ve continued my work on Meshes and Materials by adding some functionality to the script. First, when the script is run, the ‘Meshes’ list is filled with all polygon meshes in the scene. Secondly, when a mesh is selected in ‘Meshes’ list, all the materials that are assigned to that mesh are displayed in the ‘Materials’ list. For each item in either list I created a right-click menu with ‘Rename’ and ‘Open Attribute Editor’ as options for the selected item. Currently only the ‘Open Attribute Editor’ option works. I’ll work on the ‘Rename’ functionality next weekend. Some other functionality I’ll try to add a ‘Frame Selection’ functionality when the mesh is selected and ‘Select Faces from Material’ when the material from the ‘Materials’ list is selected. So far a so good, I was able to reuse some of the scripts I wrote for JC_selectFacesSameMat and use a lot of what I learned from my readings through Professional MEL Solutions for Production. It’s all coming together.
So for this weeks script I decided to create something that will use some if not all of script I made last week. At least it will eventually use them. For Meshes and Materials I’m creating a small UI that will work as follows:
1. When you run the script a list of all the meshes in the currently opened file will be displayed in a scrollable list (I may or may not select the mesh at the top of the list by default).
2. When you select a mesh on this list, it will populate a second list in the UI that will show all of the material applied to the selected mesh. Selecting a new mesh in the first list will update the second list with a new list of materials. Also each selection will frame that mesh in the view port.
3. Selecting a material name in the second list will select all the faces on that mesh that are assigned the selected material. Selecting a new material on the list will then refresh the selected faces. Selecting the material will select it in the Hypershade and also open the Attribute editor.
4. I will also add a right-click functionality that will allow you to rename the mesh or material. Right-clicking on a material will also give you the option of assigning that material to the current selection.
5. Finally, there will be a refresh button to force a refresh of newly added meshes and materials, though that should happen automatically. I added it just in case. Currently they are two buttons, but I think I can turned this into one.
Today I worked on building the UI and next week will see about adding some of this functionality. This could be a multiple week project but should turn out something fruitful.
Similar to my ZBrush Sculpt of the Day, I’ve decided to give myself one day (more than likely half a day since I’m probably going to do this on the weekends) to come up with a script that will allow you to do something useful in Maya. Today I decided to create a script that will select all the faces on a single mesh that have the same material applied to them. A very handy script I would say. Though Maya does have a “Select Objects with Materials” option in the Hypershade –> Edit menu, it selects everything that has that material. With this script, if you select a single face and run the script, all faces on that single mesh will be selected. Handy if you want to change those faces to another material. It will also select the material in the Hypershade as a bonus in case you want to apply that material to something else.
The script itself could probably have been edited further to be a bit more efficient, but this is just an exercise in trying to put together something quickly that works. Unfortunately I can’t upload .mel files to WordPress so I’ve attached a link here to a Word .doc if you’re interested in checking it out. To run the script, you can easily paste the code to Maya’s Script Editor, save it to your script folder and call as a MEL script command JC_selectFacesSameMat.
The way it works is pretty straight forward. The script first finds the Shading Group and Material of the selected face (wanted to be sure that it had both of these in case a Shading Group was shared). Then it tests to see if the other faces on the mesh have the same Shading Group and Material assigned. If so, it add stores those and when it finishes iterating through all the faces, will select only the faces that match.
Enjoy, I hope you find this useful.
So for those of you making the transition from MEL to Python (like me) when scripting in Maya, I’m pleased to share with you a great resource for getting up to speed. Chris Zurbrigg has a great many tutorials to learn Python, the differences between it and MEL and also a few projects. I’ve just started going through these and feel extremely confident that what I’m learning is going to make my transition into working in Python for Maya extremely quick.
He also has a Maya plugin called Charcoal Editor which is a fantastic upgrade to Maya’s Script Editor. I’ve been using the Demo version and though it won’t allow you to save files it has plenty of functionality. I will most likely buy a license after finishing up with his tutorials. I may even buy two so that I have one handy for working on MAC as well.
Any way, if you’re at all interested in transitioning from MEL to Python, I highly recommend you visit Chris Zurbrigg’s site.
So along with my attempts at picking up shader programming and 3D Math, I’ve squeezed in a bit more of Maya MEL Scripting to keep improving my programming/scripting skills. The most recent book I’ve gone through is, MEL Scripting for Maya Animators. Even though it’s been 8 or so years since the second edition of this book was released, it still contains quite a bit of useful information. Especially the many chapters covering how to create custom user interfaces for your scripts. It was one of the few things about MEL that confused me most when first learning so I’m glad it was well covered in the book. I definitely recommend this book if want to learn or refresh your MEL skills like I wanted to.
There are a couple more books on MEL that I’m currently reading through and will post some additional comments on those when I’ve finished working through them. Professional MEL Solutions for Production and Complete Maya Programming: An Extensive Guide to MEL and the C++ API. “Well look at you Mr. Fancy Pants.” After finishing these, then I’d like to go through Complete Maya Programming: An In-depth Guide to 3D Fundamentals, Geometry, and Modeling, Volume II and MEL Scripting a Character Rig in Maya. What have gotten myself into! I think the 3D math primer I’m also currently reading will help me out quite bit with Volume II of Complete Maya Programming.
So yeah, I’m keeping myself quite busy with some of my free time. Hopefully I’ll leave myself enough time to write more scripts for Maya that I’ve neglected because of all the books I’ve picked up. In any case, wish me luck as I continue my pursuit of becoming a better technical artist.
In my previous post, I talked about learning the Cg Shader language. But the further I got along in my readings, the more I felt I needed to expand my knowledge of 3D Math. In my attempt to jump into Cg programming quickly, I skipped over (what I believe) important prerequisites. So at this time, I’ve paused my readings of The CG Tutorial and have dived into 3D Math. I asked a few of my colleagues at Kixeye if they had any suggestions of where to start and they provided me with a great number of resources to check out.
The first resource I decided to check out is in my digital bookshelf, 3D Math Primer for Graphics and Game Development. The book present the subject of 3D math in a very concise and readable fashion. It’s been a while since I’ve tackled math in general but with the overall goal of writing my own shaders, the task of learning/relearning math has been enjoyable. I hope the skills I learn from this book will give me a better understanding of some of the topics discussed in The CG Tutorial. Wish me luck in my mathematical journey.
If you’re interested, you can check out the companion website for the aptly named: http://gamemath.com/