If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

[Scripts]Create camera image plane

Hi!

Working on a scifi live action movie (lots of greenscreen footage), so I've created some scripts for things we are doing frequently.

The other script should be run with a camera selected and then creates an imageplane, sets up drivers to automatically scale it by the render aspect ratio and focal length of camera and distance (that would be the neg z of the imageplanes location) so it will cover the entire screen. It sets up a cycles material so it's ready to load an image sequence (I'm using lowres pngs where the green screen has been keyed out in my workflow).

Limitation: no testing that the selected object is a camera (script will fail if it's not)

By the way, is there some way to get the texture correctly (with alpha that is) shown in the viewport when selecting 'material' or 'textured' (if so, I haven't found it, I'm using rendered preview to test placement relative to my backgrounds)? Is there a script available to save an animation from the viewport when it's played (so I can use the textured mode instead of opengl rendering - difference in speed is large)?

@3pointEdit: You're welcome.
@chloesdad: The script does not do anything magical, it creates a plane and setups some drivers so when the distance from the camera (-z) is changed the plane is automatically scaled to cover the screen and gives it a cycles material so i'll just have to load the texture. It's not complicated to do by hand, but I created a script since it's something I'd otherwise have to do a repeatedly. Of course a possibility might have been to just create it once and keep it in a blend file and then import the camera together with the plane. That would probably have worked as well, but I needed to learn some python to be able to make other repeated tasks faster in the future.

tobbew, when i load this script then warning message is shown - auto-run disabled: driver '-depth*tan(camAngle/2)'
After that the image plane is in outliner but in the view there's no image plane - even after loading image sequence or single image to the shader.

I think the problem is in object scale drivers script. I deleted object scale X and Y drivers and then i can manipulate scale of the image plane and after that image plane with texture is shown, but after thant when i move image plane there's no scaling to fit camera view and i need to do this all the time by hand.

Mayby i do something wrong so can you create short video how to do this correctly?

So I have been playing with the script. I wonder how you determine the distance to place the plane from camera? How does the script achieve placement along the z axis?

Question-
If I move the plane how would I return it to the initial location relative to the camera?

I guess I can add a constraint after running the script, but would this conflict with whatever you are doing? I cannot see a driver or constraint that performs the rotation lock?
EDIT:
After running the script I added:
1. Limit location set to -10 Z units min/max (I read that was the figure the script assigned)
2. Limit rotation on all axis

Then I free the plane by reducing the 'influence' to zero on both constraints. To restore the registered initial location you increase the 'influence' again.

EDIT2:
I can't work out how to reduce the influence of the Scale Driver in the script though? It would be nice if I could key frame this too?

EDIT3:
Ok so I just mute the drivers.

Last edited by 3pointEdit; 23-Mar-14 at 22:28.

Cheers, David ___________"awesome in space and other places".
________Follow me on twitter @3pointedit
_____________ Check the Youtube Channel for tutorials. Or my Sketchbook

@3pointedit:
I don't understand your question, to be honest. What are your trying to accomplish?

The scripts sets up drivers with the goal to have it always cover the entire screen no matter what the distance from the camera is. In my own workflow it is not supposed to be moved except for depth (-z if I remember correctly, currently not on my own computer). The idea is to move the camera.

I use it when I have lot's of angles of green screen footage and a 3d rendered environment.
My workflow (not the only possible one, you may use it however you wish):
1) film footage and prepare lowpoly background
2) camera match the footage.
3) key away the green screen and output a lowres proxy of the keyed footage as a png serie
4) run the script on the camera, set up the Proxy footage for the material
5) place the camera and adjust the depth to the camera image plane (since the plane is parented to the camera it will follow and meanwhile I can use the cycles viewport rendering to see through the green screen and see how the placing will be and scrub through the animation)
6) model details and fix textures on parts visible in the camera angles or for objets outside whose shadows or reflections will affect the scene (if we had done a proper previs we'd already know, but we didn't)
7 ) render final footage without the camera image plane and do proper post compositing

The script does not do any placement along z except for a default which bears no specific meaning, but is supposed to be changed to what's appropriate for your scene. I'm working on (how originally around here :-) ) a hobby scifi short with all green screen environments.

Originally Posted by 3pointEdit

So I have been playing with the script. I wonder how you determine the distance to place the plane from camera? How does the script achieve placement along the z axis?

Question-
If I move the plane how would I return it to the initial location relative to the camera?

I guess I can add a constraint after running the script, but would this conflict with whatever you are doing? I cannot see a driver or constraint that performs the rotation lock?
EDIT:
After running the script I added:
1. Limit location set to -10 Z units min/max (I read that was the figure the script assigned)
2. Limit rotation on all axis

Then I free the plane by reducing the 'influence' to zero on both constraints. To restore the registered initial location you increase the 'influence' again.

EDIT2:
I can't work out how to reduce the influence of the Scale Driver in the script though? It would be nice if I could key frame this too?

Oh I see. I wonder where I can look to see parenting? Anyway I like to use it for motion graphics, where I want the image, video or art work to be registered perfectly to the camera as a default position. Then I need the flexibility to animate away from that position and return to it. It's really cool that the scale driver makes the flat field behave as an ortho camera view, but I can still have 3d accurate perspective.

any chance you could grab a screens to demonstrate your layout?

Cheers, David ___________"awesome in space and other places".
________Follow me on twitter @3pointedit
_____________ Check the Youtube Channel for tutorials. Or my Sketchbook

Oh I see. I wonder where I can look to see parenting? Anyway I like to use it for motion graphics, where I want the image, video or art work to be registered perfectly to the camera as a default position. Then I need the flexibility to animate away from that position and return to it. It's really cool that the scale driver makes the flat field behave as an ortho camera view, but I can still have 3d accurate perspective.

any chance you could grab a screens to demonstrate your layout?

you can see the parenting in the outliner (the image plane). I think you can see it also in the object properties. If you want to turn it on anf off you might want to use a parent constraint instead so you can animate its weight. Then you might also add an empty to the scene and also add a parent constrain with an inverted weight from the one from the camera so uou can animate the position with the empty and by animating the weight. You might want to change the scale equations to mix between the scale of the empty and the current formula based on the weight of the constrain

I'm not familiar with Python so I can't read what the code does, but how do you do this by hand?
I mean, how would you scale a plane so that it fits exactly the camera?
Or maybe you even know how to 'snap' a plane to the camera's "front plane" then?

Hello tobbew, nice script.
I found one 'gotcha'. If your preferences are set to add objects aligned to 'view', it will create a plane at an odd angle.
If the preference is set to add object to 'world' it works.
Outside of that, cool script.