Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Lighting & Rendering (https://simplymaya.com/forum/forumdisplay.php?f=17)
-   -   HUGE rendering problem - batch render different than single frame (https://simplymaya.com/forum/showthread.php?t=33608)

Lokjutus 16-01-2010 08:10 PM

HUGE rendering problem - batch render different than single frame
 
Hello to all.

I am sorry that my first post for this great communitiy is a cry for help... but I desperately need some help. And sorry for my crappy English.

To cut the long story short, my wife and I are taking a course in video animation and so far we come a long way. Started 3 months ago we had no clue about 3D modeling or animation and now we are practically done with our scene, ready to render. But, here came our biggest problems yet...and it's 7 day until our project is due.

Batch render doesn't work as we expected, or as it should...but single frame render does. We started animating our cameras and objects, and we made some changes to some objects after that, moving them and creating some new lights, etc. Those objects and lights that we change don't show in batch rendered images at all!! For example, if we moved an object just a few units to the right, that object didnt show in batch render any more..same with lights...

we are frustrated, its a big problem for us cause we have to be done with our project in 7 days and we started to do single frame render and save them one by one as stills.. but we are dead tiered and not even half way done..

if anyone has any idea why this happens and what to do ti fix this, please help 2 desperate souls.

Gen 17-01-2010 12:29 AM

Re: HUGE rendering problem - batch render different than single frame
 
Quote:

Originally posted by Lokjutus
...... we made some changes to some objects after that, moving them and creating some new lights, etc. Those objects and lights that we change don't show in batch rendered images at all!! For example, if we moved an object just a few units to the right, that object didnt show in batch render any more..same with lights....
Not sure but could it be that your render camera's clipping plane is too low so it's snipping off your scene? That's the only thing that came to mind. Hope you guys sort it out.

NextDesign 17-01-2010 06:14 AM

That's very odd... But it has happened to me as well. Take a look at your ram usage while batch rendering, as it has a tendency to just stop when it hits the limit.

I understand that you are in some trouble with time, so I've made a nasty little hack for you guys. You say single frame renders work? Well, here's a script I've quickly put together for you guys that will render a frame, save it out, render another, etc; therefore bypassing the usage of batch render. One thing to be aware however, is that once it starts, you won't be able to stop it until it finishes, or you force quit the process.

I haven't tested this as I don't have Maya installed on this machine, but it should work without problems.

Open up your script editor, and change the first 4 lines to your requirements.

Filename is used for something like "render.001.jpg"
Camera, is the camera you want to render out of
Start and end frame are self-explanatory.

If you have problems setting this up, just give me your requirements, and I'll do the changes for you.

Edit: The newest version can be found here

Code:

string $filename = "render";
string $cameraName = "persp";

int $startFrame = 1;
int $endFrame = 24;

string $directory = (`workspace -q -rd` + "images/");

for ($i = $startFrame; $i <= ($endFrame - $startFrame); $i++)
{
    currentTime $i;

    render  -x `getAttr defaultResolution.width` -y `getAttr defaultResolution.height` $cameraName;

    string $concatFilename = $directory + $filename + "." + $i;

    renderWindowSaveImageCallback ("renderView", $concatFilename, `getAttr defaultRenderGlobals.imageFormat`);

    print ("Saved " + $concatFilename + "\n");
}

print ("Completed rendering of " + ($endFrame - $startFrame) + " frames.\n");

Hope this helps guys.

Lokjutus 17-01-2010 10:29 AM

NextDesign, I am so very much grateful to you and i can certainly say that this is the nicest thing anyone has done for me when i asked for some help online, regarding anything. Thank you so much.

That's so nice that i'm almost sorry that we managed to solve our problem before i read this post :D.

Anyway, the problem wasn't the far clip plane, full RAM, or anything like that. It seems that somehow (i have no clue how) we had a "DefaultRenderLayer" created in our scene and that layer was checked as unrenderable. Anything that we created or changed after that layer was created seems to be put in that layer, therefor not renderable. (but interesting, still it was renderable as single frame) We haven't created that layer ourselves and have no clue how it was created, and WHY it had uncecked the "Renderable" box..

As for your script, thank you again for making the effort to help us, i will still test it out when we are done rendering. Hope this this thread and your script will help out some other desperate souls.

Cheers.

G-Man 17-01-2010 05:34 PM

Damn mate,
That was way above and beyond Next design...
My kinda guy ;)
G-man

NextDesign 17-01-2010 06:29 PM

Glad to help guys. :)

You don't know how nice it is to have a request that is fully described, and asked for nicely. It really makes the difference :)

Giantbean 12-08-2010 01:58 AM

Similar issue.
 
1 Attachment(s)
I am having a similar issue. I do a local render and the image comes out looking great but when I batch render the image is much flatter, some of the textures don't seem to work at all.

I am using final gather and it seems that its not using the effect in the batch render. I also loose glows and incandescence but fur looks like its on fire.

I don't have any render layers and Im not sure how to set up a final gather render pass. Would NextDesign's code work to render what I need? And if so how do you use that code in Maya 2010?

I have attached a RAR with a local screen capture jpeg of an .iff and a batch Tiff Frame so you can see the difference.

Thanks.

michaelcawood 07-01-2011 05:26 PM

We've had similar problems on our short film. One thing to look out for is that if you have some referenced and instanced objects you may need to import the references into your scene for Batch rendering to work. We had some referenced clouds instanced across the scene that didn't show up in batch render until we imported the reference. Very odd but it's a work around.

anwol 09-01-2011 04:22 PM

adjusting the render script
 
Hi,
I tried your script- it works fantastic!
Is there anyway to make it work with mental ray as the rendering engine?
I cant figure out where or what to adjust.
Many thanks
a






I haven't tested this as I don't have Maya installed on this machine, but it should work without problems.

Open up your script editor, and change the first 4 lines to your requirements.

Filename is used for something like "render.001.jpg"
Camera, is the camera you want to render out of
Start and end frame are self-explanatory.

If you have problems setting this up, just give me your requirements, and I'll do the changes for you.

Code:

string $filename = "render";
string $cameraName = "persp";

int $startFrame = 1;
int $endFrame = 24;

string $directory = (`workspace -q -rd` + "images/");

for ($i = $startFrame; $i <= ($endFrame - $startFrame); $i++)
{
    currentTime $i;

    render  -x `getAttr defaultResolution.width` -y `getAttr defaultResolution.height` $cameraName;

    string $concatFilename = $directory + $filename + "." + $i;

    renderWindowSaveImageCallback ("renderView", $concatFilename, `getAttr defaultRenderGlobals.imageFormat`);

    print ("Saved " + $concatFilename + "\n");
}

print ("Completed rendering of " + ($endFrame - $startFrame) + " frames.\n");

Hope this helps guys.[/QUOTE]

anwol 13-01-2011 10:07 PM

Quote:

Originally Posted by NextDesign (Post 299918)
Glad to helps guys. :)

You don't know how nice it is to have a request that is fully described, and asked for nicely. It really makes the difference :)

Hi there,
Im hoping you can tell me how to revise your script so that it calls on the Mental ray engine instead of the Maya software.
I am using Maya 2009 and the render view & globals are set to MR.
Any help would be so very appreciated.
Best,
a

NextDesign 14-01-2011 07:04 AM

Wow, it seems this script has attracted quite a bit of attention :)

Here is a fixed version that will allow rendering in multiple renderers, as well as work in Maya 2011!

Code:

// Batch rendering workaround - John Mather (NextDesign)
string $filename = "render";
string $cameraName = "persp";

int $startFrame = 1;
int $endFrame = 3;

string $directory = (`workspace -q -rd` + "images/");

for ($i = $startFrame; $i <= $endFrame; $i++)
{
    currentTime $i;

    // Old version
    // render -x `getAttr defaultResolution.width` -y `getAttr defaultResolution.height` $cameraName;
   
    // New version - supports MR and other renderers!   
    renderWindowRender redoPreviousRender renderView;
   
    string $concatFilename = $directory + $filename + "." + $i;

    if (`getApplicationVersionAsFloat` >= 2011)
        // Thanks to nowayfra on creativecrash for his workaround
        catch(eval(renderWindowSaveImageCallback ("renderView", $concatFilename, `getAttr defaultRenderGlobals.imageFormat`)));
    else
        renderWindowSaveImageCallback ("renderView", $concatFilename, `getAttr defaultRenderGlobals.imageFormat`);

    print ("Saved " + $concatFilename + "\n");
}

print ("Completed rendering of " + ($endFrame - $startFrame) + " frames.\n");

P.s. Many thanks goes out to nowayfra on CreativeCrash for his Maya 2011 fix! (http://www.creativecrash.com/forums/...on_post_306312)

Edit: Fixed a small bug that would stop all frames from being rendered.

bullet1968 14-01-2011 07:57 AM

ND you are a bloody champignon mate...kudos to you for the help with these problems..

cheers bullet

arindam2007c 14-01-2011 10:18 AM

u r great...man.
it really works great.
it will avoid many internal errors during batch render.

aguayo.Andrez 17-02-2011 11:45 PM

Hey I am having a similar problem with my batchrender. This script could really come in handy but whenever I try and run it I am also having an error. If someone could help out I would be very grateful.

the error is ( // Error: renderWindowEditor: Object 'renderView' not found)

I am trying to render in Mental Ray out of a camera I have set up. anyone know what is causing that error?


maybe I am just filling in something in the first 4 lines incorrectly ...

BabyDuck 22-02-2011 01:31 PM

:) Awesome script ND. 2 little things - just tested in maya 2011 and I get before each render this error:
Code:

# Error: AttributeError: ImageFormats instance has no attribute 'oldOutf' #
Not a deal breaker since the render does work w/o problems.

And also the last line should read
Code:

print ("Completed rendering of " + ($endFrame - $startFrame + 1 ) + " frames.\n");
otherwise it is saying completed one less render than it actually did (not really an issue, just a nitpick.

And I noticed if the files already exists it will ask each time if you want to overwrite it - nice feature, but might be annoying if you got a lot to render - so if you do, just delete the files beforehand.

aguayo.Andrez 01-03-2011 02:44 AM

I have solved my problem... not really... I just switched from Windows to Mac and ran the same script and it worked. Not sure what the difference is but it worked.

NextDesign thank you so much for this helpful script! :)

jabbelmous 15-03-2011 11:26 AM

Thanks a lot... Just what I was looking for! Works perfect!

oznn00 29-03-2011 04:46 PM

thank you so much ND its working realy good but when i start render i can't stop it :giggle: any way thanks again

LauriePriest 29-03-2011 05:49 PM

Can you post a scene please, i'm intreagued by what's causing this.

j.htlim 11-04-2011 02:05 PM

help
 
Hi I know this thread has recently become inactive. But I'm calling out for some help. Hopefully someone will read this and help a very lost person out :(

So here's the situation:
I am trying to rerender my turntable of my toilet model. Why "rerender"? Because the last time I managed to batch render out the turntable with all it's textures in mental ray- no problems at all. Now, what I am trying to do is rerender a wireframe version of my model using toon lining and a white lambert shade plastered over - using Maya Software.

Like Lokjutus the render view looks perfectly fine. But when it comes to the batch render everything just goes wrong.

I tried using the hack created by NextDesign (both versions) but an error message appeared -
Error: Object not found: renderView

Basically there are two problems. The first is that I can't batch render and second, I still can't render out my render views using the hack.

I am using Maya 2010. Help anyone ? :help:

Here are some images to help you all understand what I'm facing - sorry for the horrible modelling :(

http://www.flickr.com/photos/26565161@N07/5610063986/

http://www.flickr.com/photos/26565161@N07/5610064048/

Dez85 19-04-2011 01:51 PM

Please Help - // Error: renderWindowEditor: Object 'renderView' not found. //
 
Hey there guys, how you doing?

I was wondering if you could help me out with the following error regarding the script for Maya that has been discussed. I am very eager to get this working as my current frame render works considerable faster than Maya batch render which doesn't even load. I am running Maya 2011 x64.

In the script editor I have input the following:



// Batch rendering workaround - John Mather (NextDesign)
string $filename = "ContainmentSHOT1 2";
string $cameraName = "Test:SHOT1";

int $startFrame = 108;
int $endFrame = 234;

string $directory = (`workspace -q -rd` + "images/");

for ($i = $startFrame; $i <= $endFrame; $i++)
{
currentTime $i;

// Old version
// render -x `getAttr defaultResolution.width` -y `getAttr defaultResolution.height` $cameraName;

// New version - supports MR and other renderers!
renderWindowRender redoPreviousRender renderView;

string $concatFilename = $directory + $filename + "." + $i;

if (`getApplicationVersionAsFloat` >= 2011)
// Thanks to nowayfra on creativecrash for his workaround
catch(eval(renderWindowSaveImageCallback ("render view", $concatFilename, `getAttr defaultRenderGlobals.imageFormat`)));
else
renderWindowSaveImageCallback ("render view", $concatFilename, `getAttr defaultRenderGlobals.imageFormat`);

print ("Saved " + $concatFilename + "\n");
}





When I input this into the Mel script the following error comes up:

// Error: renderWindowEditor: Object 'renderView' not found. //

And so I attempted executing it in Python, however only to be greeted with this error message:

# Error: SyntaxError: invalid syntax #

If anyone could possibly help me out with this then I'd greatly appreciate it. I only have a little of a week left to get all this rendered for my final year at university and Maya batch render isn't playing nice. The script would be a dream come true if anyone could help me get it working.

Cheers guys

Derek

NextDesign 19-04-2011 02:38 PM

Hey guys. I've figured out the problem. Here's the newest version. Also, please note that it renders out of the current camera (Ie. It renders out of the camera that renders when you press the render button [if that makes any sense :)])

Code:

// Batch rendering workaround V3 - John Mather (NextDesign)
// Author page: http://www.creativecrash.com/users/john-mather
// Check for updates here: http://simplymaya.com/forum/showthread.php?p=318227
string $filename = "render";

int $startFrame = 1;
int $endFrame = 24;

string $directory = (`workspace -q -rd` + "images/");

// check for render panel. Found here: http://www.creativecrash.com/forums/mel/topics/error-object-not-found-renderview
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;
}

for ($i = $startFrame; $i <= $endFrame; $i++)
{
    currentTime $i;

    renderWindowRender redoPreviousRender renderView;

    string $concatFilename = $directory + $filename + "." + $i;

    if (`getApplicationVersionAsFloat` >= 2011)
        // Thanks to nowayfra on creativecrash for his workaround
        catch(eval(renderWindowSaveImageCallback ($renderPanel, $concatFilename, `getAttr defaultRenderGlobals.imageFormat`)));
    else
        renderWindowSaveImageCallback ($renderPanel, $concatFilename, `getAttr defaultRenderGlobals.imageFormat`);

    print ("Saved " + $concatFilename + "\n");
}

print ("Completed rendering of " + (($endFrame - $startFrame) + 1) + " frames.\n");

Hope it helps guys!

-John

NextDesign 18-08-2011 05:19 AM

Alright! New version! This version now displays a progress bar while rendering, which also allows the user to cancel the rendering by pressing the ESC key. It also now has support for frame padding, of which the number can be easily controlled with the nFramePadLength variable. The last change is that it will also render in any selected image format from the render globals, not just iff!

Hope you guys enjoy!

-John Mather

Code:

// Batch rendering workaround V4 - John Mather (NextDesign)
// Author page: http://www.creativecrash.com/users/john-mather
// Check for updates here: http://simplymaya.com/forum/showthread.php?p=318227
string $filename = "render";

int $startFrame = 3;
int $endFrame = 24;
int $nFramePadLength = 4; // eg name.0000.ext (4 zeros)

string $directory = (`workspace -q -rd` + "images/");

// check for render panel. Found here: http://www.creativecrash.com/forums/mel/topics/error-object-not-found-renderview
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;
}

// start the progress bar
global string $gMainProgressBar;

progressBar -edit -beginProgress -isInterruptable true -status "Rendering..." -maxValue $endFrame $gMainProgressBar;

for ($i = $startFrame; $i <= $endFrame; $i++)
{
    // check for user termination
    if(`progressBar -query -isCancelled $gMainProgressBar`)
        break;

    currentTime $i;

    renderWindowRender redoPreviousRender renderView;

    // pad the frame number
    string $framePadded = $i;
   
    while (`size($framePadded)` < $nFramePadLength)
        $framePadded = ("0" + $framePadded);

    string $concatFilename = $directory + $filename + "." + $framePadded + "." + $extension;

    if (`getApplicationVersionAsFloat` >= 2011)
        // Thanks to nowayfra on creativecrash for his workaround
        catch(eval(renderWindowSaveImageCallback ($renderPanel, $concatFilename, `getAttr defaultRenderGlobals.imageFormat`)));
    else
        renderWindowSaveImageCallback ($renderPanel, $concatFilename, `getAttr defaultRenderGlobals.imageFormat`);

    progressBar -edit -step 1 -status ("Rendering frame " + (($i - $startFrame) + 1) + " of " + (($endFrame - $startFrame) + 1)) $gMainProgressBar;    // update the progress bar
       
    print ("Saved " + $concatFilename + "\n");
}

progressBar -edit -endProgress $gMainProgressBar;    // clear the progress bar

print ("Completed rendering of " + (($endFrame - $startFrame) + 1) + " frames.\n");


farbtopf 10-09-2011 01:29 PM

THANK YOU SIR!
 
wow, thanks a lot for your great script. I had the wiredest error with one of my renders. Whatever I rendered out of batch was a couple of pixels off from where it should be.

Same file, same camera same everything on single frame gives the correct result... No idea why but I'm trying your single frame technique and it works for me.

Thanks again
:spin::spin:

NextDesign 11-09-2011 03:02 AM

Thanks farbtopf, I'm glad you found it useful!

kayveedeeoh 20-10-2011 09:48 AM

Thanks Next Design.

A question:
How could I customize this to grab all the settings from a render layer, and render out multiple layers without having to babysit each one?

NextDesign 20-10-2011 02:13 PM

Quote:

Originally Posted by kayveedeeoh (Post 327391)
Thanks Next Design.

A question:
How could I customize this to grab all the settings from a render layer, and render out multiple layers without having to babysit each one?

Hi kayveedeeoh, what do you mean by "grab all the settings from a render layer"? Do you just want all of the render layers to be batched out?

kayveedeeoh 24-10-2011 06:40 AM

That's exactly it yes. Assuming I have multiple cameras and frame ranges(assigned to different layers) I would like to batch out without having to create a new script for each one.

ctbram 24-10-2011 11:09 AM

Nice script ND. I like the comments very clear and kudos for giving folks recognition.

Just out of curiosity, why do you have to call "renderWindowSaveImage" in the catch(eval(...)) block in maya 2011 or higher?

I am guessing it is because it is in a try block inside maya 2011 and higher and not in earlier versions?

NextDesign 25-10-2011 05:58 PM

Quote:

Originally Posted by kayveedeeoh (Post 327620)
That's exactly it yes.

Hi kayveedeeoh, could you send me a test file? I'll take a look into it. Is the normal batch not working?

Quote:

Originally Posted by ctbram (Post 327632)
Just out of curiosity, why do you have to call "renderWindowSaveImage" in the catch(eval(...)) block in maya 2011 or higher?

Hey ctbram, it's due to an annoying little bug in 2011+ with the ImageFormats:
Quote:

# Error: AttributeError: ImageFormats instance has no attribute 'oldOutf' #
It still writes out the file, but since it throws an error, the scripts halts. The catch eval pretty much just states "I know there's a problem, just keep going."

ctbram 25-10-2011 06:20 PM

got it. thanks

kayveedeeoh 31-10-2011 11:00 AM

Quote:

Originally Posted by NextDesign (Post 327718)
Hi kayveedeeoh, could you send me a test file? I'll take a look into it. Is the normal batch not working?

I had problems batching out instanced geometry, but I found a script to convert that to actual baked geometry. so for me its problem solved... I can batch again.

Trinitas 31-12-2011 12:11 AM

Even though this thread's been dormant for a couple of months, I just had to register on the forums and give a HUGE shout out of profound thanks to John for his work on this script. It saved my life.

Edit: Autodesk should pay you royalties.

NextDesign 31-12-2011 01:40 AM

Quote:

Originally Posted by Trinitas (Post 331145)
Even though this thread's been dormant for a couple of months, I just had to register on the forums and give a HUGE shout out of profound thanks to John for his work on this script. It saved my life.

Edit: Autodesk should pay you royalties.

Wow, thank you Trinitas! This made my day; I'm truly glad it helped you out. Thanks again for taking the time to let me know, I really appreciate it!

Hope all is well,

-John

murambi 26-01-2012 08:17 AM

This is a very helpful script I cant believe I went so long without noticing the thread. I am using it now and it is very helpful. Thanks John

reinterpret 03-02-2012 11:53 AM

i have a strange problem. it went all the time very well. now i dont knw what i changed. i put the correct data in there and it renders only one frame very often. is it maybe because of vue elements in the scene?

NextDesign 03-02-2012 04:40 PM

Quote:

Originally Posted by reinterpret (Post 332749)
i have a strange problem. it went all the time very well. now i dont knw what i changed. i put the correct data in there and it renders only one frame very often. is it maybe because of vue elements in the scene?

I would need more information to debug this. Have you set the start and end frame correctly?

Antonin Ganner 06-02-2012 10:17 PM

Haha, love it! I just had to register to say how awesome this is!
Someone comes here with the problem that batch render doesn't work.. so the response is to make a working one hahaha, we should be paying you to make the software, not Autodesk!

NextDesign 08-02-2012 03:26 AM

Quote:

Originally Posted by Antonin Ganner (Post 332894)
Haha, love it! I just had to register to say how awesome this is!

Thanks mate, I appreciate it. I'm glad you found it useful!

reinterpret 08-02-2012 08:50 PM

hi. thanks a lot.

yes. i had everything correct. if have to be a problem with the vue scene. i deleted it for a quick test and then it again worked out perfect. strange. but also with batch renderer its not working. it renders some frames and then it stops saying that it has made it.


All times are GMT. The time now is 04:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018