shirtTestScene.zip (375.9 KB, 465 views)
everything starts and ends in the right place at the right time.
#
9
23-08-2011
, 03:10 AM
Technical Director
Join Date: Feb 2004
Cool, thanks. I'll take a look for ya!
Just to be clear, you want to use this on a renderfarm right? And is this the only way for this to work?
Imagination is more important than knowledge.
Last edited by NextDesign; 23-08-2011 at 03:16 AM.
#
10
23-08-2011
, 06:52 AM
Registered User
Join Date: Jan 2005
Location: vienna
that´s the only way I could imagine. if you find an easier solution, I´m up for anything that works. and in case of correctional work (which will come for sure!) I don´t want to make tons of manual changes. keep in mind that I have at least (because the project is growing since it started):
150 objects on 150 layers
260 textures on timeline
for each variation 3 camera perspectives (3 single scenes)
equals 1.170.000 stills for now.
a must is to have 1 folder for every texture containing all geometries, with the objects named after the layer they´re applied to.
everything starts and ends in the right place at the right time.
#
11
23-08-2011
, 05:49 PM
Technical Director
Join Date: Feb 2004
Hey Falott. This won't work on the farm, but it will work on your local machine. Better to have something being rendered while we try to figure this out
(Also, by the way, you have 17,550,000 renders in total. 150*150*260*3 )
Set your basePath, texturePath, first, and last frame, turn off file sequence and delete the expression in your texture, and you'll be good to go.
Code:
string $texture = ($texturePath + "shirt_" + $i + ".png");
Is where you'll set the names of the textures (in this case, shirt_[firstFrame->lastFrame].png)
Code:
string $basePath = "G:/Projects2011/shirtTestScene/renderedTextures/";
string $texturePath = "G:/Projects2011/shirtTestScene/textures/";
int $firstFrame = 1;
int $lastFrame = 5;
string $renderLayers[] = `ls -type "renderLayer"`;
// do stuff
for ($i = $firstFrame; $i <= $lastFrame; $i++)
{
string $folderName = ("pattern" + $i);
string $texture = ($texturePath + "shirt_" + $i + ".png");
// change texture
setAttr -type "string" file1.fileTextureName $texture;
for ($layer in $renderLayers)
{
if ($layer == "defaultRenderLayer") // ignore the default render layer
continue;
else
{
string $folder = ($basePath + $folderName);
if (!`filetest -e $folder`) // folder doesn't exist. create it.
sysFile -makeDir ($basePath + $folderName);
print ($folder + "/" + $layer + $folderName + "\n");
render -l $layer; // render
catch(eval(renderWindowSaveImageCallback ($renderPanel, ($folder + "/" + $layer + $folderName), `getAttr defaultRenderGlobals.imageFormat`)));
}
}
}
Hopefully it does what you want!
Imagination is more important than knowledge.
Last edited by NextDesign; 23-08-2011 at 08:03 PM.
#
12
24-08-2011
, 07:45 AM
Registered User
Join Date: Jan 2005
Location: vienna
OH MAN! THANK YOU!
unfortunately I can soonest try this script at the beginning of next week , because I am on vacation this week. but I will examine this script and try to understand it so I can kick it off asap. dude, this piece of code is appreciated so much!
the only thing I want to ask is, where do I put this mel code? into the preRender/preRender Frame section?
because if so - I can tell vertext muster to use this code as well, and everything would be fine.
everything starts and ends in the right place at the right time.
#
13
24-08-2011
, 05:48 PM
Technical Director
Join Date: Feb 2004
It's actually just run in your script editor. As I said, it won't work on the renderfarm, unless you send different scripts to each machine.
Eg.
Machine 1: startFrame = 1 endFrame = 10
Machine 2: startFrame = 11 endFrame = 20
Machine 3: startFrame = 21 endFrame = 30
...
You MIGHT be able to put this into the pre-render frame, with startFrame and endFrame set to `currentTime -q`
Imagination is more important than knowledge.
Last edited by NextDesign; 24-08-2011 at 05:52 PM.
#
14
29-08-2011
, 04:36 PM
Registered User
Join Date: Jan 2005
Location: vienna
after stealing some of your code from other places I have my script almost working as it should. there are a few things which still give me head ache though.
Code:
string $renderPanel;
string $renderPanels[] = `getPanel -scriptType "renderWindowPanel"`;
string $basePath = (`workspace -q -rd` + "renderOutput/");
string $renderLayers[] = `ls -type "renderLayer"`;
int $firstFrame = `currentTime -q`;
int $lastFrame = `currentTime -q`;
if(size($renderPanels))
$renderPanel = $renderPanels[0];
else
{
$renderPanel = `scriptedPanel -type "renderWindowPanel" -unParent renderView`;
scriptedPanel -e -label "Render View" $renderPanel;
}
// do stuff
for ($i = $firstFrame; $i <= $lastFrame; $i++)
{
// RenderViewWindow;
// tearOffPanel "Render View" "renderWindowPanel" true;
string $outputFolder = ("PSDmuster" + $i + "_");
string $myDiffuseTexture = "DT_" + `currentTime -q`;
string $myNormalTexture = "NM_" + `currentTime -q`;
//connectAttr -force ($myDiffuseTexture + ".outColor") shader_gamma.value;
//connectAttr -force ($myNormalTexture + ".outAlpha") shader_bump2d.bumpValue;
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);
print ($folder + "/" + $layer + $outputFolder + "\n");
render -l $layer shotCAM01; // render
if (`getApplicationVersionAsFloat` >= 2011)
catch(eval(renderWindowSaveImageCallback ($renderPanel, ($folder + "/" + $outputFolder + $layer), `getAttr defaultRenderGlobals.imageFormat`)));
else
renderWindowSaveImageCallback ($renderPanel, ($folder + "/" + $outputFolder + $layer), `getAttr defaultRenderGlobals.imageFormat`);
// catch(eval(renderWindowSaveImageCallback ($renderPanel, ($imagesDir + “/renderView.” + ($maxImageIndex – $i)), `getAttr defaultRenderGlobals.imageFormat`)));
}
}
}
#1
in case files get overwritten, how can I integrate an "auto-YES, please overwrite that file" into the script?
#2
Code:
# Error: AttributeError: ImageFormats instance has no attribute 'oldOutf' #
if I replace
Code:
`getAttr defaultRenderGlobals.imageFormat`
with
result:
Code:
// Error: //
// Error: Syntax error //
without any further information on that error
basically the directory is created, rendered frame is named and placed correctly, but it is black.
#3
Code:
//connectAttr -force ($myDiffuseTexture + ".outColor") shader_gamma.value;
//connectAttr -force ($myNormalTexture + ".outAlpha") shader_bump2d.bumpValue;
if the corresponding textures are already applied,
Code:
// Warning: 'DT_2.outColor' is already connected to 'shader_gamma.value'. //
and the script stops there. I tried to make use of the catch() command, but maya always returns
Code:
// Error: Invalid use of Maya object "connectAttr". //
everything starts and ends in the right place at the right time.
Last edited by Falott; 30-08-2011 at 10:08 AM.
#
15
30-08-2011
, 03:05 PM
Technical Director
Join Date: Feb 2004
#1
in case files get overwritten, how can I integrate an "auto-YES, please overwrite that file" into the script?
Before "if (`getApplicationVersionAsFloat` >= 2011)", put:
Code:
string $renderedFilename = ($folder + "/" + $outputFolder + $layer);
if (`filetest -e $renderedFilename`) // image exists. delete it.
sysFile -del $renderedFilename;
#2
Code:
# Error: AttributeError: ImageFormats instance has no attribute 'oldOutf' #
if I replace
Code:
`getAttr defaultRenderGlobals.imageFormat`
with
result:
Code:
// Error: //
// Error: Syntax error //
The AttributeError is not a problem. It still renders.
Replace `getAttr defaultRenderGlobals.imageFormat` with 32 (the file extension enumeration index).
Eg.
Code:
renderWindowSaveImageCallback ($renderPanel, ($folder + "/" + $outputFolder + $layer), 32);
#3
Code:
connectAttr -force ($myDiffuseTexture + ".outColor") shader_gamma.value;
connectAttr -force ($myNormalTexture + ".outAlpha") shader_bump2d.bumpValue;
if the corresponding textures are already applied,
Code:
// Warning: 'DT_2.outColor' is already connected to 'shader_gamma.value'. //
and the script stops there. I tried to make use of the catch() command, but maya always returns
Code:
// Error: Invalid use of Maya object "connectAttr". //
Not sure what the problem is there. Did you put:
Code:
catch(eval(connectAttr -force ($myDiffuseTexture + ".outColor") shader_gamma.value));
?
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
|