Friday, December 14, 2012

Styling Hair Tutorial [External]

http://area.autodesk.com/tutorials/the_blue_project_skin_sculpting_and_hair_styling

There's a really great tutorial on Area that's been there for a while.  It briefly steps you through texturing a character in Mudbox, then gets into creating a hairstyle in Maya.  Please note that it's for Shave and a Haircut, not Maya Hair.  It's really great and worth the look if you're just getting started with Shave and a Haircut.

~Melissa

Friday, November 16, 2012

[Python] Getting an intField to only accept odd numbers

I know it's odd (pun!), but I needed to have an intField only accept odd numbers.  Initially, I'd done something like this:

import maya.cmds as mc def exampleUI(): exampleWin = mc.window() mc.columnLayout() testField = mc.intField(value = 63) number = mc.intField(testField, query = True, value = True) mc.button(label = "OK", command = lambda *args: exampleDef(number) ) mc.showWindow( exampleWin ) def exampleDef(number): if number % 2 != 0: print "It's odd! Yay!" else: print "Your number is even, prepare to die!"

If the value in the intField was odd, continue. If the value was even, error out and prompt the user to change it.  But it didn't do what I wanted, which was to force an odd number.  I didn't know if this was possible, but it sounded like it should have been.  I asked for help on the CGTalk Maya Programming forum and I learned two things.
Click here to see the thread

1) Use the intfield's changeCommand flag.  After the value in the field changed, it would run another block of code that would check whether or not the number was odd.  In the event it found an even number, it would either reset the value or increase the number by 1.

2) Another person agreed with the solution above and took it a step further.  He suggested this, and I think it's brilliant:

def setMyOddInt(integer): oddInt = integer/2*2+1 mc.intField('oddIntField', e=1, v=oddInt) def exampleUI(): exampleWin = mc.window() mc.columnLayout() testField = mc.intField('oddIntField', value=0, changeCommand=setMyOddInt) mc.showWindow( exampleWin )

I really like this bit here "oddInt = integer 2*2+1".  I wondered, why not just check to see if the number was even, and then say + 1 and return the new value?  You can do this and it will work but it would take three lines of code.  Here, it was done with one.

When you divide an int, most (if not all) languages will just round down to the next whole number.  Example, 3/2 will equal 1, not 1.5 (that would be a float, not an integer).

If we continue to use the number 3 as our example, 3/2 = 1.  Then 1*2 = 2 and finally, 2 + 1 = 3.  So you'd end up with your original odd number, 3.  But say we had an even number: 4.  4/2 = 2,  2*2 = 4 then 4 + 1 = 5.  See?  "integer/2*2+1", will always produce an odd number and this number will be placed into the intField automatically because of the changeCommand flag.

In the end, either way works.   As a side note, if you wanted to round down, you could just say -1 instead of +1.

Fun stuff.

I needed this for my hair script, which I'm converting to Python.  Hopefully I'll have more updates on that soon.

~Melissa

Tuesday, November 13, 2012

CGSociety Article - Rock in the Road

Rock in the Road


There's a really great CGSociety feature of Rock in the Road that talks about the road to starting and completing the project.  There's also a forum discussion if you're interested.  If you haven't already seen Rock in the Road, take a few moments and watch it.

~Melissa

Friday, October 19, 2012

Cloth - Level of detail

How much detail should your simulation mesh have?  When do you have too little?  When is it too dense?

That's a good question.

I saw this image a week or so before I went to SIGGRAPH:

It's one of Merida's simulation gowns from Brave.  I think they use a proprietary simulation software (it looks like some super variant of Qualoth to me), but look a the detail they have in the final mesh.  When I went to SIGGRAPH I was lucky enough to ask Claudia Chung (!!!) a question.  What are their simulation times like?  Did they have to wait minutes and minutes per frame, or was it a little faster?  She told me that if it was taking longer than a minute or two a frame, then something was very, very wrong.

For people with average computers like me, I show them this:



(click to view the original size)
Which one of these resembles your simulation mesh?

#1 Doesn't have enough information.  You can work with it, but it probably won't fold well over corners and you won't get nice billowing and wrinkling in your cloth.
#2 Is great and my personal choice.  Sim times are good, and you can get great detail (wrinkles, billowing as the character moves, nice overlap) out of it.
#3 Is too much.  If you have a fantastic computer, you might be able to pull it off.  Maybe.
#4 ... I hope your computer has a will.

I will say this.  Not every cloth object needs to have the same amount of detail.  If it's something that's not seen as much (like an underskirt), see if you can get by with less.  The same goes if your final cloth mesh is thick.  Thick cloth (like leather) wouldn't billow in the wind and fold in on itself as much as something thin (like silk), so you could probably get by with less detail.

EDIT:
Here's something else to keep in mind.

As a reader and colleague pointed out, the poly count of your mesh is also linked to how your simulation works, not just it's visual level of detail.  Take for example the four planes above.  The same settings wouldn't work for all four planes.  If you get the first one to work with a stretch resistance value of 30, the second one will probably need a stretch resistance value of 65 or 70 in order to behave, and so on and so forth.

~Melissa

Tuesday, October 2, 2012

Revisiting dockControl and Python classes

I hate floating windows with the passion of 1,000 red hot suns.  There was nothing I could do about it in version of Maya older than 2011, but now I have the ability to dock windows.  I talked about this in an earlier entry.

I've been watching a series of building UI's in Python by Jeremy Ernst that is just fantastic (and he hates floating windows too!  Yay!)  He uses the dockControl command religiously after video #4.  It's fantastic, but he never really mentions the fact that your script will error out if you use dockControl in a version of Maya that's older than 2011.  He does briefly touch on the fact that you can make docking true or false, but I thought I'd go ahead and share what I did.

If you're using Maya 2011 and higher, the window will dock.  If you're using Maya 2010 or lower, the window will float.

This may not be the most "efficient" way to do this, but it works.  If you know of a better or cleaner way to execute this, feel free to tell me.  I'm not offended if someone sends me an e-mail that says "idiot, you could do this in one line if---"

If you have no idea what the widgets dictionary in this script does, watch Jeremy Ernst's Building Maya Interfaces with Python video series, specifically video #6.  That's where he introduces it.

import maya.cmds as mc
import maya.mel as mel

class suitSuite():
    def __init__(self):
        self.widgets = {}
        self.winName = "suitSuite"
        self.dock = ""
        self.v = mel.eval('getApplicationVersionAsFloat')
        if self.v >= 2011:
            self.dock = True
        else:
            self.dock = False

        self.createUI(self.winName, self.dock)


    def createUI(self, winName, dock):
        #If Maya version is 2011 and above, create a dockable window, else create a floating window
        if dock == True:
            if mc.dockControl(winName + "_dock", exists = True) or 
mc.window(winName, exists = True):
                mc.deleteUI(winName + "_dock")
        else:
            if mc.window(winName, exists = True):
                mc.deleteUI(winName)

        self.widgets["window"] = mc.window(winName, title = "Suit Suite v. 0.1", width = 350, height = 500)
        self.widgets["mainLayout"] = mc.columnLayout(width = 350, height = 500)
        if dock == True:
            mc.dockControl(winName + "_dock", label = "Suit Suite v. 0.1", area = "left", allowedArea = "left", content = self.widgets["window"] )
        else:
            mc.showWindow(self.widgets["window"])



~Melissa

Monday, October 1, 2012

Python and MEL

I don't take full advantage of the fact that Python is an object oriented language.  I'm so used to the procedural MEL that I limit myself in Python.  I was writing a hair script in MEL and decided that Python would be better, but I ended up just writing it in Python the same way I'd done it in MEL.  After figuring out Python's classes and going back to my hair script... wow.  Classes make things so much easier.  I'm still muddling through, but I'm so excited.

I feel like a new world has opened up to me ^_^

~Melissa 

Thursday, September 20, 2012

Understanding Classes in Python

I love Python, but there are some things about Python that I've really been struggling with.  Mainly I'd been struggling with classes, __init__ and the use of self as an argument.  When I saw something like this:

class Introduction:
    def __init__ (self, name):
        self.name = name

I had a small stroke.  What does that mean?  What is the purpose of a class?  Why does "self" keep popping up everywhere?!  I just didn't get it, and every explanation I read was so technical and hard to understand.  Well, I'm an auditory learner so I went to YouTube to see if anyone had explained it.  When I heard this man's tutorial, everything clicked.  If you're having trouble like I was, I think you should take the 12 minutes to watch and listen to this video.


~Melissa

Wednesday, September 19, 2012

This is my life


I feel like this right now.

I hope that one day I'll make it, in the meantime I'll keep brushing up on my Python.  I love Python.  Once I get the hang of classes, I'll be unstoppable!

~Melissa

Monday, September 10, 2012

Rock in the Road - Animated Short

The project in my demo reel is Rock in the Road, a 12 minute animated short that I had the pleasure of working on when I was in college.  It's finished and available to view.  I hope you'll enjoy it in HD and share the link with your friends and family!




In a faraway land, a king governed his realm so well that his people were in want of nothing. As the years passed, the king noticed his people had become lazy and selfish, so he devised a simple test to show them the value of others. As a young boy unknowingly faces the challenge, the future of the kingdom is built on the strength of his character.

In the fall of 2007, Southern Adventist University’s animation students set out to create a three-minute short film based on a simple parable. This artistic venture, intended to be completed during one year, turned into a five-year journey. The result is the twelve-minute animated short, "Rock in the Road."

The scope of the project grew as the team became interested in telling a longer form story. But as students who started it graduated, and other projects were begun, finishing the short became its own “rock in the road.” However, professors and students persevered, realizing the completion of the film would benefit everyone who was involved. A small, dedicated crew worked on it between other projects to finish the film at the end of the 2012 school year.

Saturday, September 8, 2012

Brave thoughts [rant]

Yeah, I'm a copy cat.  A friend reviewed Brave.  I'd been meaning to do the same, but I didn't put fingers to keys until she did.  Oh well.



Brave was a fantastic, beautiful movie that everyone should see.  More talented people that I have reviewed this movie, so I'm not going to.  But I had three issues with the movie that I haven't seen anyone else mention.  Maybe this isn't the place for it, but here we go:

(MASSIVE SPOILERS!!)

1) I never felt like Merida was the star of her own movie.  Just when I was getting comfortable with her character on screen, Queen Elinor stole the show and never gave it back.  The best example of this is the ending.  Merida doesn't get to have a showdown with Mor'du, the movie's antagonist.  Queen Elinor is the one who fights and defeats him.  I would have loved to see the two take equal part in the battle, but it just didn't happen and I HATED that.

I think Brave could have been a better story if it focused on Queen Elinor from the start, or if the creators of the movie put Merida and her mother in a situation where they both had the same risks/rewards.  As it stands, Elinor had the worst of it.  If Merida didn't reverse the curse, Elinor would remain a bear forever and Merida would have one heckuva guilty conscience.  So fairly early on in the movie, I feel more sympathy for Queen Elinor and I'm mad at Merida for putting her in this situation.  I don't think this is what the creators were going for.

2.  The creators didn't take advantage of this huge world they created.  We get sweeping views of a vast country and we hear about other clans yet Merida never travels more than 10 miles from her house.  (Ok, that's a random number I pulled from the sky, but you get my meaning).  It would have been nice to see Merida and her mother travel to more places than the cabin and the ruins.  It also would would have been nice to see more from Merida's three suitors and their clans.  To those who would argue that you can only get so much into one movie, I call BS.  Look at how many unique locations they had in The Incredibles, or even A Bug's Life.

3.  Mor'du is the most random, USELESS antagonist ever.  I don't think his character was integrated into the story well.  In my opinion, his presence in the movie wasn't needed at all.  If the witch who gave Merida the cursed pie said, "to break the spell, you need a tooth of Mor'du!!" or something random like that, I'd get it.  As it stands, I feel like he was just there to add an element of action and danger to the movie.  That in and of itself isn't a bad thing, but I just felt like he was tacked on as an afterthought.

Nitpicking issue 3.5:  Why is it that whenever a woman is a lead in an animated feature, there's an issue with marriage/a man (i.e. Jasmine, Cinderella, Ariel, Belle, [I can keep going]) .  Why couldn't the issue be something more interesting?  Leave behind her dreams of freedom and leading the clan?  Not wanting to go through a rite-of-passage ritual of killing a bear (which, by the way, would have been a fun way to introduce and explain Mor'du).  Heck, I could have settled for Merida not wanting to take up tap-dancing.  But no, the straw that broke the camels back was the thought of an arranged marriage.

Shoot me.