Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how can I get the camera's name when rendering?

0 views
Skip to first unread message

x_kelvin

unread,
Mar 27, 2008, 12:47:55 PM3/27/08
to
My scene has setup several cameras and use batch render to render
them.
When maya is rendering a camera, I need to connect a shading network
to the camera.... , How can I do it use MEL?
I think that I need to get the camera's name of being rendering
when maya is batch rendering, then put the mel that the camera being
the shading network to "Pre Render Mel" in "render setting" panel.
So, How I can get it?

thx

aen

unread,
Mar 27, 2008, 8:34:52 PM3/27/08
to


Hi x_kelvin

Not really sure what you mean here?

1. The Rendering camera is connected to all shading networks.
For Batch Rendering (animated sequence) you select your camera in:
Render View -> Options -> Render Settings (popup window)
Then common tab->Renderable Camera -- and select your camera

Single frame rendering camera is set with:
Render View -> Render ->Render -- and select your camera

OR

2. You can also connect a camera Inside a shading network.
You can connect your camera (as any other object) to a variety of
General Utility Nodes inside Hypershade. If your connecting your camera
this way and want to connect it to a variety of cameras, you can use the
Connection Editor to connector another object (another camera)
or you use Mel :
"connectAttr -f camera4.translate condition1.colorIfTrue;"
which means camera4's xyz are used as Output 1 for a switch node.

If your not sure what Mel cmmds to use, create the connection with the
connection editor, then open up your Script Editor and the Mel command
is seem in the History (top) pane.

hth's aen...


x_kelvin

unread,
Mar 28, 2008, 3:24:36 AM3/28/08
to
thanks aen,firstly
My question is not the means that your said, maybe my
expression isn't right.
I use the toon shader in my scene. generally, an attr of toon shaders
be connnected automatically to rendering camera' message attr. Now my
scene have 20 cameras to be render, and I can render all cameras in
one time by useing a plug-ins. So I have to setup the connection
automatically between toonshader'attr and camera' message in my mel
proc when rendering different cameras, and then I put my mel proc in
" Pre render MEL" on Render Options. I think , I must get the
camera' name that being rendering, then make the connection in my mel
proc.

I don't know that U understand my meaning?


thx

kelvin

aen

unread,
Mar 28, 2008, 8:12:23 AM3/28/08
to
On Fri, 28 Mar 2008 00:24:36 -0700 (PDT), x_kelvin <x_ke...@163.com> wrote:

> thanks aen?firstly

Yeah... its really hard to tell how advanced people are in Maya from a short
blurb, mentioning your customized plugin clears things up. Assuming this plugin
creates a slicing (each frame is rendered from all selected cameras) , it would
be a very complex plugin. Each frame/camera combo would have a identifier inside
the API. If can get access to this API identifier in Mel, then your method is
correct.
if (camera_ID == "myCamera4) {connectAttr .....; };
But it all depends on the plugin's construction.

As you say, shading networks SHOULD automatically be connected to the rendering
camera. I would contact the creator the plugin, its functionality could override
any Pre render Mel coding or simply ignore it. Not properly connecting shaders
to the rendering camera is a flaw or limitation of the plugin, it requires fixes
to the plugin or a documented work around to be included with the plugin.

luck aen...

================================================================
Without the plugin you could use the command line rendering, run as a batch
file.
In a text editor create:

render -cam camera4 rd c:\yourSaveDirectory c:\mayas\...\scene\mytoon.ma

Copy and paste this 19 times, change the camera names for the other 19 lines.
Save the file as myrender.bat.
To run this, just double click on the file name in your windows browser and a
DOS command window will open and run Maya Render for all 20 cameras.

x_kelvin

unread,
Apr 4, 2008, 11:53:45 AM4/4/08
to
thanks, aen

I have solved the rendering problem.
I get the example maya file of pencilshading.ma from Toon>get toon
example... menu. In the maya file, the perspShape.message is connected
to projection1.linkedCamera, if I have several my cameras to rendering
at once, I must make the connection between all my cameras and
project1. I find that the render command has a "-preRender"
parameter, and get my aim by using this parameter.

The content of My batch file is as follows:

render -cam camera1 -s 1 -e 50 test.mb
render -cam camera2 -s 51 -e 100 -preRender "connectAttr -f
cameraShape2.message projection2.linkedCamera;" test.mb
render -cam camera3 -s 101 -e 124 -preRender "connectAttr -f
cameraShape3.message projection2.linkedCamera;" test.mb
.......

0 new messages