# creating image plane with planes?

 05 May 2012 cwisbg PRO   portfolio Brandon Gillespie generalist High Impact Denver, USA creating image plane with planes? Im trying to get a plane in front of my cameras similar to an imagePlane and it needs to match the resolution of the camera. Here is the script so far http://pastebin.com/raw.php?i=63yD94MY So my question is: How can i get a plane to fit the camera resolution gate? Iv tried a bunch of the flags with the camera() cmd with no luck. Last edited by cwisbg : 05 May 2012 at 06:17 PM. share quote
 05 May 2012 Nyro Lurking   portfolio A. D. Vertex Slinger Munich, Germany I was working on that particular problem a long while ago (trying to create a nice camera shot overlay with info). I'm pretty sure there is a mathematical method to figure it out using the distance of the plane from the camera, the field of view, the focal length and the camera's view vector to figure it out perfectly, but I don't know the math and I'M too stupid. So instead I worked with a hack: I placed a plane flat on the grid, made sure its dimensions matched the render resolution (queried from renderGlobals), used the viewHeadOn command to position the camera so that the plane filled the view, parented the plane to the camera and return the camera to its original position. IIRC some custom scaling was necessary to perfectly align the edges, but all in all it did the job. I'm sure someone out there can give you a more precise and elegant solution though. Maybe Zoharl or Nathan? __________________ aweControlPicker (GUI Picker for Maya) share quote
 06 June 2012 gtbull80 New Member portfolio Chuks Ibeji No longer a freelancer...I'm an affordablelancer Left Justified Productions Miami, USA Nyro is right, there is a mathy way to figure out the distance using the field of view (more specifically the camera aperture), the focal length, and the resolution. It's a little tricky to explain...but I'll give it a shot... You first need to start with a base aperture. A default Maya camera is 1.417 x 0.945 in. Equivalent to 36 x 24 mm. No let's say we take the default resolution of 640x480, this gives us (32x24) x 20 ... 20 times the base aperture. (I'm only looking at the vertical). Given a focal length of 35, this is leads to place a 640x480 scaled plane in Maya 700 units away by simply multiplying the focal length by the multiplication factor (35x20). But I know what you're thinking, I'm working in HD, that example is so 2004. Well I feel you man, I feel you. So let's say instead, we're working in 720p. We change the scale of our plane to 1280x720. Now we change the aperture. We can either change the vertical or the horizontal. Let's change the horizontal giving us 2.51911x0.945 inches...equivalent to 42.666667x24 mm. This is our new base. 1280x720 is 30 times the base. To determine the distance, multiply your focal length by the base. And just cause I'm having such a good time doing this, I'll throw in a real world example. The Canon 7D has a sensor size of 22.3 x 14.9 mm for images. When you're shooting video, it windows to 22.3 x 12.54375 mm (16:9). Equivalent to 0.87775 x 0.4937 inches. This is our base. You'd use the inch measurements in you horizontal and vertical measurements respectively to match a Maya cam with 7D. 1280 x 720 is 57.3991 times our base. So at 720p and a focal length of 100, the distance we'd set a plane scaled to 1280 x 720 is 100 x 57.39991 = 5739.991 units. Hope this helps! share quote
 06 June 2012 Nyro Lurking   portfolio A. D. Vertex Slinger Munich, Germany Sounds nifty, but somehow the math doesn't pan out as expected for me. Using the values for 640x480, the plane does not fill the entire view when placed 700 units away from the camera. Interestingly though, those 700 units work perfectly for the 1280x720 example... __________________ aweControlPicker (GUI Picker for Maya) share quote
 06 June 2012 gtbull80 New Member portfolio Chuks Ibeji No longer a freelancer...I'm an affordablelancer Left Justified Productions Miami, USA Hmm...not sure...I just tried it again... Horizontal film aperture: 1.417 in. (36mm) Vertical film aperture: 0.945 in. (24mm) Resolution: 640 x 480 Plane scale: 640 x 480 Focal length: 35 distance: 700 fits snug as a bug. Maybe I'm missing something? share quote
 06 June 2012 Nyro Lurking   portfolio A. D. Vertex Slinger Munich, Germany Does overscan change anything for you? __________________ aweControlPicker (GUI Picker for Maya) share quote
 06 June 2012 gtbull80 New Member portfolio Chuks Ibeji No longer a freelancer...I'm an affordablelancer Left Justified Productions Miami, USA Ah...As a matter it does. Turning overscan on causes my method to fail. I simply turned on the resolution gate and set that bottom section to "Fill". I'd have to investigate why the math is altered with overscan on. But according to the docs: "If the resolution gate and the film gate have the same aspect ratio, these settings have no effect. The default setting is Fill. " Just a guess...but the default settings have mismatched aspect ratios. The aperture settings have a 1.5 aspect ratio while the resolution gate has a ratio of 1.3333. This might account for the discrepancy? share quote
 06 June 2012 Nyro Lurking   portfolio A. D. Vertex Slinger Munich, Germany Ah. I had it set to horizontal instead of fill (its default for me). I don't claim to fully understand all the options... will ahve to play around. But still good to have the math to do it without hacks. __________________ aweControlPicker (GUI Picker for Maya) share quote
 06 June 2012 procanic Altruist   portfolio Robert Schroeder Animator / FX-Artist Berlin, DE i just uploaded a script (MEL) that might do what you are looking for ... http://www.creativecrash.com/maya/d...nd-aspect-ratio some additional info on my blog. hope this helps. EDIT: link works now ... __________________ myBlog Last edited by procanic : 06 June 2012 at 10:31 AM. share quote
 06 June 2012 oglu Christoph Schädl   portfolio Christoph Schädl Austria in maya 2013 the free image planes are now a shape node... maybe thats interesting for you... http://download.autodesk.com/global...er=d30e6164 20 __________________ ArtStation share quote
 06 June 2012 Nyro Lurking   portfolio A. D. Vertex Slinger Munich, Germany Very cool. May I ask why you chose to use clusters and constraints for this setup? __________________ aweControlPicker (GUI Picker for Maya) share quote
 06 June 2012 procanic Altruist   portfolio Robert Schroeder Animator / FX-Artist Berlin, DE @oglu: the maya 2013 info is good news indeed! - sadly i dont have 2013 yet :( @Nyro: guess i found it easier back then to simply pin the corners to the calculated positions, than calculating the size from the positions and translating them into a scale value for the plane (which definitely could've been an option as well). maybe there was even another reason for it - honestly, i don't really remember since it's quite some time ago that i wrote the script. i just dug it out & repacked it into a tool when i read this post. if you're having any trouble with the setup just let me know and i'll see what i can do ... __________________ myBlog share quote
 06 June 2012 gtbull80 New Member portfolio Chuks Ibeji No longer a freelancer...I'm an affordablelancer Left Justified Productions Miami, USA @procanic: A most interesting approach. Good stuff! @cwisbg: In your posted script, I noticed you are mixing and default maya python and pymel...usually, this isn't a good thing to do. Also, just out of curiosity, why use a mesh and not the image plane background on the camera. Just wondering what spawned this little conversation. share quote
 06 June 2012 cwisbg PRO   portfolio Brandon Gillespie generalist High Impact Denver, USA @gtbull80 im doing some image matching , and originally the cam matches were going into unity, so they needed a mesh to display the image. share quote
 06 June 2012 procanic Altruist   portfolio Robert Schroeder Animator / FX-Artist Berlin, DE i just updated the script on creative crash to work without clusters. thanks Nyro for pointing that out! it really is much cleaner that way (only scale for size and translate for distance and offset). also added a new bool attribute on the camera, so you can decide whether the image plane should take the film offset into account. hope it'll be of use to someone! - cheers! __________________ myBlog share quote

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts vB code is On Smilies are On [IMG] code is On HTML code is Off CGSociety Society of Digital Artists www.cgsociety.org Powered by vBulletinCopyright ©2000 - 2006, Jelsoft Enterprises Ltd.