Sunday, July 13, 2008

Animating a piston in Maya


Making a piston move correctly can be tricky, but here is a way to do it. I'm using expressions to solve it, because this makes it a bit easier and manageable.

First of all, consider this picture:
The distance between the center of the wheel is the sum of x1 and x2. Finding x1 is simple trigonometry (x1 = cos(rotation of the wheel)*L1).

Finding x2 is a bit trickier. Not much though.

Y, L2 and X2 also forms a triangle. We can set L2 to whatever length we want it to. Y varies with the rotation, and can be found with sin(rotation of the wheel)*L1.

So, we know have L2 and Y, and using Pythagoras theorem, we can calculate x2.

The code can look something like this:

float $l2 = 10; // Decide on L2
float $y = LOC_Radius.translateY*sind(LOC_Center.rotateX+90); //Calculate Y
float $x1 = LOC_Radius.translateY*cosd(LOC_Center.rotateX-90); //Calculate x1

float $x2 = sqrt($l2*$l2-$y*$y); //Calculate x2 from y and L2
LOC_Piston.translateZ = $x1+$x2; //Add x1 and x2 together to get the total translation.


LOC_Radius - where the first cylinder connects to the wheel
LOC_Center - Center of the wheel
LOC_Piston - the "pushing point" of the piston

After that, I just added some geometry to the locators so that it looks like a wheel and a piston. Mostly done with some parenting, point constraings and one aim constraint.

The result can be seen here:

Sunday, April 27, 2008

Command line rendering and render queues in Maya

One little nifty trick one can do is to use the command line renderer that ships with maya. Or rather: When you start the Batch render -process from within maya, you are actually starting a separate process. Thing is, you can start this process from outside of maya, using just the command prompt. There are some advantages to this, two of these are
- Not having to spend system resources on Maya itself, the renders are slightly faster
- With a simple trick, you can put multiple scenes on queue.

The basics are simple, just open a command prompt from windows (or open the Maya Terminal in OSX). type Render myscene.mb.

Now, there are many flags you can set when using this command, but if everything is set in maya, that is all there is to it. Some other useful flags follow here:

-x int and -y int : The resolution of the Render
-s int and -e int: The starting frame and the last frame of the render
-rd : output directory
-im : output image file name

Render Queue

In windows, you have something called batch-files. These are text files that can contain several command prompt commands. For instance, you can create a file called myRenders.bat. In it you have two lines
Render scene1.mb
Render scene2.mb

When you run the batch-file (double click it or type myRenders.bat in the command prompt, the two commands will run after each other. In this case, you will render out first scene1 and then scene2.
This is useful if you have multiple scenes you want to render overnight. Just type a number of Render-commands in a batch file and you are ready to go.

With the use of flags, you can make multiple renders of the same scene as well. For instance, it would be easy to make a batch-file that did both the entire scenes, and also rendered out a particular frame from each scene in higher resolution (if you would want something like that.)

Monday, April 07, 2008

New book on Renderman

Two days ago I recieved a book I ordered. It's called The Renderman Shading Language Guide and is a thorough introduction to shader programming using the Renderman Shading Language.

So far it seems very good, although it focuses perhaps a bit to much on peripheral things like how to put up a good development environment rather than the actual programming. With that said, however, it seems like it goes into a great depth on shader programming. I will return with a more exhaustive review when I have read it through.

The official site of the book

Wednesday, April 02, 2008

3Delight - A high-end production Renderman renderer

I have been interested and fascinated by the Renderman renderer for quite some time now. It has, however, been slightly out of my reach due to it's costs. After looking at some of the open-source solutions out there I finally found the 3Delight engine. It's a profesional Renderman compliant engine that is used in high-end productions. It also integrates with Maya and XSI.

The cool thing is that they let you use the first license for free, including for commercial use. I have recently downloaded it and done some simple tests. I will return with more info and tips when I get more experience with it.

If you want to try it out for yourselves, the link is www.3delight.com

Friday, March 28, 2008

Combining two bump maps in Maya

Sometimes you want to combine two bump maps in Maya. How to do this isn't entierly clear, however. What you need to do is the following:

Let's say we have got two textures, textureA and textureB. We want to use them both as a bump map in maya.
  • Connect the two textures to a bump2d-node each
  • Connect one of the bump2d-nodes to the other.
    • bump2d1.outNormal -> bump2d2.normalCamera
  • Done!
The outNormal and normalCamera-attributes can be Hidden, and if you don't see them, check Left Display->Show Hidden and Right Display->ShowHidden in the connection editor.


Sunday, March 23, 2008

Interesting read

Pixar has published a lot of papers on their different techniques on they used in their movies. They can be a bit technical, but interesting nonetheless.

http://graphics.pixar.com/



Monday, March 03, 2008

File Formats

.. is not something to be taken easy. I did a little study today, and found out, among other things, the following.

  • Although Mental Ray supports the z-channel in OpenEXR, Mental Ray for Maya doesn't.
  • RLE is an 8-bit format, but makes for the smoothest workflow when you need a z-channel from Maya to Adobe After Effects.
  • iff can be used as a 16-bit format, but isn't widely supported
  • Maya has a very short range in it's z-channel (from 0 to 1 at the most)
More points to be added as they show up..

Tuesday, January 22, 2008

More alien abstracti-isms

Another work of abstract Maya-art. My aim is to rediscover the joy and experimentation of 3d-work.

Sunday, January 20, 2008

Experiment with abstract forms

This week I did some experimenting with abstract forms. I like the combination of organic irregular shapes and the contrasting regular sphere.