PDA

View Full Version : Rendering multiple cameras in one scene file



dsol
03-21-2017, 05:45 AM
Hi chaps,

I'm currently doing some simple animation work for a documentary, with a lot of camera moves over a famous building. It's driving me slightly nuts having to keep changing the frame ranges and output file names (and saving individual LWS files) every time I want to render a new camera move. Is there any way to override the camera used for rendering and the frame ranges + output file name/location - perhaps using a 3rd party render controller?

It would be amazing if a future version of LW allowed you to set up the frame ranges and output files as properties attached to individual cameras (even better if the filenames defaulted to the name of the camera!) Or is there some hidden feature of LW I'm not aware of that lets you do that already?

ernpchan
03-21-2017, 05:56 AM
Does this help?
https://youtu.be/1_K7QPAn5Ak

kopperdrake
03-21-2017, 06:00 AM
+1 for the feature request. Just done as simple logo intro with pieces flying into place and TurbulenceFD - several cameras so I can cut to different vantage points in edit, but six separate scenes, one for each camera. Of course - you make a change to one scene and you're back to the master, which you then need to create the individual camera scenes all over again.

Personally I think a lot of the Render Globals should be in the same panel as the appropriate camera, along with the Output, so we can have multiple cameras and their settings per scene.

dsol
03-21-2017, 06:17 AM
Does this help?
https://youtu.be/1_K7QPAn5Ak

Not really in my case, unfortunately. It's interesting - but it's effectively cutting between cameras. I could shift the animation keyframes for each camera so they all started one after the other, but that would be a monstrously messy project to work with - especially if I just needed to re-do one shot. Thanks for sharing the link though!

ernpchan
03-21-2017, 06:22 AM
It's driving me slightly nuts having to keep changing the frame ranges and output file names (and saving individual LWS files) every time I want to render a new camera move. Is there any way to override the camera used for rendering and the frame ranges + output file name/location - perhaps using a 3rd party render controller?


You could make a script to help automate the creation of the individual scene files based on how many cameras you have and the length of their animation.

dsol
03-21-2017, 06:28 AM
That would be a very handy script indeed. Unfortunately my knowledge of LScript is nearly zero - and I'm up against it on a deadline at the moment :(

ernpchan
03-21-2017, 09:25 AM
That would be a very handy script indeed. Unfortunately my knowledge of LScript is nearly zero - and I'm up against it on a deadline at the moment :(

Necessity is the mother of invention. Learning to script, while intimidating at first, is a great way to add to your skillset. I would suggest going the python route, don't bother with lscript.

The pseudo code would be as follows:
Get cameras in scene.
Begin iteration over number of cameras.
Set render output, frame range and name of file based on camera name (or however you're marking this information).
Go back to 2.

dsol
03-21-2017, 09:40 AM
Necessity is the mother of invention. Learning to script, while intimidating at first, is a great way to add to your skillset. I would suggest going the python route, don't bother with lscript.

The pseudo code would be as follows:
Get cameras in scene.
Begin iteration over number of cameras.
Set render output, frame range and name of file based on camera name (or however you're marking this information).
Go back to 2.


Ah, I can code (in javascript) - but unfortunately I'm really up against a deadline at the moment, so really don't think I'll realistically be able to learn python (and the LW-specific aspects of it) in the time remaining. I'd be happy to offer some cash bounty up if any other scripters out there could build a script that does this (and would be happy to share it with the community too!)

Ztreem
03-21-2017, 11:31 AM
This was the cloest I got to solve it, but it doesn't work. Maybe it can give someone who knows more some ideas. I use the camera selector to trigger a camera change then render scene with that camera, but it only renders the last render scene command?

136325

If this had worked as expected it would have rendered the scene frames 1-10 from all three cameras.

dsol
03-21-2017, 12:19 PM
This was the cloest I got to solve it, but it doesn't work. Maybe it can give someone who knows more some ideas. I use the camera selector to trigger a camera change then render scene with that camera, but it only renders the last render scene command?

136325

If this had worked as expected it would have rendered the scene frames 1-10 from all three cameras.

if I was going to implement this in pseudo-code in javascript it would be a bit like this:


var contentDir = project.ContentDirectory

for (i=0, items in scene, i++) {

if (i == Camera) {

var currentCamName = i.name

project.renderStartFrame = i.firstKeyFrame
project.renderEndFrame = i.lastKeyFrame

create folder in contentDir:Renders folder called currentCamName

set output filename to currentCamName

save scene with name currentCamName

}

}

ernpchan
03-21-2017, 03:22 PM
That's the right idea. Obviously syntax and how you get/write information is wrong.

Matt
03-21-2017, 03:58 PM
Might have a look at this.

Sensei
03-21-2017, 04:05 PM
Hi chaps,

I'm currently doing some simple animation work for a documentary, with a lot of camera moves over a famous building. It's driving me slightly nuts having to keep changing the frame ranges and output file names (and saving individual LWS files) every time I want to render a new camera move. Is there any way to override the camera used for rendering and the frame ranges + output file name/location - perhaps using a 3rd party render controller?

It would be amazing if a future version of LW allowed you to set up the frame ranges and output files as properties attached to individual cameras (even better if the filenames defaulted to the name of the camera!) Or is there some hidden feature of LW I'm not aware of that lets you do that already?

Camera Selector Master plugin, like ernpchan said, is tool you're searching for.

However Camera Selector Master plugin, cannot work with Render controllers, and LWSN,
therefor I made Camera Selector Baker plugin,
which you can see in action on this example video:
https://www.youtube.com/watch?v=4NbzvJUye9A

It's part of TrueArt's Modeling Pack
http://modelingpack.trueart.eu

dsol
03-21-2017, 04:37 PM
Camera Selector Master plugin, like ernpchan said, is tool you're searching for.

It's a solution of sorts but will have horrible knock-on effects for workflow, since you have to stagger all your camera moves across time - and editing long timelines in LW (or any 3D app) is not a very pleasant experience, especially when the client comes back and says "can we make shot 4 longer?" :) And as you say, there are issues with render farms.

I think there's a much better solution possible. And it's something that will make a huge difference for a lot of users

Sensei
03-21-2017, 04:39 PM
It's a solution of sorts but will have horrible knock-on effects for workflow, since you have to stagger all your camera moves across time - and editing long timelines in LW (or any 3D app) is not a very pleasant experience, especially when the client comes back and says "can we make shot 4 longer?" :) And as you say, there are issues with render farms.

I think there's a much better solution possible. And it's something that will make a huge difference for a lot of users

Check private msg.

dsol
03-21-2017, 04:48 PM
Might have a look at this.

That would be amazing!:thumbsup:

Let me know if you need any enticement (beer - or more than beer - money!)

dsol
03-21-2017, 04:55 PM
One idea I had is - is there any way to add a simple script/plugin to cameras that literally just holds start frame and end frame values (set manually by the user - though it'd be awesome to have an auto-range-detect function)? Then once you had that script on all the cameras you wanted to render out from, you could run a master script that looks for the presence of the plugin/script attached to cameras, and uses it to generate the correctly in'n'out-point-set LWS files

Matt
03-21-2017, 06:41 PM
One idea I had is - is there any way to add a simple script/plugin to cameras that literally just holds start frame and end frame values (set manually by the user - though it'd be awesome to have an auto-range-detect function)? Then once you had that script on all the cameras you wanted to render out from, you could run a master script that looks for the presence of the plugin/script attached to cameras, and uses it to generate the correctly in'n'out-point-set LWS files

Already had this in mind.

If you have a scene with multiple cameras in them, there is no place to set start / end frames per camera, so my thought was a Master script that presents a list of all cameras in the scene, there you'd set the start / end frames for each one.

Sensei
03-21-2017, 06:48 PM
If you have a scene with multiple cameras in them, there is no place to set start / end frames per camera, so my thought was a Master script that presents a list of all cameras in the scene, there you'd set the start / end frames for each one.

Are you familiar with Camera Switcher? There are two such plugins already in LW...

You're just talking about how to tell master plugin which camera should be rendering which frame..

Matt
03-21-2017, 07:07 PM
Are you familiar with Camera Switcher? There are two such plugins already in LW...

You're just talking about how to tell master plugin which camera should be rendering which frame..

I am, that script switches to user specified cameras at certain keys as it goes along the timeline - start to end.

What I believe Dan wants is to have multiple cameras with different start / end ranges that could be something like:

Camera 1 @ Frame 1 - 10
Camera 2 @ Frame 1 - 30
Camera 3 @ Frame 1 - 15

Etc.

Even maybe:


Camera 1 @ Frame 20 - 50
Camera 2 @ Frame 1 - 45
Camera 3 @ Frame 128 - 256

Etc.


Then save with the output frames set to:

scene_name-camera_name_frame_number.png

So Camera Switcher won't even do the switching right.

Unless of course I'm reading his request entirely wrong.

Matt
03-21-2017, 07:13 PM
One idea I had is - is there any way to add a simple script/plugin to cameras that literally just holds start frame and end frame values (set manually by the user - though it'd be awesome to have an auto-range-detect function)? Then once you had that script on all the cameras you wanted to render out from, you could run a master script that looks for the presence of the plugin/script attached to cameras, and uses it to generate the correctly in'n'out-point-set LWS files

You know one other way your could do this that might be simpler.

Put the start / end ranges in the camera name:

Camera_Name-1-30

Then, rather than create a whole GUI to manage the start / end frames for each camera. Have a scene export script that loops through all the cameras, extracts the start / end frames and sets up a scene for each camera with the start / end set and the output string changed.

dsol
03-22-2017, 11:14 AM
Already had this in mind.

If you have a scene with multiple cameras in them, there is no place to set start / end frames per camera, so my thought was a Master script that presents a list of all cameras in the scene, there you'd set the start / end frames for each one.

That would be perfect. Would you be able to save frame ranges if it was a script though? Be a bit of a pain to re-type them all out every time you want to re-export all the LWS's.
Thanks again for looking into this. If something like this works, it will literally save me - and others - hours of dull (and human-error-prone) work over the course of a project.

kopperdrake
03-22-2017, 12:38 PM
You know one other way your could do this that might be simpler.

Put the start / end ranges in the camera name:

Camera_Name-1-30

That's pretty much what I do at the moment. Create a master scene file, call each camera Cam_1-40, Cam_10-60 etc and then copy/paste that camera name into the Output filename box, so all the renders end up in the same folder and I sort them afterwards. If the script could also create a sub-folder for each of the cameras, with the camera name, so that each iteration of the scene saves to the appropriately named sub-folder then that would be golden :thumbsup:

dsol
03-22-2017, 02:46 PM
You know one other way your could do this that might be simpler.

Put the start / end ranges in the camera name:

Camera_Name-1-30

Then, rather than create a whole GUI to manage the start / end frames for each camera. Have a scene export script that loops through all the cameras, extracts the start / end frames and sets up a scene for each camera with the start / end set and the output string changed.

That's a great way to do it. Maybe put a unique escape sequence of characters, like CXIN and CXOUT, before the in and out numbers so it doesn't get mis-parsed.
And it has the added bonus that Cameras that don't have the unique identifier in their names don't get used. Cool!

Matt
03-22-2017, 05:51 PM
Okay, I have this working.

Let me double check it first.

I ended up making it look at the cameras first and last keys for the render range, that way you don't have to manage anything in some GUI.

dsol
03-22-2017, 07:12 PM
Absolute LEGEND!
https://media.giphy.com/media/q4sdF9tchap6E/giphy.gif

Matt
03-22-2017, 08:05 PM
Give this a shot, if you want to change the scene file name / save location for the renders etc. Change this line:


new_scene_name = scene_filename_split[3] + "-" + camera_names[s] + " (" + camera_first_key[s] + " - " + camera_last_key[s] + ")";

Let me know if you find any bugs / need something changing.

Cheers
Matt

136331

136332

dsol
03-22-2017, 08:23 PM
I'll test this out first thing tomorrow morning. I'll have a look at the code too, be interesting to learn more about scripting in Lightwave (and I really should learn Python anyway!)

Thank you so much for doing this. I love this community - and I love Lightwave!

Matt
03-22-2017, 08:26 PM
Yeah I need to start doing stuff in Python vs LScript myself!

ernpchan
03-22-2017, 08:50 PM
Don't forget to add this to the plugin database!

wingzeta
03-22-2017, 10:51 PM
Wow! I think LW just got better before our eyes. Thanks Matt! Can't wait to try this out myself. This would have been huge on a few past projects.

kopperdrake
03-23-2017, 04:36 AM
:thumbsup:

ianr
03-23-2017, 06:27 AM
:jam::jam::jam::jam::jam::jam::jam: MATT

allabulle
03-23-2017, 08:30 AM
Wow! I think LW just got better before our eyes. Thanks Matt! Can't wait to try this out myself. This would have been huge on a few past projects.

Ditto!

joseba
03-23-2017, 01:03 PM
Thank you very much Matt. It is a serious time saver!

joseba
03-23-2017, 01:38 PM
I Think it could be perfect with a gui like this mockup:
136337

dsol
03-24-2017, 11:05 AM
I Think it could be perfect with a gui like this mockup:
136337

It would certainly be cooler with a GUI, so it can be used for all kinds of scenes - including ones where you only want to render certain camera movement sections (or different static camera angles observing other animation) - but for now, this is still a massive productivity booster. Matt did us all proud! :)

ernpchan
03-24-2017, 02:57 PM
It would certainly be cooler with a GUI, so it can be used for all kinds of scenes - including ones where you only want to render certain camera movement sections (or different static camera angles observing other animation) - but for now, this is still a massive productivity booster. Matt did us all proud! :)

I could wrap a UI around Matt's code since he left it open source...but I'd have to get my brain wrapped back around lscript. Maybe I'll convert it to python over the weekend.

Sensei
03-24-2017, 06:46 PM
Making GUI is 90-95% of the whole plugin/tool programming..

Matt
03-24-2017, 08:34 PM
It would certainly be cooler with a GUI, so it can be used for all kinds of scenes - including ones where you only want to render certain camera movement sections (or different static camera angles observing other animation) - but for now, this is still a massive productivity booster. Matt did us all proud! :)

I could add a list gadget to select which cameras should be exported. I had already started it when I was going to do it the other way.