Anim8or Community

General Category => General Anim8or Forum => Topic started by: Nellucnaiv on June 23, 2022, 06:33:32 am

Title: Mixing Morph Targets in Scene and saving in Object mode?
Post by: Nellucnaiv on June 23, 2022, 06:33:32 am
Hi all,
I have often used 0.5 value of one Morph Target and 0.5 of another combined in Scene Mode...or even 0.1 to 0.9 value. The resulting combined Morph Targets are often just the shape I am looking for.
Is there a way to save this as an added Morph Target in Object mode?
The way I understand it is that a mesh is a lot of points that run in the background in a scripted fashion and each Morph Target is a change of coordinates and stored.
I was wondering if there was a way to perhaps export the Object in Scene Mode, pick up it's coordinates and somehow enter them in a script fashion as a "Morph Target New", or is there a way of finding the background script for Morph Targets in the background of Anim8or?
I'm sure many people using Anim8or would love to be able to do this.
I thank you for any responses in advance 🙏👍
Title: Re: Mixing Morph Targets in Scene and saving in Object mode?
Post by: Kevin Gales on June 23, 2022, 07:22:36 am
I once attempted to solve the problem I have to say I don't think there is a way to do it directly in anim8or.However there are two solutions that might require some coding and serious math.
1.A.This one is easy...I have already posted a simple tool somewhere in this forum that can convert sequence of objects back into anim8or morph targets.I could enhance the code ONLY IF Anim8or could export objects in scene mode *I made a request for this once,to export scene as .obj

(B.Longer solution is also possible,however would require tempering with anim8or such as by hooking the software with a dll and extracting the scene objects.I can achieve this, just that it would require time to code and permission from Steve[anim8or creator] ,since I am not sure hooking the software with an external dll counts as license infringement or something of that sort)

2.Another option is to recalculate morph targets from the scene and use the resultants to inject back as morph targets this can be done directly by editing the an8 file with some code that does the math.* provided the object is not rigged(it is not a figure)

If anyone is interested in how option 2 or option 1B can be implemented let me know let's discuss this
Title: Re: Mixing Morph Targets in Scene and saving in Object mode?
Post by: Nellucnaiv on June 23, 2022, 02:26:25 pm
Thanks so much for your interest and answer Steve!
I really appreciate it. I fancy your 1B option of being able to export as OBJ in Scene mode but as you say the features is not yet available. I think Steve is a very busy man and totally unselfish, still regularly responding to requests and questions and freely giving up his time to do so much at no cost to anyone. I truly admire him!
I like your Option 2, to open the script of the Anim8or Scene and find the mixed Morph Targets and calculate new coordinates and "inject" them in OBJ mode in the script to create a new Morph Target.
I think it could be quite a calculation but perhaps an Excel Spreadsheet could be made to auto calculate combined coordinates from inputs without having to calculate manually. It would then mean taking the Excel outputs, copying them and pasting them as a New Morph Target into the Object part of the script.
What do you think of the idea? Do you think it could work?
I'm not a Script writer but I can go by example in Notepad and do a test.
Perhaps you have a better way or idea.
I'd love to hear what you think 👍
Thanks again.
Title: Re: Mixing Morph Targets in Scene and saving in Object mode?
Post by: Kevin Gales on June 23, 2022, 02:37:49 pm
I did some analysis I think I can come up with something based on option 2.However as I said it would be difficult if the target is a figure since well the math used by Anim8or to move coordinates with bones is something I cannot figure out...I'll quickly code something to make a demonstration using a simple cube (which is not a figure but object with morph targets).
Title: Re: Mixing Morph Targets in Scene and saving in Object mode?
Post by: Nellucnaiv on June 23, 2022, 08:31:49 pm
That would be great if you could write a code for morphing. I use weights in Figure mode, so all attached objects already have Morph Targets.
I personally, would only use it in Object mode.
I look forward to seeing what you come up with!
Title: Re: Mixing Morph Targets in Scene and saving in Object mode?
Post by: Kevin Gales on June 24, 2022, 07:58:03 am
I am always busy but I managed to cook up something in a few minutes.
I have quickly compiled it into my previous software I posted
Here (https://www.anim8or.com/smf/index.php/topic,6000.0.html)

So to test this you just have to create a simple mesh,maybe a cube or sphere
>Then create two morph targets
>Then blend those in scene mode
>Save the file and follow the guide in the software
Title: Re: Mixing Morph Targets in Scene and saving in Object mode?
Post by: Nellucnaiv on June 24, 2022, 08:24:05 am
Thanks so much Kevin!
I tried to follow the "Here" link but it says it contains an error. Really excited to see what you've done!
I think the comma in the URL is causing the problem.
Would you mind checking it please? Thanks!👍
Title: Re: Mixing Morph Targets in Scene and saving in Object mode?
Post by: captaindrewi on June 24, 2022, 08:33:54 am
https://www.anim8or.com/smf/index.php/topic,6000.0.html
forgive me for intervening but i think this link is good for Kevins 'nifty tool'
Title: Re: Mixing Morph Targets in Scene and saving in Object mode?
Post by: Kevin Gales on June 24, 2022, 10:33:52 am
Thanks so much Kevin!
I tried to follow the "Here" link but it says it contains an error. Really excited to see what you've done!
I think the comma in the URL is causing the problem.
Would you mind checking it please? Thanks!👍

Sorry...The problem was duplicate http:// I fixed it...
Title: Re: Mixing Morph Targets in Scene and saving in Object mode?
Post by: Kevin Gales on June 24, 2022, 10:35:04 am
https://www.anim8or.com/smf/index.php/topic,6000.0.html
forgive me for intervening but i think this link is good for Kevins 'nifty tool'

No worries after all...the forum is for everyone we are here to help each other...
Title: Re: Mixing Morph Targets in Scene and saving in Object mode?
Post by: Nellucnaiv on June 24, 2022, 12:06:47 pm
Thanks Kevin and Captain Drew.
I appreciate it that we're all here to help wherever we can.
It makes Anim8or a great forum to be on.
I've downloaded your NiftyTool Kevin.
Looking forward to trying it out! 🙏👍
Title: Re: Mixing Morph Targets in Scene and saving in Object mode?
Post by: Nellucnaiv on June 25, 2022, 02:08:09 pm
Hi Kevin,
Thanks so much for the link for NiftyToolbox.
I tested your experimental "Converting Frame Morph targets in Scene Mode to Morph Targets in Object Mode"
I followed your instructions and made a simple cube Object with 8 points, made 2 morph targets, put the object into a 50 frame Scene, activated 1,0 and 0 and 0 and 1,0 at the beginning and end of 50 frames, chose frame 20 and saved the file with the name you gave.
I inserted it into NiftyTool Object Morph Target creator and it said "successful" and then Processing 2/2 displayed.

I did as you said and waited for the new file to appear in NiftyToolbox but 5 hours later it still wasn't there.
I know you don't have much time and I appreciate your efforts! I just wanted to bring it to your attention.

Hopefully it's something simple in your script?

Thanks again 👍
Title: Re: Mixing Morph Targets in Scene and saving in Object mode?
Post by: Kevin Gales on June 25, 2022, 05:04:58 pm
I forgot to mention you'll have to set the key you want first...like in your example click on frame 20 and add key do the same for the other morph...
Also NiftyTool must be in the folder C:\NiftyTool ..The file will be saved in the folder
Title: Re: Mixing Morph Targets in Scene and saving in Object mode?
Post by: Nellucnaiv on June 26, 2022, 12:30:51 pm
Thanks for the update. I do have NiftyTool in C:/
I did add a key for Morph 01 and Morph 02 in Frame 20 but it still doesn't produce the Anim8or new morph file
How long should it take roughly for the cube I made?
I kept the Morphs simple.
Title: Re: Mixing Morph Targets in Scene and saving in Object mode?
Post by: Kevin Gales on June 26, 2022, 01:24:24 pm
Did you check in C:/NiftyTool for the file called morph_ersect ? also could you send me your test file and I'll test it myself
Title: Re: Mixing Morph Targets in Scene and saving in Object mode?
Post by: Nellucnaiv on June 26, 2022, 01:32:30 pm
I beg your pardon, I didn't have key frames on Frame 20.
It took 1/2 second to process!
I then tried a head with 6500 points and 3 morph targets and keyed it at frame 10, mixing all 3 morph targets.
It processed in 1 second! Amazing!
Well done!!! Great tool!
Thanks so much!
The script is showing an error in reading.
I noticed that many of the figures are in the format of for example: 2.68E5 etc instead of 2.6800000.
Easy to rectify in Excel.
Thanks so much Kevin. This is invaluable!! 👏👏👏👏👍
Title: Re: Mixing Morph Targets in Scene and saving in Object mode?
Post by: Nellucnaiv on June 26, 2022, 01:42:42 pm
I beg your pardon, I didn't have the Morphs keyed.
It processed in 1/2 second! Amazing!
I then tried a head model with 3 morph targets and 6400 points, keyed all 3 on frame 10 and it processed it in 1 second!! Astounding!!! Well done👏👏👏👏👍
It showed an error loading the ersect file but I opened it in notepad and quite a few numbers are in for example: 2.54E5 format instead of 2.4500000.
Easily remedied by pasting into Excel and copying and pasting back into the script.
Thanks so much Kevin! This is going to be invaluable!! 🙂
Title: Re: Mixing Morph Targets in Scene and saving in Object mode?
Post by: Nellucnaiv on June 26, 2022, 01:48:08 pm
I beg your pardon, I didn't have the Morphs keyed.
It processed in 1/2 second! Amazing!
I then tried a head model with 3 morph targets and 6400 points, keyed all 3 on frame 10 and it processed it in 1 second!! Astounding!!! Well done👏👏👏👏👍
It showed an error loading the ersect file but I opened it in notepad and quite a few numbers are in for example: 2.54E5 format instead of 2.4500000.
Easily remedied by pasting into Excel and copying and pasting back into the script.
Thanks so much Kevin! This is going to be invaluable!! 🙂
Title: Re: Mixing Morph Targets in Scene and saving in Object mode?
Post by: Kevin Gales on June 26, 2022, 04:15:33 pm
Glad to know it worked for you... 8) I'll update to correct those scientific notation..
Title: Re: Mixing Morph Targets in Scene and saving in Object mode?
Post by: Nellucnaiv on June 26, 2022, 11:54:36 pm
Sorry to be a pain but I see that a lot of the opening and closing () are missing next to coordinates too.
I'm sure you'd like change that when you have the time.
It's still amazing how it calculates the coords so fast!
Title: Re: Mixing Morph Targets in Scene and saving in Object mode?
Post by: Kevin Gales on June 28, 2022, 10:11:10 am
Try the update now...I have added the ability to select the specific object you're targeting , I fixed the brackets and the scientific notation...
Title: Re: Mixing Morph Targets in Scene and saving in Object mode?
Post by: Nellucnaiv on July 03, 2022, 12:03:14 pm
Hi there,
My apologies for taking so long to respond.
Thanks for taking the time to correct the errors I found.
The Anim8or ersect file opens normally and all the morph targets are there, including the newly created one.
The only thing is it doesn't work. When you click on it, it stays in the "none" rest position, even though it shows the name of the new morph.
Could I send you my Anim8or ersect file?
Title: Re: Mixing Morph Targets in Scene and saving in Object mode?
Post by: Kevin Gales on July 04, 2022, 07:56:16 am
Remember the new version targets the specific object you select on the drop down so the morph targets will also follow the object...if you select vice versa weird things will happen...Anyway send I'll check what's wrong with your file.
Title: Re: Mixing Morph Targets in Scene and saving in Object mode?
Post by: Nellucnaiv on July 04, 2022, 02:08:04 pm
Thanks for taking the time to respond!
And thanks for the updated info.
I'll get my file and attach it for you tomorrow. Thanks for your willingness to take a look at it. I appreciate it!
Title: Re: Mixing Morph Targets in Scene and saving in Object mode?
Post by: Kevin Gales on July 04, 2022, 02:26:05 pm
I have a feeling you did not set the keys on those specific frames...I did not set the error checking to check if you the keys exists on such frames or not.
Title: Re: Mixing Morph Targets in Scene and saving in Object mode?
Post by: Nellucnaiv on July 05, 2022, 10:27:04 am
Hi Kevin,
I have attached 2 morph attempts in a zip folder.
The first noted that it was successful and output an ersect file but the second with all frames checked the same and the object named "Lady", there was no output.
Thanks for taking the time to check my morph_int.an8 files and the one output ersect file. I appreciate your time!
Title: Re: Mixing Morph Targets in Scene and saving in Object mode?
Post by: Kevin Gales on July 05, 2022, 07:22:43 pm
It turns out the problem was the structure,I followed a schema of recent versions I neglected it will be dynamic...anyway you're using an older version of anim8or so the whole structure broke...So I fixed all the problems..basically buffering the whole file, structuring it according to my own parser, then performing calculations point to point..Still does within a the blink of an eye.You can download the update.
Also update your Anim8or version..Anim8or has improved a lot since that version.  8)
Title: Re: Mixing Morph Targets in Scene and saving in Object mode?
Post by: Nellucnaiv on July 05, 2022, 09:44:45 pm
Thanks so much Kevin! You're an absolute genius!
I don't take anything for granted so I am humbled.
I have tried some of the newer versions of Anim8or but stil like 0.98 for its simple interface.
I'll definitely download the update!
Thanks again!
Title: Re: Mixing Morph Targets in Scene and saving in Object mode?
Post by: Nellucnaiv on July 06, 2022, 12:44:00 pm
Just to update you Kevin, you're a Master!
As you said, your "NiftyTool" puts the new morph target out in a split second. You created an awesome tool!
Great job! It works beautifully and no glitches.
You've made me very happy.
Thanks for all your efforts! 🙏👍
Title: Re: Mixing Morph Targets in Scene and saving in Object mode?
Post by: Kevin Gales on July 07, 2022, 04:23:56 am
You're welcome  8)