Adding Videos to Meshes

Here is an example. After you download this, assign your own movies on the b1 and b1 objects.  Many different formats work.  Check here. for more information on use of the VideoTexture object.  There is a big thread on this subject in the Blender Artists forum.

Here is an example on how to change video on 18 meshes while blender is running.  Cut the number of meshes down if it isn’t working on your computer.

How to do it:

  • Add a string property called video on a child object that has the name of the movie file
  • Make sure the Texture Buttons, Image Tab, Image datablock is named objectName.png.  Unfortunately these cannot be shared and they have to be loaded from seperate files.  On Unix  you can just use symbolic links.  objectName.png only has to be a small .png file with a any color.
  • Optionally define a start time with a float property called videoStartTime and an end time with a float property called videoEndTime
  • Optionally define a random start/end time with a bool property called videoRandomTime set to True.  If you do this, set another float property called videoMinTime to specify a minimum time.  If you want to globally define random times, set these same variables in the _init object.
  • Optionally define a frame rate with a float property called videoFrameRate.  If you have lots of videos the frame rate could take a while to stablize after a change, especially for rates  greater than 1.
  • Start the game engine, hit reset in pd, then hit go.  It should work fine

How to change video size using blender:

  • Create a new blender document, go to the sequence editor and your movie to the sequence
  • Go to the Render Buttons
  • Choose the size you want (power of 2 for width and height)
  • Choose the end frame
  • Choose the movie type (I use QuickTime on my Mac)
  • Select Sequence
  • Hit Animate
  • When done, copy the resulting file to a place where you want
  • In the .blend file do the usual thing for creating a video texture
  • To use random start/end times create a bool property on the _init object called RandomVideoLength set it to True.  Then create a float property called MinVideoTime and set it to the minimum time you want each clip to play.

Image Sequences:

  • You can specify an image sequence by giving a folder name instead of video file name.  This seems to work pretty well and allows up to do things like make images with transparent backgrounds

Notes:

  • The movie must have length/width that are a power of two or else you will have bad results on speed change
  • Make the movie as small as you can get away with.  Larger movies mean fewer movies
  • Make movies that switch on the same mesh an identical number of frames.  Here is an example of a .blend file that uses the blender video sequence editor with appropriate render settings (eg: 25 frames/sec 128×128 QuickTime output) to create a video.  Call it from a shell script like this:
    • blender -b makeMovie.blend -s 1 -e 100 -a

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>