maya.zip (363.0 KB, 425 views)
everything starts and ends in the right place at the right time.
Last edited by Falott; 31-08-2011 at 03:42 PM.
#
17
31-08-2011
, 11:58 PM
Technical Director
Join Date: Feb 2004
I said, the oldOutf error is not a problem. Ignore it. It's handled.
What do you mean by -reg<int><int><int><int>? There is no such flag.
Imagination is more important than knowledge.
#
18
01-09-2011
, 04:05 AM
Registered User
Join Date: Jan 2005
Location: vienna
if you say it´s handled, then ok. just thought when maya renders 1 sec for each layer and creates a black image, while popping out these errors..
sorry, i meant:
-reg int int int int Set sub-region pixel boundary of the final image:
left, right, bottom, top
because there are a lot of small parts to be rendered. but again, it is no must. there are just 3 categories of objects to be rendered with sub-region boundary. for these I can create 3 different scene files with the script adapted like
Code:
render -l $layer -reg int int int int shotCAM01;
priority is to make mental ray render the images which it doesn´t yet. all renderings are black right now.
everything starts and ends in the right place at the right time.
Last edited by Falott; 01-09-2011 at 04:37 AM.
#
19
01-09-2011
, 02:53 PM
Technical Director
Join Date: Feb 2004
Oh. You mean when you send it through the command line, not through MEL. That's what confused me.
Imagination is more important than knowledge.
#
20
01-09-2011
, 03:19 PM
Registered User
Join Date: Jan 2005
Location: vienna
sorry for being so imprecise.. I am use to look at mel code for years, but I just start to really learn that right now, since there is a demand for it at my new office. I am a modeller/texturer, little bit of animator naturally. but here it´s all about rendering, and that´s a completely new field of work for me.
basically I dont need to send it over the render farm. would be nice though, but if that code works on local machines only and does what needs to be done I am absolutely fine with it.
else
if you ever need help with something modeling related at any time (be it reviewing tasks, testModels, whatever...) please don´t hesitate to ask me. I´d be happy to offer any kind of support. you´re really saving my life here dude! I couldn´t have done this without your help for sure.
all best!
everything starts and ends in the right place at the right time.
#
21
01-09-2011
, 09:19 PM
Technical Director
Join Date: Feb 2004
And they don't have a TD? Strange...
Also, usually if I knew this was for a studio, I'd charge. Don't worry about it this time though, my fault for not asking!
Here are the fixes.
Code:
string $basePath = "/usr/Desktop/maya/renderOutput/";
string $texturePath = "/usr/Desktop/maya/texture/";
string $textureFormat = "png";
string $renderLayers[] = `ls -type "renderLayer"`;
int $firstFrame = 1;
int $lastFrame = 2;
// check for render panel
string $renderPanel;
string $renderPanels[] = `getPanel -scriptType "renderWindowPanel"`;
if(size($renderPanels))
$renderPanel = $renderPanels[0];
else
{
$renderPanel = `scriptedPanel -type "renderWindowPanel" -unParent renderView`;
scriptedPanel -e -label "Render View" $renderPanel;
}
// get the image format in the render globals
int $format = `getAttr "defaultRenderGlobals.imageFormat"`;
string $extension = "";
switch($format)
{
case 0: $extension = "gif"; break;
case 1: $extension = "pic"; break;
case 2: $extension = "rla"; break;
case 3: $extension = "tif"; break;
case 4: $extension = "tif"; break;
case 5: $extension = "sgi"; break;
case 6: $extension = "als"; break;
case 7: $extension = "iff"; break;
case 8: $extension = "jpg"; break;
case 9: $extension = "eps"; break;
case 10: $extension = "iff"; break;
case 11: $extension = "cin"; break;
case 12: $extension = "yuv"; break;
case 13: $extension = "sgi"; break;
case 19: $extension = "tga"; break;
case 20: $extension = "bmp"; break;
case 22: $extension = "mov"; break;
case 30: $extension = "pntg"; break;
case 31: $extension = "psd"; break;
case 32: $extension = "png"; break;
case 33: $extension = "pict"; break;
case 34: $extension = "qtif"; break;
case 35: $extension = "dds"; break;
case 36: $extension = "psd"; break;
}
// do stuff
for ($i = $firstFrame; $i <= $lastFrame; $i++)
{
string $outputFolder = ("PSDmuster" + $i);
string $myDiffuseTexture = ($texturePath + "DT_" + $i + "." + $textureFormat);
string $myNormalTexture = ($texturePath + "NM_" + $i + "." + $textureFormat);
for ($layer in $renderLayers)
{
if ($layer == "defaultRenderLayer") // ignore the default render layer
continue;
else
{
string $folder = ($basePath + $outputFolder);
if (!`filetest -e $folder`) // folder doesn't exist. create it.
sysFile -makeDir ($basePath + $outputFolder);
string $renderedFilename = ($folder + "/" + $outputFolder + "_" + $layer);
if (`filetest -e ($renderedFilename + "." + $extension)`) // image exists. delete it.
sysFile -del ($renderedFilename + "." + $extension);
// change texture
setAttr -type "string" tex.fileTextureName $myDiffuseTexture;
// render - nasty hack
render -l $layer;
renderWindowRender redoPreviousRender renderView;
if (`getApplicationVersionAsFloat` >= 2011)
catch(eval(renderWindowSaveImageCallback ($renderPanel, $renderedFilename, $format)));
else
renderWindowSaveImageCallback ($renderPanel, $renderedFilename, $format);
}
}
}
Imagination is more important than knowledge.
Last edited by NextDesign; 01-09-2011 at 09:23 PM.
#
22
05-09-2011
, 03:36 PM
Registered User
Join Date: Jan 2005
Location: vienna
thank you man. I´ve altered the script just a tiny little. it´s working perfect now.
I will post a final version of the script here as soon as I have finished all model/texture work. then I will see if the texture node thing needs some adjustment. (I´ve added an extra attribute "textureRealName" to the fileNodes, since they have to be named according to timeline right now.)
Code:
string $renderCAM = "shotCAM01";
string $basePath = (`workspace -q -rd` + "renderOutput/");
string $textureFormat = "png";
string $renderLayers[] = `ls -type "renderLayer"`;
int $firstFrame = 1;
int $lastFrame = 3;
// check for render panel
string $renderPanel;
string $renderPanels[] = `getPanel -scriptType "renderWindowPanel"`;
if(size($renderPanels))
$renderPanel = $renderPanels[0];
else
{
$renderPanel = `scriptedPanel -type "renderWindowPanel" -unParent renderView`;
scriptedPanel -e -label "Render View" $renderPanel;
}
// get the image format in the render globals
int $format = `getAttr "defaultRenderGlobals.imageFormat"`;
string $extension = "";
switch($format)
{
case 0: $extension = "gif"; break;
case 1: $extension = "pic"; break;
case 2: $extension = "rla"; break;
case 3: $extension = "tif"; break;
case 4: $extension = "tif"; break;
case 5: $extension = "sgi"; break;
case 6: $extension = "als"; break;
case 7: $extension = "iff"; break;
case 8: $extension = "jpg"; break;
case 9: $extension = "eps"; break;
case 10: $extension = "iff"; break;
case 11: $extension = "cin"; break;
case 12: $extension = "yuv"; break;
case 13: $extension = "sgi"; break;
case 19: $extension = "tga"; break;
case 20: $extension = "bmp"; break;
case 22: $extension = "mov"; break;
case 30: $extension = "pntg"; break;
case 31: $extension = "psd"; break;
case 32: $extension = "png"; break;
case 33: $extension = "pict"; break;
case 34: $extension = "qtif"; break;
case 35: $extension = "dds"; break;
case 36: $extension = "psd"; break;
}
// do stuff
for ($i = $firstFrame; $i <= $lastFrame; $i++)
{
string $outputFolder = ("PSDmuster" + $i + "_" + $renderCAM);
string $textureNode = ("DT_" + $i);
for ($layer in $renderLayers)
{
if ($layer == "defaultRenderLayer") // ignore the default render layer
continue;
else
{
string $folder = ($basePath + $outputFolder);
if (!`filetest -e $folder`) // folder doesn't exist. create it.
sysFile -makeDir ($basePath + $outputFolder);
string $renderedFilename = ($folder + "/" + $outputFolder + "_" + $layer);
if (`filetest -e ($renderedFilename + "." + $extension)`) // image exists. delete it.
sysFile -del ($renderedFilename + "." + $extension);
catch(`connectAttr -force ($textureNode + ".outColor") shader_gamma.value`); // --> catch(`connectAttr`) <-- if fileTextureNode is already connected to gammaCorrectNode, continue.
// render - nasty hack
render -l $layer $renderCAM;
renderWindowRender redoPreviousRender renderView;
if (`getApplicationVersionAsFloat` >= 2011)
catch(eval(renderWindowSaveImageCallback ($renderPanel, $renderedFilename, $format)));
else
renderWindowSaveImageCallback ($renderPanel, $renderedFilename, $format);
}
}
}
everything starts and ends in the right place at the right time.
#
23
06-09-2011
, 05:48 AM
Technical Director
Join Date: Feb 2004
Why are you changing the texture node each iteration? Why not just change the texture's path? It'll be faster.
Imagination is more important than knowledge.
#
24
06-09-2011
, 05:05 PM
Registered User
Join Date: Jan 2005
Location: vienna
ah, it´s simply because each tileTexture isn´t tiled 1:1. about 80% of all textures have a tiling of 2,83 : 2,65 and so on. another advantage of this method is that I can add an extra attribute "realTextureName" to the fileNodes. this attribute could be called then to add another string to the rendered image files and the destination folder. because names like texture_1 to texture_250 is somewhat meaningless.
everything starts and ends in the right place at the right time.
#
25
07-09-2011
, 02:50 AM
Technical Director
Join Date: Feb 2004
Ah, alright, awesome. Glad it worked out for you!
Imagination is more important than knowledge.
#
26
07-09-2011
, 06:50 PM
Registered User
Join Date: Jan 2005
Location: vienna
thanks to you! Couldn´t have done that alone. this correspondence with you really encouraged me to learn MEL now. I am used to fighting with mel script since years now but I never was able to wrap my brain around it. this is the first time for me that getting into mel was kind of fun and not just a pure pain in the ass.
You Rock Dude!
everything starts and ends in the right place at the right time.
#
27
08-09-2011
, 01:57 AM
Technical Director
Join Date: Feb 2004
No problem mate, glad to help
MEL scripting is definitely a useful skill, not just for TDs, but artists as well.
Imagination is more important than knowledge.
You may not post new threads |
You may not post replies |
You may not post attachments |
You may not edit your posts |
BB code is On |
Smilies are On |
[IMG] code is On |
HTML code is Off
|