Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - elhoce

#1
Bones / Re: Transformation problem
April 03, 2012, 07:39:47 PM
Thank you for your help, I solved my problems, my app works perfectly.  ;D
#2
Bones / Re: Transformation problem
April 03, 2012, 12:34:52 AM
Yes it's the palette array !

Now I'm trying to figure out how to interpret a matrix palette.
I have a simple animation :

<track bone="Head">
               <keyframes>
                        <keyframe time="0">
                            <translate x="0" y="0" z="0" />
                            <rotate angle="0.0">
                                <axis x="0" y="1" z="0" />
                            </rotate>
                            <scale x="1" y="1" z="1" />
                        </keyframe>
                        <keyframe time="10">
                            <translate x="0" y="0" z="0" />
                            <rotate angle="-30.0">
                                <axis x="1" y="0" z="0" />
                            </rotate>
                            <scale x="1" y="1" z="1" />
                        </keyframe>
                        <keyframe time="20">
                            <translate x="0" y="0" z="0" />
                            <rotate angle="30.0">
                                <axis x="1" y="0" z="0" />
                            </rotate>
                            <scale x="1" y="1" z="1" />
                        </keyframe>
               </keyframes>
            </track>

When I debuging my project, the palette matrix of the bone "Head" at "n" time is

translation : 7.8505083E-16, -0.77856064, -6.410426
rotation X axis : 1.0, -2.2415054E-17, 2.068825E-18
rotation Y axis : 2.2415054E-17, 0.9831068, -0.1830328
rotation Z axis : 2.068825E-18, 0.1830328, 0.9831068

I find the translation is wrong or this values are not about the translation ?
The result of the animation is that the head does translation animation over the z axis and  y axis; i think the rotation is interpreted as a translation  :(
I think my problem comes the interpretation of the matrix.
Could you please to help me to understand the values of the matrix in order to convert them for my vertex shader.

Thanks

#3
Bones / Re: Transformation problem
April 02, 2012, 09:46:30 PM
Thanks to you Egon for this precision.


Raft, my goal is to play an animation coming from an ogre xml, not to do animation by coding. So could you please tell if this bunch of code does the same thing that applySkeletonPose method :

     vec4 vPos = bones[j1] * vec4(position, 1.0) * w1 + bones[j2] * vec4(position, 1.0) * w2 + bones[j3] * vec4(position, 1.0) * w3 + bones[j4] * vec4(position, 1.0) * w4

with position is the position of the current vertex
j1,j2,j3,j4 the 4 indices of joints and w1,w2,w3,w4 the four weigths associated to the current vertex.

this code is executed for every vertex (vertex shader) of the mesh that I try to animate.

Thanks for your help :)
#4
Bones / Re: Transformation problem
April 02, 2012, 07:50:30 PM
Thanks for your quick reply :)

The problem about the transformToGL call is the matrix identity (jpct) converted doesn't give me an identity matrix (OpenGL)

About your explanation, you said to care about the "relation to its parent", I suggest this link is already done by the updateTranforms call, cuz in the applySkeletonPose call I didn't saw particular code about this. I missed something ?

Thanks
#5
Bones / [SOLVED]Transformation problem
April 02, 2012, 03:21:48 PM
I try to make animations with the vertex shader using the transformation matrices calculated by bones.
Unfortunately I get enough strange animations.

I guess it comes from the fact that your calculation result is stored in the matrices JPCT.
But OpenGL expects to have an OpenGL matrix.
Are the two types of matrices compatible? Otherwise How can I convert the jpct matricx to openGl matrix without going through the method transforGL() of the JPCT class Matrix ?
To tell you the context, the treatment that you do in applySkeletonPose (animate3d class) I did it for my part in the VertexShader.

If I understand your algorithm, you apply the transformations on the mesh which is the previous animation, unlike me where the mesh is still bindPose. What should i do on the palette array to obtain the changes since the bind pose.
#6
Support / shaders skinning
March 25, 2012, 06:43:46 PM
hello,

I try to make animated skinning via GLSL, I need to build VBOs with additional data such as weight and indices of joints per vertex. Because you build VBOs loading object, I'd like to know if I can do instead of JPCT, is that possible?
If not, why?
thank you
#7
Support / Re: Dragging object3d with mouse
March 14, 2012, 11:14:59 PM
Sorry the source doesn't help me :), I need to understand how to simply move a picked object and this object sticks the mouse cursor.
#8
Support / Dragging object3d with mouse
March 14, 2012, 09:48:43 PM
Hi,

I want to drag an object3D , I follow the wiki about how to object it's works but when I try to move the object with the translate method, the object isn't under the mouse :(
my code :
public void mouseMoved(MouseEvent me) {
if(picked==null) return;
                    dest =Interact2D.reproject2D3DWS(world.getCamera(), buffer, me.getX(), me.getY());
                    System.out.println(dir.calcSub(dest).toString() + " " + me.getX() + " " + me.getY());
                    dest.z = 0;
                    dir.z = 0;
                    moveObj3D(picked, dir.calcSub(dest));
                    dir = dest;
}

How can I fix it ?

Thanks for your help.
#9
Support / Re: shaders and animations
March 06, 2012, 09:53:20 PM
Yes I can, How can I merge them in jpct ?
#10
Support / Re: shaders and animations
March 06, 2012, 09:26:58 PM


the problem is I see the edge of each part, so I think the normals must be calculated on the whole model not in each part (part == one object3D)
#11
Support / Re: shaders and animations
March 06, 2012, 08:59:07 PM
because my file already contains precalculated normal data, and because my model looks bad between the parts in jpct
#12
Support / Re: shaders and animations
March 06, 2012, 08:43:16 PM
Thanks now it works fine !

I have another question, I have a model composed of several parts,  How can I disable the normal auto computing during the loading model ?
I have already comment the Object.build() call.

Thanks
#13
Support / shaders and animations
March 06, 2012, 07:58:19 PM
Hi,

I have a problem with shaders,  my model don't move (bones animation) when I activate a shader

my code

GLSLShader shader = new GLSLShader(Loader.loadTextFile("./vertexshader_body.glsl"),Loader.loadTextFile("./fragmentshader_body.glsl"));
        for (Animated3D o : animatedGroup) {
            o.getName();
            o.setTexture("corps");
            o.setRenderHook(shader);
            o.compile();
            o.build();
            o.discardMeshData();
        }

if I comment o.compile() my model moves but without shader  :-[

Can you please tell me why ?

Thanks
#14
Hi,
my bones file takes 12MB with 3200 keyframes. My skeleton have 112 joints...

I have another question, is it possible to animate keyframe per keyframe in other word my set of animation is stored in a whole animation in the xml ogre, so I want to play a bunch of keyframes within the whole animation example start 10 to 30, then 300 to 330 etc... your function animatedGroup.animateSkin(index, sequence); takes the parameter index that I'can't understand cuz index += deltaTime * animationSpeed / clipTime / 1000; so where is the link with the keyframe ?

Thanks.
#15
thank you for your quick reply,

In others words I want to write a class which read & play a set of keyframes but I'm not found an example  who explain how it works.
So what objects in your library i would need to use in order to load a bunch of keyframes.

For my second question this is the same I want to know if there is a way outside of the Skeleton pose to move a joint during an animation.

Sorry I'm french so my english is not very well.