California!

A week ago my wife and I bid farewell to the land of Kangaroos, Koalas and drop-bears* and made our way  to sunny California, where people drive on the right side of the road and everybody is in the movie business**. 

Now to find a job! 

* Koalas that don't know how to hold onto a gum-tree and sleep at the same time are colloquially known as drop-bears. 
**Apparently. 

Rise of the Guardians- The Video Game

So... this is what I have been working on since leaving Bluetongue Entertainment in 2011:

KitchenSinkCube SKU coming soon...

Rise of the Guardians is finally out in North America on pretty much any platform you want. Almost any platform anyway. I was one of two level artists for the duration of the project, and I've updated my portfolio website with screenshots of some of my work. 

The game is based closely on the environs of the Dreamworks movie of the same name. In all there were roughly 35 levels that had to be created for the final game which meant that the turn around for each of them was pretty rapid. My favorite level to work on was the snowy Yeti Village. There is something really fun about making ramshackle bridges across deadly, deadly ravines:

The Yeti Village level from Rise Of the Guardians The Video Game.
The game was developed by Torus Games and published by D3Publisher


PIL- Applying a threshold to an image's alpha

If you are using PIL (python imaging library) for batch processing textures you might find this useful.

I used this little bit of code in one of my batch texture reduction scripts to apply a threshold to the alpha channel. This is to make sure it is still one bit after the size reduction, but also leaves the other channels intact.

Here is the snippet:

from PIL import Image

fileName = r'C:\temp\test_image.tga'

#Load the image
try:
    img = Image.open(fileName)
    tempImg = img.load()
    del(tempImg)

except IOError:
    print "*** IOError: %s\n" % sys.exc_info()[1].message

#Test if the image actually *has* an alpha channel
if img.mode in ('RGBA', 'LA') or (img.mode == 'P' and 'transparency' in img.info):

    #create a threshold value
    threshold = 128

    #Create a reference to the alpha channel using the split function
    alpha = img.split()[3]

    #Apply the threshold using the point function
    alpha = alpha.point(lambda p: p > threshold and 255)

    #Paste a copy of the alpha object that has had the threshold applied. 
    img.putalpha(alpha)

print 'Saving', fileName
img.save(fileName)

Challenger II 3d WIP - High Poly

Edit:
I'm grabbing scraps of time here and there to try and finish this one... here is another update to the high poly model...

Smoke candles, updates to periscopes, headlights and hooks.
Lights, tow equipment, first aid box etc etc...


-----
Random non-python update! This is something I have been tinkering with out of hours. Eventually it will be a low poly tank.

The high poly version is based off of a mix of photographic reference and a model kit I have had sitting in the cupboard for too long.

Still a couple of hours worth of work required on the machine gun (which is like a mini project itself!) rear of tank and various greebleish additions...

Challenger II WIP-

Challenger II

Challenger II

Challenger II

Creating and Removing Virtual Drives

Its Friday morning, the weekend is sparkling in front of you and you boot up your work computer only to find that something in the system has hiccuped and nuked all your virtual drive settings.

Even if you don't have an environment batch file or what have you to save the day, it's an easy fix (as long as you know what the virtual drives were linking to!)


Creating a Virtual Drive:


1-Work out what folder you want the drive to link to- eg: c:\projects\myProject\art\
2-Open the command prompt
3-Type in:

subst z: c:\projects\myProject\art\

Presto! z: now links directly to that folder! You can use any drive letter as an assignment as long as it is not currently in use by the system. Good candidates are x:, y: and z: drive letters.

Removing Virtual drives...

Oops... I made a mistake in my path and now it links to c:\whoops\this\is\wrong, and when I try to fix it it keep telling me 'Drive already SUBSTed'

Once again, easy fix! To remove a virtual drive after it has been made, type this into the command prompt...

subst z: /d

And your virtual drive will be removed. This won't delete the data in the drive, just the link to the drive itself. Now z: is free to be linked to the correct folder.

-Pete

PyMel- Getting texture file from a material

So, my first inelegant-yet-functional PyMel script is done and working. The core of it is in this little snippet here, that digs through a mesh's inputs until it finds the texture node on the surface shader:

#Pass through the mesh's shape and return a texture name. 
import pymel as pm

def getTextureFile(geo):

    sg = []

    #Get the shading group from the selected mesh
    raw_sg = pm.listConnections(geo, type='shadingEngine')

    #Rapidly check for duplicates in the list- I do this by checking each item 
    #against an empty list. 
    #If the item is not in the empty list I append it. 
    
    for element in raw_sg:
        if element not in sg:
            sg.append(element)

    #Get some info
    sgInfo = pm.listConnections(sg[0], type='materialInfo')
    fileNode = pm.listConnections(sgInfo[0], type='file')
    textureFile = pm.getAttr(fileNode[0].fileTextureName)



    print 'This is the file', str(textureFile)
    return str(textureFile)
It still leaves a lot to be desired, for instance it doesn't know what to do if a mesh doesn't actually have a texture! But, provided it does, using the win32com module I can then send the texture file information onto Photoshop and Alienbrain and open files/check out texture chains etc etc.

EDIT:
------------------------------------------------------------------------------------------------------------
Thanks to Daydreamer who pointed out the missing pymel reference at the top of the snippet, as well as other issues with the script which I am working through...

After a happy weekend of actually reading part of the official tutorial, I have a slightly better understanding of how to access a mesh's attributes and nodes using PyMel. Here is a snippet of the above snippet that does pretty much the same thing, only using the pymel connections, input and output commands. The intention is only to test the functionality.
    
    import pymel as pm

    geo = pm.ls(sl=True)[0].getShape()

    #Get the shading group from the selected mesh
    sg = geo.outputs(type='shadingEngine')

    #Work through the node to get the file texture name
    sgInfo = sg[0].connections(type='materialInfo')
    
    #It falls apart here if you have no file node! Oops...
    fileNode = sgInfo[0].connections(type='file')

    #Get the file texture name attribute's value
    textureFile = pm.getAttr(fileNode[0].fileTextureName)

    print 'This is the file', str(textureFile)

Getting Maya to talk to Photoshop

Sadly, at work I am not blessed with the latest and greatest Maya versions, and I have to be content with Maya 8.5. That also means I have to be content with Python 2.4.2 in Maya... eh. Its enough to do some cool stuff.

It has been a little pet project of mine to get Photoshop and Maya to talk to each other and share texture information (like texture file locations, etc etc) and after a bit of fussing around, and a total failure to get comTypes to work (missing ctypes module in py 2.4) I have been able to get the win32com module to work within the Maya Python 2.4.2 scripting environment.

I don't think its going to be a two way street, but it does mean I can open a model's source PSD file(s) in Photoshop from within Maya. Kinda a neat little workflow thing.

If anyone wants to share a better method give me a shout!

-Pete