Friday, May 13, 2011

Final

Here is the script for my final. It will take a maya scene, batch render the animation, and composite it over a background image. You can scale the background image however you want, color adjust the foreground animation, and position the animation where you want. The read-me goes into a little more detail. The tools required for the script are Maya (to batch render an animation), Imagemagick (to composite animation over background, plus additional options), and FFMPEG (to compile frames into a movie).

Overall I'm pretty happy with the script. Unfortunately I didn't have time to render out something really impressive with it, but it certainly has the potential to make cool stuff. The script should work with any maya scene or background image you give it, but to make the composite look really good you need to do more work in Maya, such as lighting and rendering. If I had time I would have liked to allow the script to use the background image to automatically create any reflections or color correction in the animation. For example, if there was a shiny robot walking around in a red room, it would be cool to have the red spill onto the robot. This is why I included the option to color adjust the animation, so people could mimic this in way.

I also would have liked to have visited Joe and see what I could have done to make my script better, but my schedule was too crazy (I have Haley postproduction to thank for that). However, I was able to solve my problems and issues without much help, thankfully. I did get some tips from classmates over the past couple weeks though.

Attached is everything you should need. It has the script plus a sample maya file, a sample background image, a read-me, and an example of what the output should look like.

http://www.mediafire.com/?oyw910kpgbjl4f7

Wednesday, May 11, 2011

Journal Post 13 - final proposal

This is the script I've been working on for my final. As of now it takes a movie file, extracts the frames, composites each frame on top of another image, then puts the frames back into a video again. The movie file has to have transparency for this to work well, so animations rendered out of Maya are great. I want to eventually get it so I can batch render out of Maya directly from the script, then composite everything.

Joe and I talked about adding shadows with Imagemagick, but I think I will just use Maya for that. I'll allow the user to render out any lighting they have in the scene. I might have to render out a separate shadow pass, but I'm not sure yet, I'll play around with stuff. I was thinking of also adding an option for the user to color correct the video frames, in case they needed to match them with the background. When I'm done with the script there will be three programs that it uses. They are:

- Maya (batch rendering)
- Imagemagick (compositing, color correct)
- FFmpeg (frame compiler)


Code:

#!/bin/bash

MOVIE=$1
BACKGROUND=$2
OUTPUT=$3
FRAMERATE=$4

echo "script: $0 - Arguments: << input file name >> << background file name >> << output file name >> << framerate >>
echo "arguments used: $@"

mkdir TEMP
mv $MOVIE TEMP
mv $BACKGROUND TEMP
cd TEMP

ffmpeg -i $MOVIE -r $FRAMERATE -f image2 %05d_frame.png

mv $MOVIE ..

IMAGES=`ls *frame.png`
FRAME=0

for IMG in $IMAGES
do
echo "$IMG rendering..."
composite -gravity center $IMG $BACKGROUND $IMG
FRAME=$(expr $FRAME + 1)
done

mv $BACKGROUND ..

ffmpeg -i %05d_frame.png -r 24 -b 2000000 -vcodec libx264 -vpre hq -vpre normal $OUTPUT

mv $OUTPUT ..
cd ..
rm -rf TEMP