Auto Scripted 3D rig. Files and Video Tutorial

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

Moderators: Víctor Paredes, Belgarath, slowtiger

User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

Holy cow!

I think I'm onto something...

It didn't work using LM_Vector3. It has to be a matrix to apply the perspective transformation.

I finally figured out how to create a matrix:
local mat3 = LM.Matrix:new_local()

I'm jumping in now... I may get lost. Send in rescue if I'm not back in a few days. ;)

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

Post by Genete »

http://www.darthfurby.com/genete/Script ... ctive.anme (sample file)
http://www.darthfurby.com/genete/Scripting/ge_persp.lua (menu script)


Try this file with 3Dgrid8 embedded in the sample file bone layer.

It does strange things to the points.. I don't filled the perspective matrix with good values. Hope you find something useful with this small script. As far as thery are four values the combination of them makes sometimes a nil number.
Also I'm not sure if really x and y are the projected ones.

I haven't found any script where it is used. The orbit workspace tool uses a built in mouse function. Have you find it?

If you don't mind I'll let you alone with this adventure... I want to finish the other scripts and make the next video tut. :wink:

Good luck
-G
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

If you don't mind I'll let you alone with this adventure...
No problem.

The one thing I found with your perspective menu script is that a bone can't have an fPos.z value. A bone can only move in the x and y. I suppose you want the "custom" z value instead from the other script.

I will play with this one on my own.

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

Post by Genete »

heyvern wrote:
If you don't mind I'll let you alone with this adventure...
No problem.

The one thing I found with your perspective menu script is that a bone can't have an fPos.z value. A bone can only move in the x and y. I suppose you want the "custom" z value instead from the other script.

I will play with this one on my own.

-vern
That's right. It only makes sense if we are talking about 3D vectors. And they for the moment we have them only at the custom bones (or their corresponding points).
...
Well completely alone not.. :wink: I always will be watching your progresses ...
-G
Genete
Posts: 3483
Joined: Tue Oct 17, 2006 3:27 pm
Location: España / Spain

Post by Genete »

I have a clue! :D
I think that the point of view (the conic projection point of view) is placed at (0,0,0) That's the reason for the non sense of the values on the perspective matrix. If the point of view is over the center of rotation of the model it deforms strangely.
Try to create a translation matrix (far Z) and multiply (perspective) x (translation) before apply to the 3D point.
Let me know what happen.
-G
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

I have actually found some more useful code by looking for ActionScript (Flash) and JavaScript references.

These use the same type of matrix transformations to create "perspective" almost in the same way we need to.

I just need to figure out how to convert it to lua and use it with the all the bone data we already have.

The actionscript and javascript references build their matrices "from scratch" which we don't have to do in lua with AS. Creating a new matrix is built in.

I will keep you informed. I have absolutely nothing working yet. I am studying 3D math and learning TONS! This is fun. ;)

Once again my knowledge of programming has jumped up another notch. I FINALLY understand how matrices work! They are very cool.

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

Post by Genete »

ADDED NEW VERSION!
READ THE FIRST POST!

-G
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

Coooollll!


Hey Genete... guess what?


I FREAKING DID IT!!!!!! YEEEEEHHHAAAAAAAAAA!!!! AAAHHHHHHHGGGGG! :D :D :D :D :D :D


Image

http://www.lowrestv.com/moho_stuff/3D-cube.mov

http://www.lowrestv.com/moho_stuff/3D-cube.zip

Don't get this mixed up with your new stuff. I am still using an old version of the script.

There is a new bone at the top of the screen for field of view called fov. Scale this bone to change the field of view.

There are some issues to deal with:
Shape ordering is a bit strange. I think the shapes are reordering too soon or something. I will fiddle with that.

Also rotating the points parent bone doesn't effect the perspective. This should be fixable.

I also need to adjust "scale" when the field of view changes. Now that I know what I'm doing this should be fairly simple.

I have not tested this on anything more complex than the cube... but I think it will work.

I AM SO FREAKING GLORIOUSLY HAPPY!!!! :D :D :D :D

EDIT:

I didn't have to use matrices after all!!!! I just used straight forward... uh... math stuff. :oops: I probably should use matrices... but it works so I don't care!

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

Post by Genete »

Good job heyvern!
Now it is time YOU explain to ME how in the hell have you learned math stuff so quick!!!!.... I barely can understand the meaning of the maths involved but it seems you're making the rotation matrix operations by hand.

About shape order I don't know why it does that late order...

None comment about my last release? :roll:

Cheers!
-G
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

None comment about my last release?
Sorry! I just haven't had the time to look at it thoroughly yet.
I am excited about the new improvements though! This looks fantastic! I especially like how much easier it is to do modifications and "partial" rigging. Very cool.

I got caught up though in my own little adventure.
I was flipping out when my darn 3D stuff started working!

The first try all the shapes and rotations were completely backwards and reversed.

I actually thought it wasn't working at all because the perspective was "reversed" to the shapes and my cube looked goofy. Then I turned off the fills and saw my perfect 3D wireframe cube!!!! I knew I was on the right track and had to keep going before I lost my train of thought.

Next is my 3D chair!!!

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

Post by heyvern »

Okay this is something everyone can sink their teeth into!

You don't even have to want to use 3D or even bones in AS to like this trick.

http://www.lowrestv.com/moho_stuff/chair_props.moho
To use this moho file just stick it in the same folder from my last zip download.

http://www.lowrestv.com/moho_stuff/chair_props.mov
Image

The image Above shows 4 vector layers created from the same 3D chair at different angles. These are non animated vector layers. Static "props" with no bones. The chair is very simple built mostly from single line stroke shapes.

To turn the multiple views of the chair into single vector layers requires this cool script set from Rasheed:

viewtopic.php?t=6923

Some minor shape reordering is required.

-vern
Last edited by heyvern on Sat Jun 23, 2007 4:36 pm, edited 2 times in total.
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

Genete,

You know how rotating the shape is kind of strange? You don't get that z axis rotation. You have to rotate the point parent bone to tweak the rotation.

The new code I added for perspective can completely fix this. Once I incorporate the ORIGINAL rotation angles into that new code we should be able to rotate around ALL axes with just the one control bone. Full freedom of rotation like a "real" 3D application.

By putting all the rotations into a "proper" rotation matrix we get "true" 3D rotation.

This is how it should have been done (my fault!) in the first place I just didn't know it at the time. That is how you learn though... by making mistakes!

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

Post by Genete »

Clap, clap, clap!
5 over 5!
I love the fov bone!!!!
We have to put all this together in a definitive version...!!

I have to try the new perspective wizard with the limb stuff.
Cheers!
-G
User avatar
heyvern
Posts: 7035
Joined: Fri Sep 02, 2005 4:49 am

Post by heyvern »

I have to try the new perspective wizard with the limb stuff.
Let me add the perspective code to your new version. I need to take a nap right now but I will work on it later. ;)

My concern is that the limbs have different centers of rotation and it might not work as expected. I need to test it out and see.

Check out translation of the FOV bone. It does some interesting things I had not expected and I'm trying to figure out what it's doing.

I have it moving the "center" bone (point parent bone) with a position constraint. So moving that parent bone does something to the center of rotation of the perspective rotation...

... I have no idea what it's doing but I like it. I just need to control it better.

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

Post by Genete »

I think I would not touch more the 3dgrid9 version. Maybe if you include the perspective code to the limbs also can clean a little the script to make it clear it would be enough.

Take account that:

Z of every point is relative to its center of rotation bone. It is not the true Z value.
Only when I calculate the Z of the shape I take account the Z of its parent and add to the shape properly.
I think it is a problem because the parent can also have another parent and its Z can be also a relative value. Then it depends what shape is calculated before then the real Z is accurate or not. Mmmm... it is a mess. Second level limbs can fail with this kind of Z calculation for sort shapes... The pt bones projection values are corrected because they are parented to the center bone but the Z value is relative and don't take account beyond first parent ship level...

So let me figure out how can I make work second level limbs.
I'll give a trial to the 3D tail...

I'll make you know.
-G
Post Reply