fedeberge - Moho Camera to Blender

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
fedeberge
Posts: 2
Joined: Thu Apr 07, 2022 1:57 am

fedeberge - Moho Camera to Blender

Post by fedeberge »

Hi guys, first post I believe.

I made a script that let's you export the camera from Moho to Blender.

Running the script will prompt a window to choose a folder.
Then it saves the animation data in a json that's compatible with this Blender Addon by adroitwhiz
https://github.com/adroitwhiz/after-eff ... der-export

I don't know how to code in Lua and I suck at reading documentation so I wrote this script while looking very closely at:
ponysmasher's DS Camera to AE
https://lostmarble.com/forum/viewtopic.php?f=12&t=18091
and
SimplSam's AE Camera Export+
viewtopic.php?t=34765
As well as some other sources online to figure out what even are affine matrices and how do they work.

I based the logic on ponysmasher's script (saving to a file, baking every keyframe) because it fits my workflow better
Also, since the interpolation is lost, baking every keyframe makes the animation more accurate
But I found Sam's zoom factor to be more precise, so I copied (sorry I couldn't figure out the math)

How to install?

-- Download the .lua file and copy it into
%your custom content folder&\Moho Pro\Scripts\Menu\3D
(It works as a tool but I haven't made a icon yet)

-- reload scripts (Ctrl Shift Alt L) or restart Moho

How to use?

In Moho:
-- Once you finish animating in Moho, run the script
-- Choose where to save (don't write a name, the script will save a json with the same name as your moho file)

In Blender:
-- Install adroitwhiz's addon
-- Run it from File > Import > After Effects composition data, converted (.json)
-- Chose your json
-- IMPORTANT! Set the options to the right:
------Scale Factor 1
------Adjust Frame Start/End

That's it. Now you can render whatever you want and then just overlay Moho's characters over Blender's backgrounds

Future updates:
--I want to rewrite the Blender Import addon to work out of the box
--I'd like to also be able to export Moho's layers's positions in 3D space
--Figure a way of making it work two-way at first and then between Moho Blender and AE with just one json (and maybe TB Harmony)

Really special thanks to:
SimplSam
David Sandberg (ponysmasher)

Links:
My script @github
https://github.com/fedeberge/fb_camerat ... es/tag/0.1

adroitwhiz's blender addon
https://github.com/adroitwhiz/after-eff ... der-export

And lastly my ko-fi just in case any one of the 5 people that use Moho and Blender wants to donate.
https://ko-fi.com/fedeberge
User avatar
Greenlaw
Posts: 9269
Joined: Mon Jun 19, 2006 5:45 pm
Location: Los Angeles
Contact:

Re: fedeberge - Moho Camera to Blender

Post by Greenlaw »

Wow! Thanks for creating and sharing this, fedeberg!

I'm using Blender more than ever these days, and I'm sure this script and the tips will come in handy for me. :D
fedeberge
Posts: 2
Joined: Thu Apr 07, 2022 1:57 am

Re: fedeberge - Moho Camera to Blender

Post by fedeberge »

Greenlaw wrote: Thu Dec 28, 2023 4:09 pm Wow! Thanks for creating and sharing this, fedeberg!

I'm using Blender more than ever these days, and I'm sure this script and the tips will come in handy for me. :D
No problem, hope you find this useful!
I've used the same technique (before the script, by exporting with SS's script to AE and then to blender) and the results were really cool
Post Reply