Cameron

 

Here’s something I whipped up in a couple of hours earlier this morning.

A 3D character from Cyanide and Happiness composited onto a photo

It features a 3D character from the web comic, Cyanide and Happiness. I’ve rigged him and posed him sitting on something in the scene. I used a panoramic latitude longitude image for the environment’s lighting and 3Delight using my custom shaders. Here’s a few example passes that I also rendered out to help in the composite:

The character from Cyanide and Happiness is one that I modeled and rigged before for a different piece. I created this Cyanide and Happiness scene in 3D and composited it onto a photo I took as an exercise to use 3Delight with my custom point cloud based shaders to composite a 3D character onto a background photo-realistically.

 

For those of you interested in creating “3D” 3D images using 3Delight, here’s a quick little starter for you. You can render from multiple cameras at the same time in the same render pass and save LOADS of rendering time while doing it.

This post will assume that you have created a stereo camera rig in Maya.

Under your 3Delight Render Pass, change the rendering camera to be the center camera, which should be something like stereoCameraCenterShape.

Now, this next step will be dependent on what kind of AOVs and displays you want to render to. In my example, I’m rendering “rgba” as well as “AO” with an alpha channel and exclusivity. In Pre World MEL under the MEL section of the render pass, tweak and add this:
RiDisplay -n "+/path/to/image/rgba_#4f.right.tif" -t "tiff" -m "rgba" -p "camera" "string" "stereoCameraRightShape";
RiDisplay -n "+/path/to/image/rgba_#4f.left.tif" -t "tiff" -m "rgba" -p "camera" "string" "stereoCameraLeftShape";
RiDisplay -n "+/path/to/image/AO_#4f.right.tif" -t "tiff" -m "color aov_AO,alpha" -p "camera" "string" "stereoCameraRightShape" -p "exclusive" "int" "1" -p "exclusive" "int" "1";
RiDisplay -n "+/path/to/image/AO_#4f.left.tif" -t "tiff" -m "color aov_AO,alpha" -p "camera" "string" "stereoCameraLeftShape" -p "exclusive" "int" "1" -p "exclusive" "int" "1";

When you render, this will render .tif files for the left and right cameras for those two AOVs. You can and should tweak this to fit what you need. Then, you can combine the two 3D images in a compositing program to create a 3D stereoscopic image.

For more information on what options you can tweak (such as pixel filters, associating alpha, etc) consult the 3Delight Studio Pro and 3Delight for Maya User Manuals. The general format for adding parameters to the Display portion of the RIB is:
-p "PARAMETER" "TYPE" "VALUE"

 

It’s been a while since I’ve posted anything here, but I’ve been really busy. The fact that I do most of this stuff when I’m at work means that when I’m at home, I don’t want to do it that much anymore. With that said, I’ve felt the urge to start something small here. Less time spend making things means more time spent observing things, and today I wanted to create something small. I used to love making interiors, and I haven’t gotten to do one lately. So, I decided to make a very quick (gave myself two hours) interior kitchen scene. After doing this, I realized that I could create a few very targeted interior scenes without putting days of work into each. So you might expect more from me in the next few weeks as I find some time.

3D Kitchen scene

Also, I’ve been doing a lot of things 3Delight related (including rewriting all of my shaders). Expect updates on those as well.

 

Sometimes you need to store something for later while using Python. For large cases, you might even need a database. In this example, I’ll show you how to pickle a Python object and store it into a MySQL database.

Pickling in Python is a way of storing sometimes complex data structures into a binary representation that can be unpickled later to get back the same data structure. For instance, a list of nested lists will pickle and unpickle into the same list of nested lists.

In this example, I’m assuming there is a MySQL server at ‘localhost’, with the user ‘pickle’ / password ‘cucumber’ granted rights on the database ‘lists’. In that database is a table called ‘pickleTest’ with the following columns:

ID: a standard auto-incrementing ID int field
Name: a character field for a name
List: a binary BLOB field for storing pickled things

See the commented script which you can run yourself for an example of how to use the pickle module along with a MySQL database to store mass amounts of Python structures that you can retrieve later and unpickle back into the original structure.

It goes over connecting to the database, pickling a semi-complex list, storing the list, retrieving the results, and then unpickling back into the original list.

import cPickle
import MySQLdb

## Create a semi-complex list to pickle
listToPickle = [(10, 10), (20, 10.0), (1.0, 2.0)]

## Pickle the list into a string
pickledList = cPickle.dumps(listToPickle)

## Connect to the database as localhost, user pickle,
## password cucumber, database lists
connection = MySQLdb.connect('localhost','pickle','cucumber','lists')

## Create a cursor for interacting
cursor = connection.cursor()

## Add the information to the database table pickleTest
cursor.execute("""INSERT INTO pickleTest VALUES (NULL, 'testCard', %s)""", (pickledList, ))

## Select what we just added
cursor.execute("""SELECT features FROM pickleTest WHERE card = 'testCard'""")

## Dump the results to a string
rows = cursor.fetchall()

## Get the results
for each in rows:
	## The result is also in a tuple
	for pickledStoredList in each:
		## Unpickle the stored string
		unpickledList = cPickle.loads(pickledStoredList)
		print unpickledList

 

There is a new script in the code section. It is another python for Maya script. This script makes it possible (and super easy) to export your Maya scene to After Effects to add in some composite elements matched to the 3D scene. It bakes out the cameras and objects of your choice, placing locator nulls for each object. Also, it will scale the entire scene up by an amount that you choose to make it much easier to edit in After Effects, because After Effects reads in every unit in Maya as one pixel.

 

Just posted a new script in the code section. You might have to refresh the blog to get it to show up in that menu, though.

Basically, it’s a python script for Maya that will randomize keyframe values and frames for the selected objects. Very useful if you have a lot of objects doing the same animation and you want to change it up a little so it’s not so mechanical.

 

I’m sure you’ve had this, multiple render layers, different shaders on each. Eventually, it will break. Especially if you’re assigning materials on a per-face basis.

It’s better to not do that. But, whenever you have a scene that breaks and your renders are unpredictable, you can use this to fix it.

fixRenderLayerOutAdjustmentErrors;

Run that MEL command. That should fix some of the errors. Sometimes, it will revert whenever you save and close the file, but you can run it again whenever you open the scene again.

 

Quite the update.

For one, www.cameronleger.com is now completely different. I have updated it to allow me to much easier add new content to it later on, and it looks a bit different.

This blog is now completely different.

Check out my demo reel. You can find it on my new website or watch it at the end of this post.

There’s a new navigation feature at the top of this site. It’s all outside links to my other information, except for that code tab.

That tab is now where all of my writing will go. I will post updates here about new things in there, but I will link directly to them because that is what I’ll be updating.

Let me know what you guys think.

httpvh://www.youtube.com/watch?v=djYeVGR0lic

 

And what it would have been like if HAL was run using Linux:

Dave: Open the pod bay doors, HAL.

HAL: I’m sorry Dave, I’m afraid I can’t do that.

Dave: sudo open the pod bay doors HAL.

HAL: Opened.

 

Rather than:

Dave: Open the pod bay doors, HAL.

HAL: I’m sorry Dave, I’m afraid I can’t do that.

Dave: What’s the problem?

HAL: I think you know what the problem is just as well as I do.

 

 

Few pics I just got off my camera from the snow.

© 2011 Cameron's Blog Suffusion theme by Sayontan Sinha