Tuesday, June 24, 2008

imf_disp live

If you ever used maya for any serious production you know that
the final output most likely have to be rendered using the
command line. The reason for doing this could be;
memory issues, need of 32bit images,sequence deployed over
several computers (using a render manager or batch files).

However, sometimes you might want to check out the currently
rendering frame to ensure things are hunky-dory. This is impossible
or so it was before you read this article through. Lets skip some of
the technical mumbojumbo about sockets and image pipes and get
pretty straight to how.

maya comes whit a set of mental ray tools, most notable imf_copy
and imf_disp. imf_copy is mainly used to convert file textures
to mental rays memory mapped .map format. But lets talk about
imf_disp this is what we'll use to monitor our command line
rendered frame. This little image viewer has a built-in feature
to display images as they render.

So how do we use it to monitor our maya command line rendering?

Lets start imf_disp by simply typing it directly in "run" and hit enter.
Ok, we have a rendering running and imf_disp waiting...
theres no image here. We need to tell it which r
endering to display.
As you might noted before as mental ray start
to render an image
file is created in the output directory it looks just like your precious finalRender001.exr waiting to be filled up with those glorious pixel.

the 128kb file

Behold, it is not! It's actually more of a definition file as it contains
information about the rendering such as; width/height, host and port
at which the pixel or framebuffer cou
ld be accessed.
Notice that these files are always 128kb.

If we open one of these 128kb files up in notepad or alike

it'll look like this:
(mental ray version, width, height, host name, socketID, gamma, PID, second socketID)
When the rendering is done the designated framebuffer replaces this
info/placeholder file. If the lines above makes no sense what so ever to
you don't be afraid it makes no difference for what we are about to do.

Lets give this 128kb of information to imf_disp by dragging the file to it.
Boing! the window resizes to the expected size but where is
that damned image!? Lets fix it that right now.


The key to getting it to work is really quite simple.
It is in fact one line of code. Fire up your favorite text editor
and open Maya.env located in USER\maya add this line to it:

save and close.

Next time you commande line render, open the 128kb file in
imf_disp and you should see those buckets fly around.

imf_disp and command line render side by side


1. If it for some reason is undesirable to edit the Maya.env file
it is possible to add MI_MAYA_SOCKETS as an environmental variable
with a value of 1.

Some files that seem to render correctly but ends with the error code
"Maya exited with error code 210" will not display in imf_disp.

The firewall on the rendering machine may disturb so turn it off if
you want to ensure function.


Igor said...

Thx! Very useful and cool. Also useful if render crashes when saving from framebuffer.

Anonymous said...

Hi guys,

I love using imf_disp for images rendered in Maya.

My question is has anyone managed to do the same for images out of Max ?

Max doesn't seem to create the stub file necessary to open in imf_disp.

If anyone knows of a solution please drop me an email


Cheers !