Armature proposal

Animation tools, character animation, non linear animation

Moderators: jesterKing, stiv

Money_YaY!
Posts: 876
Joined: Wed Oct 23, 2002 2:47 pm

Postby Money_YaY! » Sat Feb 21, 2004 5:53 pm

Eric wrote:You get a quite clear error message here:

Code: Select all

editarmature.c:1273: error: too many arguments to function `gluSphere'


And if you look at beatabix code-example (he actually said "something like this" btw)

Code: Select all

gluSphere( qobj, 0,  1.0F*size, 12, 12);


You see that there are 5 arguments...And by taking a quick look in the reference again you see that gluSphere() wants 4 arguments.

Go figure the rest =)


Ok, but all this does is edit the joint sphere. I kinda like the full sphere better, i tried the other stuff and it just draws to many lines.

So, can somebody still help me out with the 'make armatures into mesh squares' ? I am reading the Red book but still need help on what I should change. Theeth said that changing the calls to make it draw something else is in order, but you know me I get lost really quickly in this code stuff. I can find my way in a brand new city and all but for code I get lost in one fell swoop. :D

loos
Posts: 17
Joined: Mon Jun 09, 2003 3:43 pm
Location: South Jordan, UT

Postby loos » Fri Feb 27, 2004 10:55 pm

Money_Yay: How are you supposed to get different shapes of bones with this setup? I was looking at the CAT (http://www.charanitech.com/home.asp) page and some of the bones are cubes, some are rectangular. I can see how you would get rectangular ones, but what would the UI be for getting cubes and such?

Thanks,

loos

Money_YaY!
Posts: 876
Joined: Wed Oct 23, 2002 2:47 pm

Postby Money_YaY! » Sat Feb 28, 2004 11:15 pm

loos wrote:Money_Yay: How are you supposed to get different shapes of bones with this setup? I was looking at the CAT (http://www.charanitech.com/home.asp) page and some of the bones are cubes, some are rectangular. I can see how you would get rectangular ones, but what would the UI be for getting cubes and such?

Thanks,

loos


Yah there, that is where I stole it from! :D
Small stubly bones would be used for the small cubes. Like a real spine is made of 16-20 bones that bend and strech.

As for progress, I have none. but to rethink the idea, Draw boxes instead of bones. And the fact that Armatures are resizeable already fixes half of the box size problem.

If somebody could just point me in some sort of clean direction I could try a go at it, but so far I can find no such code or demo from students trying to make this kind of thing.

loos
Posts: 17
Joined: Mon Jun 09, 2003 3:43 pm
Location: South Jordan, UT

Postby loos » Sun Feb 29, 2004 8:12 pm

I played with armatures some more and found you can just resize/grab them the same as any other geometry, so that answers my last question (I'm a coder not a blender user, though I think blender is really cool, I'm just not an artist).

I'm working on trying to get it to draw cubes now. It really shouldn't be hard to just draw cubes, but how do you want to manipulate these things? If they're cubes like CAT's product, how do you rotate them and such? What does the user grab with no visual joints?

Any ideas?

Money_YaY!
Posts: 876
Joined: Wed Oct 23, 2002 2:47 pm

Postby Money_YaY! » Sun Feb 29, 2004 9:50 pm

loos wrote:I played with armatures some more and found you can just resize/grab them the same as any other geometry, so that answers my last question (I'm a coder not a blender user, though I think blender is really cool, I'm just not an artist).

I'm working on trying to get it to draw cubes now. It really shouldn't be hard to just draw cubes, but how do you want to manipulate these things? If they're cubes like CAT's product, how do you rotate them and such? What does the user grab with no visual joints?

Any ideas?


! Yee ! If you could at some point give a few little directions on what you changed to make it draw boxes that would be a good lesson for me to examine.

Anyway. curently there is no method of visual feedback for rotation on axis for the current armatures either. That is where the idea for an axis mesh could appear when a bone is selected like so.
Image
But that feature idea is in the furture.

To solve the draw boxes problem, the box that is selected would change color just as the armatures change color, like grey to blue. Users choice.

Later there could be a method that lets you edit the mesh or fuze a mesh in with it so the rig is a bit more custom. I think I went everywhere with this post. Do not mind me, my mind runs a mile a second.

For now just getting the armatures to become blocks will give a much cleaner visual feed back.

loos
Posts: 17
Joined: Mon Jun 09, 2003 3:43 pm
Location: South Jordan, UT

Postby loos » Sun Feb 29, 2004 10:42 pm

Here's what I have so far:

Code: Select all

        /* Setup the Cube Points */

        vec[0][0] = -bulge;
        vec[0][1] = -bulge;
        vec[0][2] = 0;

        vec[1][0] = bulge;
        vec[1][1] = -bulge;
        vec[1][2] = 0;

        vec[2][0] = bulge;
        vec[2][1] = bulge;
        vec[2][2] = 0;

        vec[3][0] = -bulge;
        vec[3][1] = bulge;
        vec[3][2] = 0;

        vec[4][0] = -bulge;
        vec[4][1] = -bulge;
        vec[4][2] = length;

        vec[5][0] = bulge;
        vec[5][1] = -bulge;
        vec[5][2] = length;

        vec[6][0] = bulge;
        vec[6][1] = bulge;
        vec[6][2] = length;

        vec[7][0] = -bulge;
        vec[7][1] = bulge;
        vec[7][2] = length;

        glRotatef (90, 0, 1, 0);
        glRotatef (-90, 1, 0, 0);
       
        /* Draw Bone */
        glBegin(GL_QUADS);
       
        glVertex3fv(vec[0]);
        glVertex3fv(vec[1]);
        glVertex3fv(vec[2]);
        glVertex3fv(vec[3]);
       
        glVertex3fv(vec[1]);
        glVertex3fv(vec[5]);
        glVertex3fv(vec[6]);
        glVertex3fv(vec[2]);
       
        glVertex3fv(vec[2]);
        glVertex3fv(vec[6]);
        glVertex3fv(vec[7]);
        glVertex3fv(vec[3]);
       
        glVertex3fv(vec[3]);
        glVertex3fv(vec[7]);
        glVertex3fv(vec[4]);
        glVertex3fv(vec[0]);
       
        glVertex3fv(vec[0]);
        glVertex3fv(vec[4]);
        glVertex3fv(vec[5]);
        glVertex3fv(vec[1]);
       
        glVertex3fv(vec[4]);
        glVertex3fv(vec[5]);
        glVertex3fv(vec[6]);
        glVertex3fv(vec[7]);
       
        glEnd();


which replaces the old code:

Code: Select all

       /*      Section 1*/
      glBegin(GL_LINE_STRIP);
      vec[0]= vec[1]= 0;
      glVertex2fv(vec);
     
      vec[0]= -bulge; vec[1]= bulge;
      glVertex2fv(vec);
     
      vec[0]= 0; vec[1]= length;
      glVertex2fv(vec);
     
      vec[0]= bulge; vec[1]= bulge;
      glVertex2fv(vec);
     
      vec[0]= 0; vec[1]= 0;
      glVertex2fv(vec);
      glEnd();
     
      /*      Section 2*/
      glRotatef(90,0,1,0);
      glBegin(GL_LINE_STRIP);
      vec[0]= vec[1]= 0;
      glVertex2fv(vec);
     
      vec[0]= -bulge; vec[1]= bulge;
      glVertex2fv(vec);
     
      vec[0]= 0; vec[1]= length;
      glVertex2fv(vec);
     
      vec[0]= bulge; vec[1]= bulge;
      glVertex2fv(vec);
     
      vec[0]= 0; vec[1]= 0;
      glVertex2fv(vec);
      glEnd();

      /*      Square*/
      glTranslatef (0,bulge,0);
      glRotatef(45,0,1,0);
      glRotatef(90,1,0,0);
      glBegin(GL_LINE_STRIP);
     
      vec[0]= -bulge*.707;vec[1]=-bulge*.707;
      glVertex2fv(vec);
     
      vec[0]= bulge*.707;vec[1]= -bulge*.707;
      glVertex2fv(vec);
     
      vec[0]= bulge*.707;vec[1]= bulge*.707;
      glVertex2fv(vec);
     
      vec[0]= -bulge*.707;vec[1]= bulge*.707;
      glVertex2fv(vec);

      vec[0]= vec[1]= -bulge*.707;
      glVertex2fv(vec);
      glEnd();


I'd just comment out the old stuff and paste in the new stuff. It compiles with the CVS bf-blender that I checked out this afternoon (Sunday Feb 29, 2004).

I don't think this is working like you want though. It does draw the boxes, but the boxes aren't shaded like your pictures (I'm working on it). Also, it doesn't seem to allow me to scale the boxes on each bone's local coordinate systems (Again, I'm going to see if I can figure out how to do this). But as I might not figure this out quickly enough for you, you can try this and see what you think.

Hope you like :)

Money_YaY!
Posts: 876
Joined: Wed Oct 23, 2002 2:47 pm

Postby Money_YaY! » Sun Feb 29, 2004 11:21 pm

Oh no, please do not let me confuse you. Those thick lines are just a drawtype feature of Tuhopuu2 I just use it for clarity sakes to help my mind think.

The idea of the bone selected would be like this.
Image

Image

I did this with two meshes it does not work in production, it is just a 3d render bug or something.

Money_YaY!
Posts: 876
Joined: Wed Oct 23, 2002 2:47 pm

Postby Money_YaY! » Mon Mar 01, 2004 2:36 am

sadly I am a duuf, I followed the cut and paste procedure but I get this

editarmature.c:1497: error: stray '\312' in program
editarmature.c: In function `create_vgroups_from_armature':
editarmature.c:2982: warning: implicit declaration of function `create_dverts'
make[3]: *** [/Users/ranch/projects/tuhopuu/tuhopuu2/obj/darwin-7.0.0-powerpc/blender/src/editarmature.o] Error 1
make[2]: *** [all] Error 1
make[1]: *** [all] Error 1
make: *** [all] Error 1
[Doritoss-Computer:~/projects/tuhopuu/tuhopuu2] ranch%


Could I get a a full file from you ? Also, it is editarmature.c right ? :D

beatabix
Posts: 73
Joined: Fri Oct 18, 2002 1:12 am

Postby beatabix » Mon Mar 01, 2004 11:51 am

money - the compile problems you are having are from completely unrelated functions. create_vgroups_from_armature and create_dverts are nothing to do with the drawing functions. make sure you close all your statements and stuff.
later
BEAT

beatabix
Posts: 73
Joined: Fri Oct 18, 2002 1:12 am

Postby beatabix » Mon Mar 01, 2004 12:17 pm

loos -
those are the same problems that i had:

a. changing gl instructions still displays as flat colours. not solid / shaded.

b. bones are drawn based on their length. longer bones are thicker. doesn't fit for all cases - eg -> fingers: short & thin (ok); limbs: longer & thicker(ok); however: head? chest? hips?

for the colours, you should check the cpack function. you can see the colours used defined at the start of the editarmature.c file, however i think drawobject.c has the best examples of opengl drawing. That's probably the best place to get inspiration from.

for the bone sizes, my idea was to add a variable that can be edited in the bone properties panel, like thickness or something. then for the interface, just have a toggle in the armature panel, like 'draw solid' or something.

incidentally, from a litlle digging around, it seems that 'cpack' is an ancient irisGL call that isn't encouraged anymore.

later
BEAT

beatabix
Posts: 73
Joined: Fri Oct 18, 2002 1:12 am

Postby beatabix » Mon Mar 01, 2004 5:48 pm

ok, here is a screenshot of my current status:

Image

This is a chain of bones, the fourth of which is selected (and currently being rotated, though the cursor isn't captured). The bones are automatically rendered in openGL, a direct replacement of the current bone display system.

the most obvious thing that need fixing is the depth sorting. However this will likely be problematic, as the x-ray bones feature works with depth sorting, and this might cause conflicts.

To get to this stage i basically ripped out the current openGL calls, replaced them with my own derivative of the function posted by loos, and added a few glEnable switches. Then i created a new set of material definitions (mat_aqua, mat_cyan, etc.) and assigned them to the bones in the same 'if' statements as the current solid colour assignments.

The rest is way over my head. I don't know how to add buttons and flags in the blender interface. I don't know how to make these armature objects renderable. i don't know how to give each bone it's own thickness or other properties.

But as you can see above, it is entirely feasable to implement these features. It is meerly a question of whether the blender code royalty actually agree that such features are needed. Perhaps someone familiar with the character animation code, like Hos, could add something to the discussion.

unfortunately, i can't play with this too much more for the time being. I'm quite proud of my first foray into code hacking (only cvs'd last week), but i need to take a little break for a while.

later
BEAT

Money_YaY!
Posts: 876
Joined: Wed Oct 23, 2002 2:47 pm

Postby Money_YaY! » Mon Mar 01, 2004 9:23 pm

Sweet! Happy! , can you share the editarmature.c file ? or whatever file you changed ? That way I can test it out ? I can try the copy paste method again, I just need to know what tag should be closed as that was the problem before.

beatabix
Posts: 73
Joined: Fri Oct 18, 2002 1:12 am

Postby beatabix » Tue Mar 02, 2004 1:17 am

well, ok.
i can't get you the .c file just yet, as it is at my workplace (hence the reason i can't work on this too much), and i won't be back there until wednesday or friday. I can tell you that copying and pasting from this thread will not work. There are plenty of additional changes you have to make to get this to work.

i'll try to relate them here from memory, but i might miss things out.
ok...

first, at the beginning of the editarmature.c file, after the license block and the includes, you will see a series of colour constant defines.
eg:
#define B_YELLOW 0x77FFFF

follow these with a set of materials like these:
(can't remember exactly)

static float mat_bone_cyan[] = { 0.0, 1.0, 1.0, 1.0 };
// { r, g, b, a }

do one for each of the four colours.
ok, that's a good start.

now, go through the code. there are four main functions:
draw_armature is the main function, calling all the others.
draw_bonechildren
draw_boneverti draws the joints between bones.
draw_bone draws the individual bones.

scan through these functions and pay close attention to the order in which things happen. I only changed the pose mode colour definitions, in edit and normal mode the mesh is simply black. How did i change it? well, i scanned the four functions mentioned earlier for the cpack (CYAN) and cpack (AQUA) commands, and preceeded them with this line of code (referencing the materials mentioned earlier):

glMaterialfv(GL_FRONT, GL_AMBIENT, mat_bone_cyan);

at some point compiling flung out an error involving an if / else statment, which i fixed by putting curley braces around it. Actually, i don't know if i really fixed it, or if i just removed the error without fixing the problem.

anyway. there were a few other things i had to do. in draw_bone is commented out the whole segment of code mentioned by loos, but also the vec[3] variable defined at the start. i replaced this with my own variable - boxbone[8][3] -> an array of eight vectors (xyz). I then included loos code, however it didn't compile, so i rewrote it to remove any possible glitches.

i also had to preceed the glBegin with some glEnable switches, but i can't remember them. it may have been glEnable(GL_LIGHTING). i wrote glDisable(GL_LIGHTING) after th glEnd, to clean everything up.

ok, i can't remember much else. try it out if you can't wait until i post it. remember it's all prototyping anyway. nothing really presentable yet. but hopefully these little code adventures will provide some people with a little insight.

later
BEAT

Money_YaY!
Posts: 876
Joined: Wed Oct 23, 2002 2:47 pm

Postby Money_YaY! » Tue Mar 02, 2004 1:25 am

I have to know, what am I doing wrong ? how should my line end to add this code in ?

beatabix
Posts: 73
Joined: Fri Oct 18, 2002 1:12 am

Postby beatabix » Tue Mar 02, 2004 3:40 pm

I really can't help you that much. I'm just playing here. I read the openGL programming guide last autumn, then a few other OGL books. My C/C++ knowledge is pretty pathetic, and I've only been digging around the Blender source for about a fortnight. Plus I'm compiling on WinXP with VC6, whereas you are on OSX.

Have you tried actually analysing your error messages?
Have you looked at line 1497 to see what the error message could mean? (I don't know what a 'stray /312' is)

Otherwise, wait until I post the C file. I'll even comment it for you (this stuff is really basic anyway).
later
BEAT


Return to “Animation”

Who is online

Users browsing this forum: No registered users and 1 guest