Genete! Springy bones 3D rotation with one bone.

Have you come up with a good Moho trick? Need help solving an animation problem? Come on in.

Moderators: Víctor Paredes, Belgarath, slowtiger

Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post by Genete »

I've just plugged it to Elsa the giraffe:

http://www.darthfurby.com/genete/Other/ ... rafa14.swf

you can see that when the shape is so big the ordering is not accurate. It means that is needed more subdivision and more points... :( Or a less complex character... :)

I don't know why but it fails some times with the Z of the bones. It complains about the bone have not Z value. I think I have to rewrite it to store the Z values in the TboneSets matrix. The problem comes with the Z of the shapes. If it fails in the future it could be a problem.

Anyway the method works. :)

-G
human
Posts: 688
Joined: Tue Jan 02, 2007 7:53 pm

Post by human »

Hmmm.

Maybe that giraffe head turn wasn't perfect, but if you're willing to do a little manual cleanup of each bitmap frame that comes out of the video, it suggests an enormous potential.
User avatar
dlangdev
Posts: 144
Joined: Wed Jun 13, 2007 10:43 pm
Location: USA
Contact:

Post by dlangdev »

i watched the video.

somehow there is a z-order bug in there, the jaw gets rendered when the upper part is facing the camera. it might not be a bug at al since the shape is not a flat shape.

it would be nice to have that feature, though. some sort pixel test to figure where that pixel belong to, the jaw or cheek.
User avatar
heyvern
Posts: 7042
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

The shape at bottom of the giraffe is quite large and you notice that it "overlaps" causing those "holes".

Generally I would make a shape like that in two or more parts.

I don't know what's happening up there on the eye brows. The blue bits that seem to flash on and off.

With the z ordering problem... could it be that the script is working "too fast" or "too slow"?

I have had problems in the past trying to access data that hadn't finished being "created" yet. I would get crazy lua errors until I discovered I was trying to use a value in a part of the script that hadn't been initialized or something like that.

As to that other problem I mentioned Genete, all I did was to store the z value with the first script, run the second to see the list. Then I clicked on the bone layer and rotated the bones. Then I clicked back on the vector layer and ran the second script again. I got nil on the z items for the bones.

I will play around with this and see what crazy things I can make it do! You have really out done yourself.

Remember when I was not totally enthusiastic about this "perfect 3D" approach? hee hee... you got me hooked now. Amazing stuff.

I have to admit I am as excited about autorigging and autoshape ordering as the 3D aspect.

Another interesting thing. There are those who might think this is a bit "crazy" for a "2D" application. But over and over on this forum comparisons are made to other applications that have this type of "3D" solution "built in". Even AS itself has the ability to import actual 3D files. People have often asked for enhancements to 3D support in AS.

I don't see this type of thing as any different than any type of "3D" support in a 2D application. Actually what you are doing Genete is BETTER in my humble opinion than the 3D layer feature in AS. That's just my opinion of course. I never really even tried using the 3D layer stuff in AS... I don't have any apps to produce the files and I don't want to learn anything new at this point.

-vern
User avatar
heyvern
Posts: 7042
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

Genete,

In the "sort_shapes9.lua" script there is this function:

Code: Select all

function AddZToShape(shp, point, edmax, moho)
	local ptbone = moho:ParentSkeleton():Bone(point.fParent) -- localize the bone parent of the point
		if(ptbone.fPos.z == nil) then 
		      print ("Z = nill for pt parent bone")
		return
	end
	shp.Z = shp.Z + ptbone.fPos.z/edmax/2 --stores the z value divided by edmax and by two because it is called two times.
end
So obviously when you first open a file or add the scripts to a new file you get 50 bazillioin lua mesages printed... because at that point those values of course are nil. they haven't been initialize until AFTER that if statement. This would ALWAYS print out on the first run of the script. Is this the error you were talking about?

I just commented out the print ("Z = nill for pt parent bone") line and it works great.

-vern
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post by Genete »

@human, diangdev and heyvern:
The giraffe head turn is not perfect because it is not prepared for it. The shapes are correctly sort mathematically speaking. The problem is that the jaw is also the same shape than the neck bottom front part. Its average Z is near to your eyes than the chicks shapes. The chick shapes are so large in Z direction so they can do strange things (for example hide the eyebrows and show the jaw). The chick is "over" the eyebrow (speaking in terms of Z) and at the same time "below" the jaw. In fact that shape was designed to be below the eyebrow and over the jaw shape, but this is not possible every time if it is sooo large. It would work if the giraffe were designed to do it. As Vern said it would be better to divide the shape into two or more shapes.

@human: It is not in my plan to correct the video frame by frame. Really it could be properly achieved with this tool and no need of bitmap touching. Thanks for believe in this technique. :)

@heyvern: Yes you're right about that line code, please erase it. It was only a check out to be sure there is no lateral problems.
heyvern wrote:Remember when I was not totally enthusiastic about this "perfect 3D" approach? hee hee... you got me hooked now. Amazing stuff.
Thanks Vern, I'm also surprised about the potential of this stuff and hooked to it!.
I have to admit I am as excited about autorigging and autoshape ordering as the 3D aspect.

Another interesting thing. There are those who might think this is a bit "crazy" for a "2D" application. But over and over on this forum comparisons are made to other applications that have this type of "3D" solution "built in". Even AS itself has the ability to import actual 3D files. People have often asked for enhancements to 3D support in AS.

I don't see this type of thing as any different than any type of "3D" support in a 2D application. Actually what you are doing Genete is BETTER in my humble opinion than the 3D layer feature in AS. That's just my opinion of course. I never really even tried using the 3D layer stuff in AS... I don't have any apps to produce the files and I don't want to learn anything new at this point.
This stuff permit to the user put 2D models inside virtual 3D models. A 3D object (obj) with holes don't let you put a simple 2D shape inside. Sometime ago I tried to put a character inside a telephone cabinet. It was done using wings (a3D object) and I could not put the character inside. I needed to put the character inside a group of rotated vector layers. But it was very limited with the shape artwork (they were flat). Now I can do better things.

Thank you all for support me during the development. I want to come back to pure animation and stop scripting development for a while. It is VERY hooking and don't want me to be converted into a new Rasheed or Ramon López (*)... But hey! I don't forget that I know lua now!!

I only want to refine those scripts (3d rig automatic, 3Dgrid, and shape ordering scripts) to make them faster and strong coded (no holes). Then create some fun tutorials and dedicate to do my own animation projects...

Cheers! :D
-G

(*) With the most respect to both persons for their contribution to this forum and thier high level brains.. :oops:
Last edited by Genete on Mon Jun 18, 2007 7:20 am, edited 1 time in total.
User avatar
heyvern
Posts: 7042
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

Genete,

As I am very lazy ;) I have made a very tiny addition to the last version of the bone layer script:

http://www.lowrestv.com/moho_stuff/3Dgrid8_1.lua
http://www.lowrestv.com/moho_stuff/star.moho

Save both files into the same folder that Genete's last zip download created. Open the "star.moho" to see how it's set up.

I have commented out the parts I added. Very simple and can easily be added into anything new you are working on.

It basically adds the option for a master bone to translate that controls BOTH masterX and masterY rotation.

Instructions:

Create a bone named MasterTR and set its position to be exactly at zero on both x and y, then create another bone named anything you want and place it anywhere on the layer that is convenient.

Set the "MasterTR" Position Constrain target to this second bone
and set the scale amount for the constraint to anything that "works" for you.

By using a constraint on a second bone you can increase or decrease the scale of the constraint required to rotate the masterX and masterY bones. This way depending on the model you wouldn't need to translate the controlling bone way off the screen to get a full translation. Or you could decrease the scale to have finer control.

-vern
User avatar
heyvern
Posts: 7042
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

I am sorry but I have to keep saying this....

This thing is MIND BLOWING!!!!

I hope someone besides me realizes how freaking awesome this is!!!!!!

This takes AS to a whole new level. It is just... I mean... holy freaking cow!!

I am spinning my pretty star and all the shapes are reordering on the fly!!!!! I'm flipping out!

<gasp>

I almost passed out.

;)

-vern
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post by Genete »

Vern, thanks for your addition. PLEASE! add what ever you need or ask me to add what ever you consider it should do and you don't know how to do it.
I'm considering making some changes to the automatic 3D rig script. For example I don't want to have the helper bones (Rx and Ry bones) over the front or side models. In fact their position is not important. Only thier lenght and angles. So I'm considering to put them automatically linked to a root helper bone that can be moved later to any place and make a cleaner front model. Even thier strength should be put to 0. Also the creation of a limb 3D rig can be also automated without the need to create the side central bone and the need to unlink the central bone from its parent and rerelink it later to its ooriginal parent. It can be done automatically.
What I don't want to automatize is the creation of the masterX, masterY and the corresponding .mX and mY bones for the limbs. It should be responsability of the designer.
heyvern wrote:I am sorry but I have to keep saying this....

This thing is MIND BLOWING!!!!

I hope someone besides me realizes how freaking awesome this is!!!!!!

This takes AS to a whole new level. It is just... I mean... holy freaking cow!!

I am spinning my pretty star and all the shapes are reordering on the fly!!!!! I'm flipping out!

<gasp>

I almost passed out.

Thanks for increase my english vocabulary... passed out = faint (in this context) = pass out from weakness, physical or emotional distress due to a loss of blood supply to the brain :D

I want believe that not only you or me are the one who realize how far away can those scripts push Anime Studio beyond their competitors. We have opened a door to a new universe... :shock: :shock: :shock:

And remember! this is only a tool!. It will not deprecate AS 2D capabilities or make their essential improvements in that area not needed in future versions!. (I say this for the those who still believeing that this 3D stuff stinks. :wink:)

My most sincere thanks to you Vern. You are the one who made me make this stuff so you are the father of the creature. Almost you put the first seed what is the fantastic 3Dgrid script...

-G
wmwilson
Posts: 1
Joined: Mon Jun 18, 2007 6:24 am
Location: USA
Contact:

You said it Vern, thanks Genite.

Post by wmwilson »

I just wanted to put in my two cents and say thanks to both of you for the awesome work you are doing. There a lot of people (like myself) that are going to benefit from your work. Thanks!
William
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Re: You said it Vern, thanks Genite.

Post by Genete »

wmwilson wrote:I just wanted to put in my two cents and say thanks to both of you for the awesome work you are doing. There a lot of people (like myself) that are going to benefit from your work. Thanks!
William
You're welcome!
It would be glad if you post some of your animations in the forum and tell us if you have used those crazy scripts.
Cheers!
Genete
User avatar
dlangdev
Posts: 144
Joined: Wed Jun 13, 2007 10:43 pm
Location: USA
Contact:

Post by dlangdev »

whatever it is, it sure is....

A W E S O M E
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post by Genete »

dlangdev wrote:whatever it is, it sure is....

A W E S O M E
Thanks dlangdev! You're welcome!.


----------------------

Vern,
regarding to the 3Dgrid embeded script I have a dude. It creates a TboneSets matrix to store all the related information to the bones. If that matrix of information is created everytime the embedded script is called, is it destroyed after the script has finished? I ask it because still wondering if it would work with two bone layers with embedded scripts at the same time...
I have a lack of knoledge of where lua stores that matrix and its visibility.

If it have not interference between different scripts working in different bone layers then is a good new. But I want to avoid to create that matrix EVERYTIME the embedded script is called! If you create once it would be valid during all the animation and only need to be created again when you modify the model. That's what I did when I splitted the 3Dgrid into 3Dgrid_menu and 3Dgrid_embed... Now the question is: Where can I store the TboneSets matrix of the 3Dgrid_menu version to avoid interference between same script running at different layers?

I also want that the TboneSets to be apart because I can create it DURING the execution of the automatic 3D rig script. It would also save more time for the user: Draw -> Rig -> Animate.

Other thing I want to comment to you is the ability to make limbs with the last modification I have done to 3Dgrid (since version 7). It is a very poweful feature!!! And I think nobody have realized about it yet!!!. I'm triying to automatize the automatic 3D rig of limbs. As well as the automatic rig needs that the central rotation bone were a root bone, by now, it is needed that the user (manually) unlink a pt bone making it root, rig the limb (after create its clone center bone at the side view) and relink the original center pt bone to its original parent to link the limb to the rest of the rig. I want to do it automatically. I having a lot of problems to un-link and re-link a bone. I have to read the code from the Reparent bone tool from Fazek or LM to understand how they do it... Again there appears matrixes.... :shock:

I'll maintain you informed when solve this issue.
Meanwhile,
Best
Genete
User avatar
heyvern
Posts: 7042
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

About the script being used with multiple bone layers...

The embedded script is actually called and the TboneSets is created over and over again on each frame for each layer. Look at the script for the bones and you see that the table is "rebuilt" new again on every frame >0. The way we have it set up it only refers to the one bone layer based on the bone names IN THAT LAYER.

This could be a performance issue. We could initialize the TboneSets table only on frame 0 then refer to it on frames >0.

I have had BIG problems doing this though. If you scrub too fast through the time line or for any reason there is a "problem" with TboneSets on later frames it can get "erased" and you have to go back to frame 0 to reset or reinitialize the TboneSets matrix.

I would say DO NOT try to split the script up. There is no reason I can see right now to do this.

I tried to do that with my "bone master/slave" scripts, they broke down CONSTANTLY when I scrubbed through the time line to quickly. Initializing the table on frame 0 is a great idea, but that table has to be kept in memory all the time. If it gets "erased" then you have to go back to frame 0 and this is VERY ANNOYING.

Multiple Copies of Scripts:

It works GREAT!!!

I have imported about 4 different sample files into one project each with a "copy" of both scripts and they all work perfectly together in one file.

I even put two bone layers with the scripts INSIDE another bone layer with the scripts and ANOTHER vector layer and it STILL WORKS!!! It works FLAWLESSLY and FAST!

I keep telling you this thing is nearly perfect. It is brilliant and works like a charm.

I have tried and I just can't make it break... yet. ;)

-vern
User avatar
dreeko13
Posts: 187
Joined: Fri Oct 13, 2006 8:29 am
Contact:

Post by dreeko13 »

would love to see a tutorial for a sample head turn with lipsync using this method

how about it heyvern?
Post Reply