PDA

View Full Version : Script that renders all frames in a scene?



Hieron
09-27-2009, 06:46 AM
Yes, F10 in script form :)

The reason for such a thing is given in this thread:http://www.newtek.com/forums/showthread.php?p=930692#post930692

Basically it is to circumvent LW keeping track of the radiosity cache in memory as it does with F10. With F9 one can get great results with a GI trick, F10 ruins it since it relies and reverting back to the base static cache per frame.

Would this be possible?


(saving of images would be done by one of the buffer savers in Image Filters I guess)

Matt
09-27-2009, 08:02 AM
I'm looking at this now ...

UnCommonGrafx
09-27-2009, 08:03 AM
You mean like using lwsn? A background renderer?

Look up Faulknermano's site, I believe, for a background renderer. Or google "Render frame render scene lightwave" for a plugin.

Never mind... got it.

Matt
09-27-2009, 10:43 AM
Well I sort of got it working, but there is a problem.

If you have 'Render Display' set to 'None' it asks you every frame if you want to turn on the 'Image Viewer'.

If you say no, it doesn't render the frame.

If you say yes, it jumps to the last frame and renders that only, I have no idea why it does this.

AutoConfirm(1) automatically closes the 'Preview' render display, which would work, if you set 'Render Display' to Render2Image, but I can't figure out why it's only rendering the last frame.

Here's the code if anyone can figure it out.


@name "F9 Frame Render"
@script generic

generic
{
// Get scene render range info

first_frame = Scene().renderstart.asNum();
last_frame = Scene().renderend.asNum();
frame_step = Scene().framestep.asNum();

// Turn on Auto Confirm (closes render preview window automatically)

AutoConfirm(1);

// Loop through frames

for(loop = first_frame; loop <= last_frame; loop+= frame_step)
{
// Go to frame

GoToFrame( loop );

// Show info

info("Rendering Frame: " + loop + " / " + last_frame + " Step: " + frame_step);

// Render frame

RenderFrame();
}

}

faulknermano
09-27-2009, 10:38 PM
Just a shot in a dark: but try using Master class scripts with the process callback looking for the RENDER_DONE event. This keeps track of the init and completion of the render.

walfridson
09-27-2009, 11:52 PM
^ what he said

Look at RenderQ.ls Bit undocumented.

Matt
09-28-2009, 02:40 AM
Just a shot in a dark: but try using Master class scripts with the process callback looking for the RENDER_DONE event. This keeps track of the init and completion of the render.


^ what he said

Look at RenderQ.ls Bit undocumented.

I did think of using a Master script, even looked at RenderQ.ls, I'm not very up on Master Scripts, but will take a look another look.

-EsHrA-
09-28-2009, 03:37 AM
bg render? http://jeremy.lwidof.net/lscript/

mlon

Matt
09-28-2009, 05:38 AM
Actually, I've done it! Doing it as a Master Script worked!

Matt
09-28-2009, 06:40 AM
Okay, here it is.

I did a little video to show how it works, and some of the issues you will find.

Video: F9 Render Sequence Script (http://www.pixsim.co.uk/LW_Scripts/F9_Render_Sequence_Script_Video.zip)
QT H.264

Script, attached.

Hope you find it useful, although I have to admit, I'm not entirely sure why you wanted this! But I like the challenge of scripting!

Also, here's a link to the Render2ImageFP plugin I mentioned, which allows you to save to the same image (32 Bit Intel only).

http://www.splotchdog.com/index.php?option=com_content&task=view&id=39&Itemid=39 (Latest version)

(Thread about it, but older version attached)
http://www.newtek.com/forums/showthread.php?t=56117

Cheers
Matt

P.S. Thanks to Bob Hood for not compiling his RenderQ.ls script so I could learn from it!

3DGFXStudios
09-28-2009, 07:41 AM
Thanks for the script Matt! :D This is also really handy for the bug that exists in LW 9.6 (and in HC for sure) that buffers all frames if you're using a background image sequence.

erikals
09-28-2009, 12:40 PM
great :)
thanks Matt :)

very curious to see how this will turn out...
btw, tested the Render2ImageFP, got a crash the first time i used it, not after though...
might very well do the job.

edit: just tested, both Render2ImageFP and F9 Render Sequence runs great :)

erikals
09-28-2009, 01:16 PM
urm,... eh,... Render2ImageFP doesn't actually preview anything, sorry... was sleeping.
so, i guess that one doesn't work...

edit: agh, i keep going back and forth here, using Render2ImageFP now to avoid pop-ups...
not really sure if i'm doing things right... :o

Matt
09-28-2009, 03:55 PM
urm,... eh,... Render2ImageFP doesn't actually preview anything, sorry... was sleeping.
so, i guess that one doesn't work...

edit: agh, i keep going back and forth here, using Render2ImageFP now to avoid pop-ups...
not really sure if i'm doing things right... :o

Render2ImageFP from what I can gather (not actually used it) does the same thing as NT's Render2Image, it renders into the Image Editor, but allows you (apparently) to save over the same image, rather than adding every frame you render.

So it's not so much about not having the Image Viewer popup, as using using NT's Render2Image would put you in the same boat (holding all Frames rendered in memory) it's about being able to render to the Image Editor and replace the last rendered Frame in there, thus saving memory.

adk
09-28-2009, 06:57 PM
... that's great, cheers a bunch Matt :thumbsup: works like a treat with the psd export.

As PSD's would be an extra pain I tried to use DPont's Node Pixel Filter to save out the images. Funny thing is if I press F9 it works, if I use your script however I can't get it to save the images ? Well it actually worked once but I have no idea why it worked in that instance ? Weird.

Here's the setup & scene if anyone is interested. Might need Denis's help.

Thanks again :)

Matt
09-28-2009, 07:11 PM
... that's great, cheers a bunch Matt :thumbsup: works like a treat with the psd export.

As PSD's would be an extra pain I tried to use DPont's Node Pixel Filter to save out the images. Funny thing is if I press F9 it works, if I use your script however I can't get it to save the images ? Well it actually worked once but I have no idea why it worked in that instance ? Weird.

Here's the setup & scene if anyone is interested. Might need Denis's help.

Thanks again :)

It should work, all my script does is call the RenderFrame command, which is the same as you pressing F9.

adk
09-28-2009, 07:19 PM
...Yeah that's what I thought but for some reason I can't get it to go.
Maybe someone can test it and see if it works on their machine.

It might be an issue with my LW so I'll try it with clean configs and only add what's needed. I did manage to get it to work as expected once but no idea why it worked that particular time.

Thanks again :thumbsup:


... must have been something on my end. Clean configs & everything seems to work fine :)

Hieron
09-29-2009, 01:52 PM
Hope you find it useful, although I have to admit, I'm not entirely sure why you wanted this! But I like the challenge of scripting!

Also, here's a link to the Render2ImageFP plugin I mentioned, which allows you to save to the same image (32 Bit Intel only).


:) Ah it's not that hard to explain, I'll give it a shot:

With the GI trick I described in that thread, you basically make LW cache the GI of all static objects in the scene by just hiding everything that moves and doing a simple static GI cache of the scene. Then you unhide the moving parts and want to render, while LW fetches the info it has on the static stuff while it preprocesses all that moves.

Just setting the preprocess to "always" will do this. It will see it already has much of the scene preprocesses the new moving objects. Then save back to cache.. ick.. we don't want that, because then when frame 2 comes, it thinks it has it all in cache and just keep on having that GI solution for all frames. So we make the cache read only in explorer. Problem solved you'd think, every frame LW reads the cache and sees it only needs the moving ones, again and again and again.

But LW keeps the cache in mem. with F10. So it doesn't bother with the read only cache up untill the entire sequence is done, then sees it can't save to file and discards te info. So that won't work, it will have at frame 2 the cache in mem and not update the cache anymore really.

So that's why a F9 sequence is/was needed. After every render, the extra info is flushed and the next frame LW wil reinterpret the moving parts again, this time being at another position..

Ideally, this would one day work with lwsn too :)

What it is in effect, is the user determining what object is cached and what needs preprocessing on the fly etc. Sort of like baking an object, but simpler and applicable to weird/big scenes and very easily changed.


Too bad for the 32 bit only... :|

Would it be possible to write a dud plugin for that? Something that can be selected in render view but does nothing?

Thanks a dozen for your work on the script!

Gregg "T.Rex"
10-02-2009, 01:48 AM
Hey, Matt...
Thanks so much for this little helper!

It saved my *** overcoming the show stopper bug LW has, when using object sequences that use nodes with pre-processing...
See this (http://www.newtek.com/forums/showthread.php?t=102479)thread about that bug...

BTW, i couldn't get it to save using any RGBA saver plugin in Image Filter, other than PSD export...

Thanks again!
T.Rex

Matt
10-02-2009, 09:26 AM
Hey, Matt...
Thanks so much for this little helper!

It saved my *** overcoming the show stopper bug LW has, when using object sequences that use nodes with pre-processing...
See this (http://www.newtek.com/forums/showthread.php?t=102479)thread about that bug...

BTW, i couldn't get it to save using any RGBA saver plugin in Image Filter, other than PSD export...

Thanks again!
T.Rex

You're welcome Gregg, nice to hear someone has found a use for it!

Interesting about the Image Filter, does it save if you do a manual F9?

If not, the RGA Saver is probably not designed to work with F9 renders, and only F10 sequences.

Either than or I could try and add some of the other 'render done' flags to the event filtering, maybe my script just needs to catch them all, not sure.

Cageman
10-02-2009, 11:23 AM
Okay, here it is.

Simply BRILLIANT!

:thumbsup:

Cageman
10-02-2009, 11:25 AM
Hey, Matt...
Thanks so much for this little helper!

It saved my *** overcoming the show stopper bug LW has, when using object sequences that use nodes with pre-processing...
See this (http://www.newtek.com/forums/showthread.php?t=102479)thread about that bug...

BTW, i couldn't get it to save using any RGBA saver plugin in Image Filter, other than PSD export...

Thanks again!
T.Rex

Have you tried exrTrader? (I just found out about this script so I havn't had time to test it yet). I usually use exrTrader for pretty much everything, so if it works for that, then I'm game. :)

Lightwolf
10-02-2009, 11:31 AM
Have you tried exrTrader? (I just found out about this script so I havn't had time to test it yet). I usually use exrTrader for pretty much everything, so if it works for that, then I'm game. :)
I don't see why it shouldn't as long as you tell to save the buffers, otherwise they're only saved in the context of lwsn.

Cheers,
Mike

Gregg "T.Rex"
10-02-2009, 01:42 PM
Have you tried exrTrader? (I just found out about this script so I havn't had time to test it yet). I usually use exrTrader for pretty much everything, so if it works for that, then I'm game. :)

No, i don't have it to test it, though Mike could do a quick test.... :)
Mike ? :)

Lightwolf
10-02-2009, 04:04 PM
No, i don't have it to test it, though Mike could do a quick test.... :)
Mike ? :)
Check, it works as expected.

Cheers,
Mike

erikals
10-02-2009, 04:14 PM
that was quick... :)

Cageman
10-02-2009, 11:18 PM
that was quick... :)

That's what she said yesterday....

:D

Hieron
10-03-2009, 07:14 AM
Really really appreciated guys. Got a big rendering coming up of some insane area and this trick and great script makes it a whole lot easier.

Sure I can't use lwsn so it is a bit of a hassle, but still..

Great to hear EXRtrader works!

erikals
10-03-2009, 11:17 AM
That's what she said yesterday....

:D

yo' mama?.. :) :cat:

Hieron
10-03-2009, 12:28 PM
:)



Was there a way around ImageViewer for 64 bit yet btw?

Lightwolf
10-03-2009, 01:42 PM
:)
Was there a way around ImageViewer for 64 bit yet btw?
That almost sounds like a need for "Revenge of the Lenscap" - an image viewer that does nothing ;)

Cheers,
Mike

Hieron
10-03-2009, 02:08 PM
That almost sounds like a need for "Revenge of the Lenscap" - an image viewer that does nothing ;)

Cheers,
Mike

hehe :)
Actually, yes that would be ideal

Would it be tough to make?

Matt
10-03-2009, 02:13 PM
That almost sounds like a need for "Revenge of the Lenscap" - an image viewer that does nothing ;)

Cheers,
Mike

Sounds like an easy job for you that Mike! :)

erikals
10-03-2009, 03:19 PM
4 more posts Matt... :)

Lightwolf
10-03-2009, 03:32 PM
Sounds like an easy job for you that Mike! :)
Yup, but not tonight :)

Cheers,
Mike

Matt
10-03-2009, 03:33 PM
4 more posts Matt... :)

3 more now!

erikals
10-03-2009, 03:41 PM
...can u make it past Saturday? :D

Matt
10-03-2009, 07:14 PM
...can u make it past Saturday? :D

It appears so!

Lightwolf
10-04-2009, 07:07 AM
Here you go, another amazing plugin from db&w.

We proudly present:
Revenge of the Lenscap
The image viewer that does nothing(tm).

I've only got a Windows 32- and 64-bit version up at the moment.

Cheers,
Mike

Hieron
10-04-2009, 07:46 AM
Hahaha :)


I'm really curious to see whether this Lenscap will bite me in the *** one time :) But many thanks for that! Now the F9 script should work really well!


edit: it works great! :)

Lightwolf
10-04-2009, 07:54 AM
edit: it works great! :)
Is it amazing when something that doesn't do anything works great? ;)

Cheers,
Mike

Cageman
10-04-2009, 08:18 AM
Here you go, another amazing plugin from db&w.

We proudly present:
Revenge of the Lenscap
The image viewer that does nothing(tm).

I've only got a Windows 32- and 64-bit version up at the moment.

Cheers,
Mike

LOOOL!

And yes, if used with Matts script, this tool does make sense... ALOT of sense, actually!

:)

EDIT:

And I love that it is called ROTFL, which is basicly what I did when reading your post the first time, especially the part with "...does nothing (tm)".

:D

Hieron
10-04-2009, 08:35 AM
The "f" in the abreviation is nowhere in the full name. I wonder if it was left out at the last minute..

I guess db&w marketing ruled against it :)



I do wonder a bit what 135 kb of data is doing, when doing nothing :)


ps: Thanks Matt for leaving that script uncompiled, I never got around to scripting for LW, but it sure is nice to read through it all. Thanks for your efforts and explanations in the file! Btw, it's not possible to add this script to the menubars right?

Lightwolf
10-04-2009, 09:10 AM
The "f" in the abreviation is nowhere in the full name. I wonder if it was left out at the last minute..

I guess db&w marketing ruled against it :)

No, it's just an invitation to explore your imagination... or something like that ;)

I'm sure there's a concept behind it somewhere :D

Cheers,
Mike

-EsHrA-
10-04-2009, 09:40 AM
so...what does it do? :)


mlon

Hieron
10-04-2009, 12:58 PM
hehe.. RotfL had its revenge on me already..

Matt
10-04-2009, 05:40 PM
Here you go, another amazing plugin from db&w.

We proudly present:
Revenge of the Lenscap
The image viewer that does nothing(tm).

I've only got a Windows 32- and 64-bit version up at the moment.

Cheers,
Mike

Gotta say, this must be your best work Mike! :D

Nice though, you never know when it might come in handy!

Hieron
10-29-2009, 06:19 PM
Hi Matt

I get enclosed error pretty often... not sure why that would pop up. Do you have a clue or remedy?

faulknermano
10-29-2009, 07:26 PM
This usually comes up if your control identifier is (nil), which usually means that it's out of scope. Call it as a global variable and you'll be able to use it anywhere.

If this isn't the problem then it's probably because the control id itself is invalid, or if your script is big it may be that LScript is losing the variables (it has happened to me on large scripts).

To be sure, you can paste the code here for inspection.

Cageman
11-15-2009, 12:23 PM
This is interresting...

I have a situation right now where an F9 takes about 1 minute and 30 sec to render, while an F10 render will take about 12-16 minutes to render. Same thing with Screamernet. It doesn't make sense...

Using this script ends up with the same redicilous rendertimes as I have with F10 or screamernet...

:/

Matt
11-15-2009, 04:32 PM
Hi Matt

I get enclosed error pretty often... not sure why that would pop up. Do you have a clue or remedy?

Ahhhhh, it's probably trying to set something on the UI without it being initialised.

See if this works.

erikals
11-15-2009, 04:34 PM
This is interresting...

I have a situation right now where an F9 takes about 1 minute and 30 sec to render, while an F10 render will take about 12-16 minutes to render. Same thing with Screamernet. It doesn't make sense...

Using this script ends up with the same redicilous rendertimes as I have with F10 or screamernet...

:/

...did you prepare the scene correct?
...did you make the Gi cache file read-only?

stefan
04-13-2011, 01:07 PM
great script. thx