Jump to: Board index » General » Fusion

Import camera from Blender

Learn about 3D compositing, animation, broadcast design and VFX workflows.
  • Author
  • Message
Offline

Ulrik Karlsson

  • Posts: 24
  • Joined: Mon Jan 12, 2015 6:53 am

Import camera from Blender

PostMon Jan 12, 2015 7:00 am

Is it possible to import a camera from Blender into Fusion? In Blender you can export a camera as a python file but is there a way to import that into fusion?
Offline
User avatar

Blazej Floch

  • Posts: 191
  • Joined: Tue Nov 11, 2014 12:48 am
  • Location: Toronto, ON

Re: Import camera from Blender

PostMon Jan 12, 2015 5:43 pm

I don't think there is a blender import by default in Fusion.
However there is FBX export plugins, probably even alembic.
Fusion also supports collada - but I've never tried to import a camera with that.

If nothing works feel free to attach the python file. Is it a Fusion file - or a common file?
It should not be a big effort to write a script that imports that data into something that Fusion understands - at least if there is a key for each frame and you do not need to deal with animation curve interpolation.
Offline
User avatar

michael vorberg

  • Posts: 943
  • Joined: Wed Nov 12, 2014 8:47 pm
  • Location: stuttgart, germany

Re: Import camera from Blender

PostMon Jan 12, 2015 7:41 pm

blender cant handle .abc right now, its on the roadmap

FBX and .dae works

will take also a look at the py format
Offline

Kyriakos Rissakis

  • Posts: 61
  • Joined: Tue Dec 23, 2014 5:00 pm

Re: Import camera from Blender

PostMon Jan 12, 2015 8:05 pm

Py2 import tab does not work for me.
For .fbx read my post in "Fusion and
Blender" thread.
Offline
User avatar

michael vorberg

  • Posts: 943
  • Joined: Wed Nov 12, 2014 8:47 pm
  • Location: stuttgart, germany

Re: Import camera from Blender

PostMon Jan 12, 2015 9:10 pm

had a quick look at the "io_anim_camera.py" script in blender and it could quiet fast modified to export a fusion comp file with all the camera attributes and animation inside.
but we would have to deal with the different axis (y-up versus Z-up), look which value is animated and stuff.

Kyriakos Rissakis wrote:Py2 import tab does not work for me.


do you have python2.7 (64bit) installed on your pc?
Offline
User avatar

michael vorberg

  • Posts: 943
  • Joined: Wed Nov 12, 2014 8:47 pm
  • Location: stuttgart, germany

Re: Import camera from Blender

PostMon Jan 12, 2015 11:15 pm

so, here is a first draft of the export script.

it exports the current selected Camera with baked keyframes as a fusion .comp file.

i tested it only very quickly with a very simple camera animation (2 keyframes on location and rotation in blender)

* it transfers the camera animation, rotation, focal length and sensor size to fusion
* it will currently only work with one selected camera
* it seems that i have some problems with file permission, i had to close blender to open it in fusion
Attachments
io_anim_camera_fusion.zip
(2.83 KiB) Downloaded 567 times
Offline
User avatar

Blazej Floch

  • Posts: 191
  • Joined: Tue Nov 11, 2014 12:48 am
  • Location: Toronto, ON

Re: Import camera from Blender

PostTue Jan 13, 2015 12:08 am

Nice work Michael. I see no reason why blender should keep reference to the file.
Did you try debugging it to see if it reaches the fw.close() ?
I tend to prefer using (py 2.5+):
Code: Select all
with open(filepath, "w") as fw:
    ...

for this and other reasons.
Offline

Ulrik Karlsson

  • Posts: 24
  • Joined: Mon Jan 12, 2015 6:53 am

Re: Import camera from Blender

PostTue Jan 13, 2015 7:25 am

Thank you so much Michael, this is exactly what I have been looking for! I'v tested your script now and it works really well. I only had to adjust the focal length of the camera in Fusion from 35mm to 35,4mm to make it align perfect. But that is no problem! And I didn't have to close Blender to open it in Fusion. It works really good for me. Thanks a lot!
Offline

Kyriakos Rissakis

  • Posts: 61
  • Joined: Tue Dec 23, 2014 5:00 pm

Re: Import camera from Blender

PostTue Jan 13, 2015 9:22 pm

michael vorberg wrote:do you have python2.7 (64bit) installed on your pc?

I have it now, thanks ,i had the 32bit. As for the script it does not seem to export
anything from Blender 2.7.2 ( rolling back to 2.5 is out of the question ).
Offline
User avatar

michael vorberg

  • Posts: 943
  • Joined: Wed Nov 12, 2014 8:47 pm
  • Location: stuttgart, germany

Re: Import camera from Blender

PostTue Jan 13, 2015 9:59 pm

Kyriakos Rissakis wrote: I have it now, thanks ,i had the 32bit. As for the script it does not seem to export
anything from Blender 2.7.2 ( rolling back to 2.5 is out of the question ).

did you select the camera before hitting the export? this was a really quick work with the script and it only exports the a selected Camera right now

i tested and wrote this with blender 2.71


ulrik.karlsson wrote:Thank you so much Michael, this is exactly what I have been looking for! I'v tested your script now and it works really well. I only had to adjust the focal length of the camera in Fusion from 35mm to 35,4mm to make it align perfect. But that is no problem! And I didn't have to close Blender to open it in Fusion. It works really good for me. Thanks a lot!


can you send me an example blend file where this different focal length appears? then i can try to find the error.
Offline
User avatar

michael vorberg

  • Posts: 943
  • Joined: Wed Nov 12, 2014 8:47 pm
  • Location: stuttgart, germany

Re: Import camera from Blender

PostTue Jan 13, 2015 10:03 pm

ahh, i think i got the error. the film back conversion isnt correct. blender uses metric mm, fusion uses imperial inches.

will try some other improvements before i share a new version
Offline

Ulrik Karlsson

  • Posts: 24
  • Joined: Mon Jan 12, 2015 6:53 am

Re: Import camera from Blender

PostWed Jan 14, 2015 6:26 am

michael vorberg wrote:can you send me an example blend file where this different focal length appears? then i can try to find the error.

Here is an example file. I don't know if you need it anymore but here it is anyway. If you adjust the focal length in Fusion to 35.4 you will see that everything lines up perfect.
Attachments
camera_export_test.zip
(258.72 KiB) Downloaded 325 times
Last edited by Ulrik Karlsson on Thu Jan 15, 2015 6:06 am, edited 1 time in total.
Offline

Kyriakos Rissakis

  • Posts: 61
  • Joined: Tue Dec 23, 2014 5:00 pm

Re: Import camera from Blender

PostWed Jan 14, 2015 8:37 am

You can choose imperial metric system for Blender camera.
I am afraid i am running the script all wrong. I thought it
would automatically export a .comp file. Keep in mind i
do not know the first thing about modern programing languages,
as you might have noticed i am only a hobbyist.
Offline
User avatar

michael vorberg

  • Posts: 943
  • Joined: Wed Nov 12, 2014 8:47 pm
  • Location: stuttgart, germany

Re: Import camera from Blender

PostWed Jan 14, 2015 11:48 am

Kyriakos Rissakis wrote:You can choose imperial metric system for Blender camera.
I am afraid i am running the script all wrong. I thought it
would automatically export a .comp file. Keep in mind i
do not know the first thing about modern programing languages,
as you might have noticed i am only a hobbyist.


in blender you have to import the script as an addon. go to user preferences->addon->import from file
then activate it. now you find a new entry under file->export

if you hit this export it will point you to the file saver dialog, where you choose under which name you want to save it and you can select the frame range you want to export.
Offline

Kyriakos Rissakis

  • Posts: 61
  • Joined: Tue Dec 23, 2014 5:00 pm

Re: Import camera from Blender

PostWed Jan 14, 2015 2:26 pm

Danke Michael, you always are the
most helpful compositor. I will check
this as soon as i get home.
Offline

Matthew Zinn

  • Posts: 20
  • Joined: Mon Jan 05, 2015 2:26 am

Re: Import camera from Blender

PostWed Jan 14, 2015 6:33 pm

michael vorberg wrote:You can choose imperial metric system for Blender camera


I don't think that necessarily true - regardless of what measuring system you use, the camera settings are still based on focal length, which in this case would be a 35mm lens.
Offline

Kyriakos Rissakis

  • Posts: 61
  • Joined: Tue Dec 23, 2014 5:00 pm

Re: Import camera from Blender

PostWed Jan 14, 2015 9:10 pm

Ok, it works from Blender 2.7.2, i checked it with an FBX mesh from blender
(6.1 with -Zforward) but i see a very small drift
from Blender render, i had to compare one frame from each
software to see this, it is so little that it maybe has to do with
unit conversion ,i cannot tell.
I start to think that the problem is at the .fbx export not Michael's script
because the fbx camera itself introduces transparent borders around the
footage unless i raise the Aperture height or width.
Offline
User avatar

michael vorberg

  • Posts: 943
  • Joined: Wed Nov 12, 2014 8:47 pm
  • Location: stuttgart, germany

Re: Import camera from Blender

PostFri Jan 16, 2015 12:06 am

i also exported an fbx form blender and i got some small differences between the fbx and my script (even with my new WIP version which fixes the unit conversion bug)

but i think there is a problem with the fbx, because the camera from my script matched the blender rendering
Offline
User avatar

Eric Westphal

  • Posts: 214
  • Joined: Thu Nov 20, 2014 1:59 pm

Re: Import camera from Blender

PostFri Jan 16, 2015 7:18 am

Hi Michael.

Can Blender also export .ma (Maya Ascii) files?
If you use that and import your camera explicitely from the .ma, does that fix the issue?

Cheers.

Eric.
my hovercraft is full of eels.
Offline
User avatar

michael vorberg

  • Posts: 943
  • Joined: Wed Nov 12, 2014 8:47 pm
  • Location: stuttgart, germany

Re: Import camera from Blender

PostSat Jan 17, 2015 4:08 pm

Eric Westphal wrote:Hi Michael.

Can Blender also export .ma (Maya Ascii) files?
If you use that and import your camera explicitely from the .ma, does that fix the issue?

Cheers.

Eric.


there was something wrong with the fbx (maybe i did forgot to change the fps at export or something)

did it again and it fits, only draw back: imported fbx animation always start at frame 0. dont know if its the export thats wrong or the import

so, my script is now here:
http://blenderartists.org/forum/showthr ... BMD-Fusion
(sorry, to crosspost to another forum but its more blender related then fusion)
Offline

Kyriakos Rissakis

  • Posts: 61
  • Joined: Tue Dec 23, 2014 5:00 pm

Re: Import camera from Blender

PostSat Jan 17, 2015 4:25 pm

I cannot find .ma export addon.
I see now that the .comp camera starts to move at frame 1
even when my clip and timeline in Blender (and fbx scene) were set to start
at frame 0.I moved the camera one frame to the left in
Fusion timeline and now it all matches perfectly( at least for
my specific simple shot).
Offline
User avatar

michael vorberg

  • Posts: 943
  • Joined: Wed Nov 12, 2014 8:47 pm
  • Location: stuttgart, germany

Re: Import camera from Blender

PostSat Jan 17, 2015 8:55 pm

okay, check i'll check that with the frame range
Offline
User avatar

michael vorberg

  • Posts: 943
  • Joined: Wed Nov 12, 2014 8:47 pm
  • Location: stuttgart, germany

Re: Import camera from Blender

PostSat Jan 17, 2015 9:05 pm

the script exports the frame range you specify in the export dialog and the comp it saves has that frame range as default in and out (also render in and out)

if have now an update version on the blender forum, that has onyl one little change:

you can now start your export from frame 0
Offline

Ulrik Karlsson

  • Posts: 24
  • Joined: Mon Jan 12, 2015 6:53 am

Re: Import camera from Blender

PostSun Jan 18, 2015 9:08 am

michael vorberg wrote:did it again and it fits, only draw back: imported fbx animation always start at frame 0. dont know if its the export thats wrong or the import


Can you import fbx animations? How?

Okej I found it now. File - Import - FBX Scene. But the animations doesn't match. Did anyone get the animations from imported fbx scene to match?
Offline
User avatar

michael vorberg

  • Posts: 943
  • Joined: Wed Nov 12, 2014 8:47 pm
  • Location: stuttgart, germany

Re: Import camera from Blender

PostSun Jan 18, 2015 4:20 pm

They did, for my tests, match very well. You have to check for the fps conversion on the import and if they key frames start at the correct time
Offline

Ulrik Karlsson

  • Posts: 24
  • Joined: Mon Jan 12, 2015 6:53 am

Re: Import camera from Blender

PostSun Jan 18, 2015 5:06 pm

Thanks Michael, that solved it. Okej but then I can import the cameras from fbx as well. I didn't know that.
Offline
User avatar

michael vorberg

  • Posts: 943
  • Joined: Wed Nov 12, 2014 8:47 pm
  • Location: stuttgart, germany

Re: Import camera from Blender

PostSat Jul 11, 2015 5:38 pm



i made some progress with my export script
Offline
User avatar

Tanawat Wattanachinda

  • Posts: 97
  • Joined: Sat Dec 20, 2014 3:47 pm
  • Location: Bangkok, Thailand

Re: Import camera from Blender

PostWed Jul 15, 2015 3:26 pm

while you are at it, May I request a 3D locator convert to Fusion screen space 2D tracker node in one export?
Offline
User avatar

Tanawat Wattanachinda

  • Posts: 97
  • Joined: Sat Dec 20, 2014 3:47 pm
  • Location: Bangkok, Thailand

Re: Import camera from Blender

PostWed Jul 15, 2015 3:27 pm

michael vorberg wrote:https://vimeo.com/133226455

i made some progress with my export script

I really appreciate it. Thank you
Offline
User avatar

michael vorberg

  • Posts: 943
  • Joined: Wed Nov 12, 2014 8:47 pm
  • Location: stuttgart, germany

Re: Import camera from Blender

PostWed Jul 15, 2015 8:10 pm

Tanawat Wattanachinda wrote:while you are at it, May I request a 3D locator convert to Fusion screen space 2D tracker node in one export?


well, i guess you could use the locator node in fusion for this right now, but i can give it a look for my ongoing development.

i'm trying to transfer plane tracks to fusions corner pin and how i can transfer the undistortion data
Offline
User avatar

Tanawat Wattanachinda

  • Posts: 97
  • Joined: Sat Dec 20, 2014 3:47 pm
  • Location: Bangkok, Thailand

Re: Import camera from Blender

PostThu Jul 16, 2015 6:14 pm

michael vorberg wrote:
Tanawat Wattanachinda wrote:while you are at it, May I request a 3D locator convert to Fusion screen space 2D tracker node in one export?


well, i guess you could use the locator node in fusion for this right now, but i can give it a look for my ongoing development.

i'm trying to transfer plane tracks to fusions corner pin and how i can transfer the undistortion data

That's wonderful of you.
Offline
User avatar

michael vorberg

  • Posts: 943
  • Joined: Wed Nov 12, 2014 8:47 pm
  • Location: stuttgart, germany

Re: Import camera from Blender

PostSun Jul 19, 2015 9:10 pm

right now i have done some more steps:
- the script right now creates a Loader with the footage from blender (i assume you have only 1 clip loaded)
- it sets the frame range and resolution of the fusion comp to the settings in Blender
- i try to force you to work in linear color space in fusion: i set the viewer LUT in Fusion to the view settings from Blender, i remove the gamma from the Loader clip via a Gamut node (assuming you loaded sRGB encoded files in Blender)
- it exports all or the selected cameras from blender
- it creates a PointCloud3D node in Fusion with points from all the trackers in Blender
- it creates a Tracker node in Fusion with all the 2D tracks from Blender
- it creates a LensDistortion node with the undistortion settings from Blender (this will not match pixel perfect but its quiet close)
Offline
User avatar

Tanawat Wattanachinda

  • Posts: 97
  • Joined: Sat Dec 20, 2014 3:47 pm
  • Location: Bangkok, Thailand

Re: Import camera from Blender

PostWed Jul 22, 2015 7:49 pm

SWEET
Offline
User avatar

michael vorberg

  • Posts: 943
  • Joined: Wed Nov 12, 2014 8:47 pm
  • Location: stuttgart, germany

Re: Import camera from Blender

PostMon Jul 27, 2015 10:57 pm



plane tracker is now transfered into fusion

i guess this means i'm feature complete and now its time for testing, bug hunting and make it user friendly
Offline
User avatar

Simon Dayan

  • Posts: 158
  • Joined: Tue Feb 04, 2014 10:39 am
  • Location: West Hollywood, Los Angeles,CA

Re: Import camera from Blender

PostSun Aug 02, 2015 10:28 am

thank you so much! that is a great feature blander and fusion should work together 8-)
Offline

Ulrik Karlsson

  • Posts: 24
  • Joined: Mon Jan 12, 2015 6:53 am

Re: Import camera from Blender

PostWed Aug 19, 2015 8:48 am

Thanks Michael, I really appreciate you script!

I just wonder if you could include the plane of focus distance for the camera export. Then I could use Blender to animate focus distance which gives me much better playback speed!
Offline

Justin Courneya

  • Posts: 14
  • Joined: Thu Aug 20, 2015 3:10 pm

Re: Import camera from Blender

PostThu Aug 20, 2015 3:19 pm

I have been using Blender for about a year now , and just started using Fusion. This addon would be amazing . Where is the latest build available for download?
Offline

Justin Courneya

  • Posts: 14
  • Joined: Thu Aug 20, 2015 3:10 pm

Re: Import camera from Blender

PostWed Aug 26, 2015 3:14 pm

No need to reply to my last comment , i got the answer from Vorberg s vimeo post .
Offline
User avatar

michael vorberg

  • Posts: 943
  • Joined: Wed Nov 12, 2014 8:47 pm
  • Location: stuttgart, germany

Re: Import camera from Blender

PostSun Aug 30, 2015 3:15 pm

Offline

Ulrik Karlsson

  • Posts: 24
  • Joined: Mon Jan 12, 2015 6:53 am

Re: Import camera from Blender

PostMon Aug 31, 2015 6:01 am

Really good work Michael! Thank you!
Offline
User avatar

Eugene Afanasiev

  • Posts: 600
  • Joined: Sun Aug 30, 2015 2:57 pm
  • Location: Russia

Re: Import camera from Blender

PostSat Jul 30, 2016 11:38 pm

Thank you Michael!
__
--[[BMD's cameras and Resolve all-post workflow evangelist
My old stuff: http://www.youtube.com/rebelorelse
Debug: Asus ROG Duo GX550 i9 10980 48Gb RAM RTX2080MaxQ DaVinci Resolve Studio / Fusion Studio Latest Version]]--
Offline
User avatar

michael vorberg

  • Posts: 943
  • Joined: Wed Nov 12, 2014 8:47 pm
  • Location: stuttgart, germany

Re: Import camera from Blender

PostWed Mar 29, 2017 9:26 pm

after a long time a new version of the script is availible:

*NEW* plane track comes now also as Tracker node with the position of the plane corners as tracks *NEW*

download

Return to Fusion

Who is online

Users browsing this forum: No registered users and 10 guests