Hey Light • Blog http://blog.heylight.com Most recent posts at Hey Light • Blog posterous.com Mon, 26 Sep 2011 00:47:00 -0700 Technical Notes http://blog.heylight.com/technical-notes http://blog.heylight.com/technical-notes

Screen_shot_2011-09-26_at_12
I recently started documenting technical issues that I encounter or things that I learn during my Maya scripting projects, and decided to share the notes with the public. I hope others will find it useful when troubleshooting. Click here to see the docs.

Permalink

]]>
http://files.posterous.com/user_profile_pics/538977/crop.jpg http://posterous.com/users/5AAXhr6HChod Daniel Vasquez danvas Daniel Vasquez
Fri, 16 Sep 2011 14:22:00 -0700 Curve Vectors Tool http://blog.heylight.com/curve-vectors-tool http://blog.heylight.com/curve-vectors-tool

1
2
3
4
5
6
7
8
9
10
11
12
def vect(curv, pt2 = 1, pt1 = 0):
    """Returns a vector from two cvs on a curve. The argument curv is a PyMEL instance or string. For example:\vect('curve1', pt2 = 5, pt1 = 2) gives you a direction (i.e. vector) from cv[2] to cv[5] in curve1"""

    if type(curv) == str:
        curv = pm.ls(curv)[0]

    if curv.getShape().numCVs() <= pt2:
        print('\n!! There are {0} cvs. Make sure your pt2 value is less than {0}. !!'.format(curv.getShape().numCVs()))
    else:
       return [curv.cv[pt2].getPosition()[0] - curv.cv[pt1].getPosition()[0],
               curv.cv[pt2].getPosition()[1] - curv.cv[pt1].getPosition()[1],
               curv.cv[pt2].getPosition()[2] - curv.cv[pt1].getPosition()[2]]

This script finds a vector from a curve. I needed it for orienting a follice to the same direction as the curve's base, which corresponds to the first two cvs. After writing it, I realized that using edit points (ep) or curve points (u) would give a more accurate direction. Good enough for now, but will rewrite it.

UPDATE: Turns out that I could just use the pymel function tangent to accomplish the same thing (i.e. finding the tangent at a given point on a curve). For example, to find the tangent at parameter 0, which is the start of the curve, execute curv.tangent(0)

Permalink

]]>
http://files.posterous.com/user_profile_pics/538977/crop.jpg http://posterous.com/users/5AAXhr6HChod Daniel Vasquez danvas Daniel Vasquez
Thu, 15 Sep 2011 01:25:00 -0700 Hair From Particle Paths http://blog.heylight.com/hair-from-particle-paths http://blog.heylight.com/hair-from-particle-paths

I got hooked on my last script (see previous post) and decided to extend it by creating a hair system out of the particle paths. I'll post the script when it's working more smoothly, but here are a couple screencaps.

Permalink

]]>
http://files.posterous.com/user_profile_pics/538977/crop.jpg http://posterous.com/users/5AAXhr6HChod Daniel Vasquez danvas Daniel Vasquez
Fri, 02 Sep 2011 20:45:00 -0700 Curves From Particle Paths http://blog.heylight.com/68136781 http://blog.heylight.com/68136781

Wrote a little script today. It generates cv curves from the path of a particle object or individual particles. Click here to see the code and a demo.

Permalink

]]>
http://files.posterous.com/user_profile_pics/538977/crop.jpg http://posterous.com/users/5AAXhr6HChod Daniel Vasquez danvas Daniel Vasquez
Thu, 25 Aug 2011 18:38:00 -0700 Gitting With It http://blog.heylight.com/67035657 http://blog.heylight.com/67035657

Just learned about Github embedding with Gist. To celebrate the excitement, here are small pymel snippets you may find useful!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import pymel.core as pm

def chDir(object, *filtr):
    """Check methods: Returns a list of methods bound to the instanced object. Filter search with string(s) filtr."""
    if not filtr:
        return [meth for meth in dir(object)]
    
    else:
        return [meth for string in filtr for meth in dir(object) if string in meth]
                    

def lightLinks(breakLink = True):
    """Make or break links of selected lights to selected meshes."""
    lights = [o for o in pm.ls(sl=1) if 'Light' in pm.nodeType(o.getShape())]
    meshes = [o for o in pm.ls(sl=1) if 'mesh' in pm.nodeType(o.getShape())]
    if len(lights) == 0:
        print("// At least one light must be selected")
    if len(meshes) == 0:
        print("// At least one mesh must be selected")
    pm.lightlink(b = breakLink, light = lights, object = meshes)
    if breakLink:
        for l in lights:
            print('// {0} has been unlinked to:'.format(str(l)))
            for m in meshes:
                print('//\t'+str(m))
            print('\n')
    else:
        for l in lights:
            print('// {0} has been linked to:'.format(str(l)))
            for m in meshes:
                print('//\t'+ str(m))
            print('\n')

Permalink

]]>
http://files.posterous.com/user_profile_pics/538977/crop.jpg http://posterous.com/users/5AAXhr6HChod Daniel Vasquez danvas Daniel Vasquez
Wed, 27 Apr 2011 18:11:00 -0700 Rudo The Awkward Alien http://blog.heylight.com/rudo-the-awkward-alien http://blog.heylight.com/rudo-the-awkward-alien

This is Rudo - the awkward alien. Modeling, rigging, and rendering done in Maya.

 

 

 

 

 

 

 

 

 

Permalink

]]>
http://files.posterous.com/user_profile_pics/538977/crop.jpg http://posterous.com/users/5AAXhr6HChod Daniel Vasquez danvas Daniel Vasquez
Fri, 08 Apr 2011 13:50:00 -0700 Selecting Vertices Sharing Two Edges http://blog.heylight.com/selecting-vertices-sharing-two-edges http://blog.heylight.com/selecting-vertices-sharing-two-edges

Screen_shot_2011-04-08_at_1
Here's a Python snippet that selects vertices sharing only two edges (using maya.cmds as mc):

With the mesh object selected,

obj = mc.ls(sl=True)[0]
vertCount = mc.polyEvaluate(obj, v=True)
vertList = ['{0}.vtx[{1}]'.format(obj,vert) for vert in range(vertCount) if len(mc.polyInfo('{0}.vtx[{1}]'.format(obj,vert), ve=1)[0].split(':')[1].split()) == 2]
mc.select(vertList)

The if statement containing the polyInfo command does the filtering by counting the number of edges around the queried vertex. Unfortunately this returns a line of values in a string, so I had to split it a couple times to retrieve the edges count. For example, vertex 302 of 'polySurface' is shared by the edges 506, 489, 484, and 485:

mc.polyInfo('polySurface.vtx[302]', ve=1)[0]
# Result: u'VERTEX 302: 506 489 484 485 \n' #


UPDATE: A vertex sharing two edges is called 'winged'. Here's another way to select winged vertices using PyMEL (as pm)...

obj = pm.ls(sl=True)[0]
vertList = [obj.verts[v] for v in range(len(obj.verts)) if len(obj.verts[v].connectedEdges()) == 2]
pm.select(vertList)

Permalink

]]>
http://files.posterous.com/user_profile_pics/538977/crop.jpg http://posterous.com/users/5AAXhr6HChod Daniel Vasquez danvas Daniel Vasquez
Fri, 25 Mar 2011 00:43:00 -0700 Cache Cloud Is Out http://blog.heylight.com/cache-cloud-is-out http://blog.heylight.com/cache-cloud-is-out

Finally posted my script! It's a utility that creates Maya Particle Disk Cache (PDC) files from a sequence of point cloud data. You can find more information here. Hope you enjoy it as much as I do.

UPDATE: I modified the script so that it contains more classes and documentation (v0.9.0). Unfortunately, it's almost twice as slow as the original release (v0.8.4). Feel free to download the code from my website: http://folio.heylight.com/#958712/Code

Permalink

]]>
http://files.posterous.com/user_profile_pics/538977/crop.jpg http://posterous.com/users/5AAXhr6HChod Daniel Vasquez danvas Daniel Vasquez
Tue, 15 Mar 2011 21:19:00 -0700 Cache Cloud finished http://blog.heylight.com/cache-cloud-finished http://blog.heylight.com/cache-cloud-finished

Screen_shot_2011-03-15_at_9

The past couple of weeks I've been working on a python script that I named Cache Cloud. With all the point cloud data being generated with Kinect hacks and 3D scanners, I thought this would be a useful Maya utility. It writes Maya Particle Disk Cache files using an animation of point cloud data. It's finished, but I'll post some sample videos before releasing the script within the next couple of days. Thanks to this video, I was inspired to write Cache Cloud. Next I'd like to write another one to make nParticle cache files.

 

UPDATE: I added another feature that removes zero-value points; and cleaned up some code which is now making it twice as fast to process.

Permalink

]]>
http://files.posterous.com/user_profile_pics/538977/crop.jpg http://posterous.com/users/5AAXhr6HChod Daniel Vasquez danvas Daniel Vasquez
Fri, 25 Feb 2011 20:05:00 -0800 Installing Amazon EC2 API tools in Linux http://blog.heylight.com/installing-amazon-ec2-api-tools-in-linux http://blog.heylight.com/installing-amazon-ec2-api-tools-in-linux

It took a couple of days, but I finally found out how to configure linux in order to run Amazon EC2 Tools commands. I found some instructions here and there, but I'll provide instructions that are clearer (I hope) to the new Linux user, particularly, running Fedora (RPM-based Linux). Much of it is derived from the aforelinked instructions, so look at those for extra information. You should already know some basic linux commands - and remember that these instructions worked for me in Fedora. 

First of all, what is Amazon EC2? 
It's a web service by Amazon that provides resizable (i.e. 'elastic') processing capacity in the cloud. You can read all about it on the Amazon AWS site
Why do I need it? 
It's mainly used as a scalable platform for web applications, and you only pay what you use (bandwidth and cores-per-hour). You can basically use it to harness scalable processing power at your own disposal. I intend to use EC2 as a virtual render farm. Conveniently, there's an AMI available for rendering in mental ray, called mental cloud direct. I'm sure more 3D-specialized AMIs will be popping up.
There's already a GUI on their website (AWS Console), why should I use the Amazon EC2 API tools in Terminal?
To do fun programming things! 

 

Let's do this.
1.  Set up an Amazon AWS account and sign up for EC2.
2.  Under Account, click on "Security Credentials" and go to "Access Credentials".
3. Create a new Access Key and a new Certificate (X.509), if you haven't already done so. These should generate:

     - a PEM encoded X.509 certificate named something like cert-xxxxxxx.pem
     - a PEM encoded RSA private key named something like pk-xxxxxxx.pem


4. Download both these files.
5. Download the Amazon EC2 API Tools from here.
6. Open Terminal and in your home folder, create a hidden folder called ec2
[username@local-PC ~]$ mkdir .ec2
7. Navigate to your downloads folder (or wherever your default downloads folder is).
[username@local-PC ~]$ cd Downloads
8. Extract the ec2-api-tools.zip file to the .ec2 folder.
[username@local-PC Downloads]$ unzip ec2-api-tools.zip -d ~/.ec2
9. Move the PEM files to the .ec2 folder.
[username@local-PC Downloads]$ mv *.pem ~/.ec2
10. Check the .ec2 folder. You should have the two PEM files and the extracted ec2-api-tools folder (which, in my case, is called "ec2-api-tools-1.3-62308").
[username@local-PC Downloads]$ cd ~/.ec2
[username@local-PC .ec2]$ ls
11. Move the directories "bin" and "lib" from the ec2-api-tools folder (in my case, "ec2-api-tools-1.3-62308") to the .ec2 folder.  
[username@local-PC .ec2]$ cd ec2-api-tools-1.3-62308
[username@local-PC ec2-api-tools-1.3-62308]$ mv bin lib ..
12. Now we will need to set some environment variables. So, become root. Before moving on though, you might want to read about becoming root as it's slightly different for other linux distributions such as Ubuntu.
[username@local-PC ec2-api-tools-1.3-62308]$ su -
[root@local-PC ~]# 
13. Make sure the file .bash_profile is in the root directory (using the '-a' flag to list hidden files)
[root@local-PC ~]# ls -a
     If you like, see what's inside this file. It's fascinating.
[root@local-PC ~]# cat .bash_profile   
14. Add environment variables to .bash_profile (Note: Don't confuse the backtick ` with the single quote ' !)
[root@local-PC ~]# echo '# Setup Amazon EC2 Command-Line Tools' >> .bash_profile
[root@local-PC ~]# echo 'export EC2_HOME=/home/username/.ec2' >> .bash_profile
[root@local-PC ~]# echo 'export PATH=$PATH:$EC2_HOME/bin' >> .bash_profile
[root@local-PC ~]# echo 'export EC2_PRIVATE_KEY=`ls $EC2_HOME/pk-*.pem` ' >> .bash_profile
[root@local-PC ~]# echo 'export EC2_CERT=`ls $EC2_HOME/cert-*.pem` ' >> .bash_profile
     ** Important! Notice for the EC2_HOME path, I used "/home/username/.ec2". You must change the "username" according to your directory's name - where you created the .ec2 folder in step 6. **
15. Check the file to make sure it was all set fine
[root@local-PC ~]# cat .bash_profile
16. Set up Java (Note: This involves removing default java from your system.)
[root@local-PC ~]# yum remove java java-devel
17. Navigate to the "/usr" directory and make a java directory 
[root@local-PC ~]# cd /usr
 [root@local-PC usr]# mkdir java
 18. Navigate to the newly created java directory and download the latest Java.
[root@local-PC usr]# cd java
[root@local-PC java]# wget -O jre-rpm.bin http://javadl.sun.com/webapps/download/AutoDL?BundleId=47142
       Note: You can use an arbitrary name (safe .bin) in front of the '-O' flag. In this case, I've used "jre-rpm.bin". For the download address, I just used the URL from the Linux RPM download in the Java site. You can do some other things with wget.
19. Change the permissions of the file you downloaded to be executable and unpack it
[root@local-PC java]# chmod a+x jre-rpm.bin
[root@local-PC java]# ./jre-rpm.bin

      Note: In this case, it unpacked a file called "jre-6u24-linux-i586.rpm"


20. Start installation process, which will create a folder called "jre1.6.0_24" in this case.

[root@local-PC java]# rpm -iv jre-6u24-linux-i586.rpm

21. Now set final environment variable in .bash_profile.
[root@local-PC java]# echo 'export JAVA_HOME=/usr/java/jre1.6.0_24' >> ~/.bash_profile
22. Almost done... just reload your .bash_profile
[root@local-PC java]# source ~/.bash_profile
23. Start using EC2 commands! You can start with a command to display all Amazon-owned images. (Note: You don't have to change your working directory, but still must be root.)
[root@local-PC java]# ec2-describe-images -o amazon

 

We can continue trying things with the EC2 commands, but I'll stop here. For example, look under "Creating and Connecting to a Server Instance" in Robert Sosinski's tutorial. I hope it works for you. If you have any questions, email me. As I'm still learning Linux, there might be a more proper way. I need food.

Permalink

]]>
http://files.posterous.com/user_profile_pics/538977/crop.jpg http://posterous.com/users/5AAXhr6HChod Daniel Vasquez danvas Daniel Vasquez
Sun, 20 Feb 2011 17:15:00 -0800 Importing Point Cloud Data http://blog.heylight.com/point-cloud-data http://blog.heylight.com/point-cloud-data

I was inspired by the making of a music video and wanted to try the same thing using their data with Python in Maya. I also ended up trying it with the House Of Cards data. Eventually, I'll make a GUI that allows for easy point cloud data import into Maya. I wonder how this data can be used for polygon modelling - something else to try.

 

Permalink

]]>
http://files.posterous.com/user_profile_pics/538977/crop.jpg http://posterous.com/users/5AAXhr6HChod Daniel Vasquez danvas Daniel Vasquez
Thu, 07 Oct 2010 22:32:00 -0700 Mark V Helmet http://blog.heylight.com/mark-v-helmet http://blog.heylight.com/mark-v-helmet

I finally found some time to work on the helmet again and finally arrived at a point where happy with the model. Now I can move on to some shading tweaks and detailing the textures in Mudbox. It's way too crisp and shiny. Although, this probably won't get done until I get back from South America in a few months. A la proxima...

Permalink

]]>
http://files.posterous.com/user_profile_pics/538977/crop.jpg http://posterous.com/users/5AAXhr6HChod Daniel Vasquez danvas Daniel Vasquez
Wed, 21 Jul 2010 17:25:00 -0700 Stellated Dodecahedron http://blog.heylight.com/stellated-dodecahedron http://blog.heylight.com/stellated-dodecahedron

My_hipstaprint
Last Monday, I learned some modular origami with friends at VHS' Crafter Night (organized by Emily). Check out some of the photos here and here. Thanks to Mathew Arthur for teaching us the ways!

Permalink

]]>
http://files.posterous.com/user_profile_pics/538977/crop.jpg http://posterous.com/users/5AAXhr6HChod Daniel Vasquez danvas Daniel Vasquez
Sat, 19 Jun 2010 01:46:00 -0700 Wiggle Stereoscopy http://blog.heylight.com/wiggle-stereoscopy-3 http://blog.heylight.com/wiggle-stereoscopy-3

Flowers

I tried out this Processing code to make some 'wiggle stereoscopy'. It would be cool to use this technique in a video.

Permalink

]]>
http://files.posterous.com/user_profile_pics/538977/crop.jpg http://posterous.com/users/5AAXhr6HChod Daniel Vasquez danvas Daniel Vasquez
Fri, 18 Jun 2010 12:38:00 -0700 Thermal camera effect test. http://blog.heylight.com/thermal-camera-effect-test http://blog.heylight.com/thermal-camera-effect-test

Testing to emulate a thermal camera as close as possible with After Effects. As a reference, I used a video that was recorded with the FLIR camera. First I tried a tutorial where they use Photoshop, but it turns out that the Colorama effect in After Effects works just as well. 

I still need to figure out a good algorithm that translates a color sample to a temperature value (click here for a simple example). There's a few more details that I need to work on. For example, if you watch the real footage, you may notice the shifting in the color phase, as indicated in the right-side gradient bar. This is also accompanied by the shift in the high/low threshold temperatures. Hopefully I'll get a decent-looking thermal camera effect for a piece I'd like to do.

Permalink

]]>
http://files.posterous.com/user_profile_pics/538977/crop.jpg http://posterous.com/users/5AAXhr6HChod Daniel Vasquez danvas Daniel Vasquez
Fri, 11 Jun 2010 00:48:00 -0700 Science Demo Reel http://blog.heylight.com/science-demo-reel http://blog.heylight.com/science-demo-reel

 
This is a compilation of the work I've done at STEMCELL Technologies. My main roles were concept and script development, and 3D animation. (Click on the Flickr set to see the breakdown details.)

Permalink

]]>
http://files.posterous.com/user_profile_pics/538977/crop.jpg http://posterous.com/users/5AAXhr6HChod Daniel Vasquez danvas Daniel Vasquez
Fri, 04 Jun 2010 22:49:00 -0700 Particular Spores http://blog.heylight.com/particular-spores http://blog.heylight.com/particular-spores

I started playing around with Trapcode Particular in After Effects today by following Andrew Kramer's tutorial.  This could be useful for cool microscopic visualizations. 

Permalink

]]>
http://files.posterous.com/user_profile_pics/538977/crop.jpg http://posterous.com/users/5AAXhr6HChod Daniel Vasquez danvas Daniel Vasquez
Wed, 26 May 2010 23:38:00 -0700 AR Hippo http://blog.heylight.com/ar-hippo http://blog.heylight.com/ar-hippo

 

In this piece for Telus, I created all of the 3D assets: model, texture, and animation. (Click HERE to see the playblast animation.) It was mainly done in Maya, but the texturing was done in Mudbox. The toughest part was finding the best settings to export to Collada format. The plugin that I used didn't seem to support blendshapes, so the skeleton had to be built to also drive the face gestures. (Luckily, this hippo didn't require complex gestures!) It was a fun little project.

Roles:

Alex Beim - Creative Director

Jay Pozo - Programmer

Daniel Vasquez - 3D Artist

 

Permalink

]]>
http://files.posterous.com/user_profile_pics/538977/crop.jpg http://posterous.com/users/5AAXhr6HChod Daniel Vasquez danvas Daniel Vasquez
Thu, 18 Feb 2010 07:56:00 -0800 Mark-V in Mudbox http://blog.heylight.com/mark-v-in-mudbox http://blog.heylight.com/mark-v-in-mudbox
A few months ago, I started working on a Mark V helmet, off and on. I was quite happy with the shading, but not so much with the texturing. I wanted it to look more heavily used and corroded. So just today I returned to this project and started using Mudbox on the model I had built in Maya to get the finer details. I've always wanted to learn Zbrush, but it seemed that Mudbox was the way to go because of its similarities with Maya's interface. So, I'm learning Mudbox... and it's very fun.
 

Permalink

]]>
http://files.posterous.com/user_profile_pics/538977/crop.jpg http://posterous.com/users/5AAXhr6HChod Daniel Vasquez danvas Daniel Vasquez
Thu, 11 Feb 2010 04:49:00 -0800 Eire Bodies http://blog.heylight.com/eire-bodies http://blog.heylight.com/eire-bodies

Permalink

]]>
http://files.posterous.com/user_profile_pics/538977/crop.jpg http://posterous.com/users/5AAXhr6HChod Daniel Vasquez danvas Daniel Vasquez