Jump to content

  • Log In with Google      Sign In   
  • Create Account


Samurai Jack

Member Since 29 Jan 2004
Offline Last Active Today, 12:11 AM
-----

Topics I've Started

Draw bone mesh between to joints

21 August 2013 - 06:20 AM

Hello!

 

I'm having a problem in OpenGL (but it does not really matter) with drawing bone mesh between two joints.

The joints are computed correctly and well placed into 3D space, but when I take 2 joints with their absolute

(world) matrices I am not able to draw a "bone mesh" between them. What I would like to achieve is something

like here:

 

Blender_boning_tutorial_ss9.jpg

 

My Idea was, to take the two absolute(world) joints (parent/child) and compute the angle between

them, set the angle and draw the bone mesh scaled to the joint. But somehow I mess it up.

Sofar I am at the stage, where I can say:

len = length(parent.xzy - child.xyz); // vector length
glPushMatrix( );
glMultMatrixf( parentWorldMatrix ); // this possition here is correct
glRotatef( ... ); // THIS IS NOT OK. Rotate to what? Atan2 ?
glScalef( len, len, len );
glBegin(GL_LINES);
glVertex3f(0, 0, 0);
glVertex3f(0, 1, 0); // y is up, is this correct? The scale should fix the length issue
glEnd();
glPopMatrix();

The direction is nowhere near i would like the bone mesh to point. Can someone help me out?

 


Draw bone mesh between to joints

21 August 2013 - 06:18 AM

Hello!

 

I'm having a problem in OpenGL (but it does not really matter) with drawing bone mesh between two joints.

The joints are computed correctly and well placed into 3D space, but when I take 2 joints with their absolute

(world) matrices I am not able to draw a "bone mesh" between them. What I would like to achieve is something

like here:

 

Blender_boning_tutorial_ss9.jpg

 

My Idea was, to take the two absolute(world) joints (parent/child) and compute the angle between

them, set the angle and draw the bone mesh scaled to the joint. But somehow I mess it up.

Sofar I am at the stage, where I can say:

len = length(parent.xzy - child.xyz); // vector length
glPushMatrix( );
glMultMatrixf( parentWorldMatrix ); // this possition here is correct
glRotatef( ... ); // THIS IS NOT OK. Rotate to what? Atan2 ?
glScalef( len, len, len );
glBegin(GL_LINES);
glVertex3f(0, 0, 0);
glVertex3f(0, 1, 0); // y is up, is this correct? The scale should fix the length issue
glEnd();
glPopMatrix();

The direction is nowhere near i would like the bone mesh to point. Can someone please help me out?

 


Single pass ALPHA Texutre + DIFFUSE COLOR?

31 July 2013 - 08:56 AM

Hello!

 

My problem is as follows:

 

1. I have a 32 BIT RGBA texture with colors and ALPHA. The texture contains a logo.

2. I would like to draw the logo transparent on a QUAD which is solid and SIGNLE color. I use:
 

glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);

3. The logo gets drawn, but it is TRANSPARENT. It ignores any BACKGROUND color I would like to use.

 

So to simplify, I can avoid the problem by:

1. Draw a QUAD of signle color without texturing

2. Draw the QUAD again with ALPHA texture

 

Why do I have to draw 2 times? Is there a way, I would provide color either glColor or glMaterial and use it in single pass?

I do not use any shaders. Fixed function pipeline ONLY. I have read something about glTexEnv but I do not understand it.

 

Feel free to post.

Thank you in advance!

 


Extract vectors out of matrix?

14 January 2013 - 12:57 PM

Hello!

 

I am wondering, if anyone is capable, to solve thi issue:

 

I have the following matrix:

          -0.8454   -0.5298   -0.0682    0.0000
           0.1796   -0.4020    0.8978    0.0000
           0.5031   -0.7468   -0.4350    0.0000
         -24.6733  -18.6587   -0.1653    1.0000

I need to extract: translation, rotation (euler angles) and scale out of this matrix.

So basically I need:

 

Vector3 translation, rotation, scale;

 

Out of the above vectors, I should be able to reconstruct the upper matrix.

Even if not 100% equal, it should meet the following condition:

 

When a vector3 [ 1.0, 2.0, 3.0 ] is transformed over the matrix,

we should get a vector3 with following values: [ -23.6501,  -22.2328,    0.2572]

 

Thank you in advance!


FBX - 4x4 Matrix affine decomposition gone worng?

08 January 2013 - 03:39 AM

Hello!

 

I am working on a FBX converter. So, the target is FBX, and the input is a format that has LOCAL MATRICES.

So the rotation, translation and scaling is stored into 4x4 Matrix. Usualy everything goes right except there

are some situations, where objects are turned for 90 or 180 degrees in the wrong direction.

 

The easisest thing for me would be if I could say: FbxNode->SetLocalMatrix() .

 

But there is no souch function. I can only say: SetTranslation, SetRotation, SetScaling

and they all require vectors for input. What to do?

 

I create a FbxAMatrix (affine matrix) and then get the Translation and Rotation vector

out of it. Of course, the rotation is not allways right.

 

My Idea was, to create a vector with [1,1,1] and then transform it by the original matrix,

get "OriginalOutputVector" and then take the same vector [1,1,1] and transform it

by the Affine Matrix to "AffineOutputVector" and compare them. So I would get

when the affine decomposition went wrong. But how to solve that?

 

Feel free to post.

 

Thank you in advance!

 


PARTNERS