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.


Messages - aeroxr1

Pages: 1 2 [3] 4 5 6
31
Bones / Re: skeletonDebugger doesn't work
« on: September 10, 2014, 10:47:53 am »
Thanks :)

Code: [Select]
for (Animated3D a : modello)
{
a.setTexture("vincent");
a.discardMeshData();
a.setVisibility(false);
}



//calcoliamo le grandezze del boundingbox del nostro modello

float[] bb = renderer.calcBoundingBox();
float box_h = (bb[3] - bb[2]); // ninja height
// ora si crea una telecamera e devo capire come posizionarlo
Camera cam = world.getCamera();
cam.setPosition(0,-box_h/2,0);
cam.moveCamera(Camera.CAMERA_MOVEOUT, 70);  //la sposto indietro
cam.lookAt(new SimpleVector(0, -box_h/2, 0));
//rivedere la direzione giusta della camera

//ora si crea un vettore per indirizzare il sole
new Light(world).setPosition(new SimpleVector(0, -box_h/2, box_h));

currentPose = modello.get(0).getSkeletonPose();

skeletonDebugger = new SkeletonDebugger(currentPose,10f, (short)0);
skeletonDebugger.addToWorld(world);
skeletonDebugger.setVisibility(true);

32
Bones / Re: skeletonDebugger doesn't work
« on: September 10, 2014, 10:33:52 am »
I try to say that I don't use
Code: [Select]
frameBuffer.display(); in my code, but when I run my application the model is visible O.o Why does it works without display() ?

Code: [Select]
Skeleton isn't something that you're supposed to see. One way or another, you need frameBuffer.display(). Here's what you could do:
Ok, SkeletonDebugger help me to visually represent a SkeletonPose, but i thought If I did this :

Code: [Select]
currentPose = modello.get(0).getSkeletonPose();
skeletonDebugger = new SkeletonDebugger(currentPose);
skeletonDebugger.setVisibility(true);
skeletonDebugger.addToWorld(world);

the skeleton would be visible .

But AGP told me that I have to use something like this code :

Code: [Select]
     public SimpleVector getJointPosition(Joint joint) {
SimpleVector location = skeletonPose.getGlobal(joint.getIndex()).getTranslation();
location.matMul(model.get(0).getWorldTransformation());
return location;
     }

33
Bones / Re: skeletonDebugger doesn't work
« on: September 10, 2014, 10:05:33 am »
I thought that skeletondebugger was used to keep the skeleton visible , but now I think that I am not really understanding what skeletondebugger is used for .

Code: [Select]
currentPose = modello.get(0).getSkeletonPose();
skeletonDebugger = new SkeletonDebugger(currentPose);
skeletonDebugger.setVisibility(true);
skeletonDebugger.addToWorld(world);

what do it does ?


And another doubt why on android the models is visible also if i'm not used display() ? O.o

34
Bones / Re: Animate rigged model according to given commands
« on: September 10, 2014, 09:52:15 am »
I edit the code from degree to radiant and I will try :)

35
Bones / skeletonDebugger doesn't work
« on: September 10, 2014, 12:05:40 am »
Hi :)
I would like to see skeleton of my human models, for do that in onDrawFrame I have only used "drawWireframe"

Code: [Select]
@Override
public void onDrawFrame(GL10 gl)
{
if (frameBuffer == null)
return;

frameBuffer.clear(back); //ripulisco il frameBuffer e lo setto con il colore di sfondo voluto
world.renderScene(frameBuffer);
world.drawWireframe(frameBuffer, wireFrameColor, 1, true);
//world.draw(frameBuffer);
//frameBuffer.display();

}

And in onSurfaceChanged I have did this  :

Code: [Select]

private AnimatedGroup modello;

@Override
public void onSurfaceChanged(GL10 gl, int width, int height) {
// TODO Auto-generated method stub
Logger.log("onSurfaceChanged");
if (frameBuffer != null) {
frameBuffer.dispose();
}
frameBuffer = new FrameBuffer(gl, width, height);

if (master == null) { 


world = new World(); 


Resources res = getResources();
try {

modello = BonesIO.loadGroup(res.openRawResource(R.raw.vincent));
modello.addToWorld(world);
}
catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}

world.setAmbientLight(127, 127, 127);
world.buildAllObjects();

TextureManager.getInstance().flush();
Texture texture = new Texture(res.openRawResource(R.raw.vincent_texture));
texture.keepPixelData(true);
TextureManager.getInstance().addTexture("vincent", texture);

for (Animated3D a : modello)
{
a.setTexture("vincent");
a.discardMeshData();
}



float[] bb = renderer.calcBoundingBox();
float box_h = (bb[3] - bb[2]);

Camera cam = world.getCamera();
cam.setPosition(0,-box_h/2,0);
cam.moveCamera(Camera.CAMERA_MOVEOUT, 70); 
cam.lookAt(new SimpleVector(0, -box_h/2, 0));

new Light(world).setPosition(new SimpleVector(0, -box_h/2, box_h));

currentPose = modello.get(0).getSkeletonPose();
skeletonDebugger = new SkeletonDebugger(currentPose);
skeletonDebugger.setVisibility(true);
skeletonDebugger.addToWorld(world);


MemoryHelper.compact();


if (master == null) {
Logger.log("Saving master Activity!");
master = MainActivity.this;
}

}


int num=modello.get(0).getSkeleton().getNumberOfJoints();
int dim=modello.getSize();
Logger.log("numbers of joints ="+num+",size="+dim);

}

But the skeleton doesn't appear. 
The log the result is
"numbers of joints=67,size=1"

To this message I have attached the skeleton xml

36
Support / Re: Simple Camera Movement example
« on: September 09, 2014, 11:16:46 pm »
I have two another questions :

differents between world.draw(framebuffer) and framebuffer.display() ?   ;D

and the other question is in bones's sections, but no one can answer me because is  matematics's problems regarding bind pose and inverse bind pose  :-\

37
Bones / Re: Animate rigged model according to given commands
« on: September 09, 2014, 09:17:17 pm »
thanks anyway  :)

38
Bones / Re: Animate rigged model according to given commands
« on: September 09, 2014, 05:30:51 pm »
Boh, I thought I read this  :-[

I'm trying to positionate the left arm close to the model's body but I can't :(

This is the code that I used :

Code: [Select]
Logger.log("rotazione");
Tpose = modello.get(0).getSkeletonPose();
Tpose.setToBindPose(); //setto la posa iniziale del modello
final Joint LUpperArm  = Tpose.getSkeleton().getJoint(17);
final Joint parentJoint = Tpose.getSkeleton().getJoint(LUpperArm.getParentIndex());
skeletonDebugger=new SkeletonDebugger(Tpose);
skeletonDebugger.addToWorld(world);
rotation=new Matrix(LUpperArm.getBindPose());
rotation.rotateX(90); //ruoto il braccio dalla bindPose di 90gradi
rotation.matMul(parentJoint.getInverseBindPose());
        Tpose.getLocal(17).setTo(rotation);
        Tpose.updateTransforms();
        skeletonDebugger.update(Tpose);
        modello.applySkeletonPose();
        modello.applyAnimation();

What did I do wrong ?

I have this problems because I don't know the math behind bind matrices,inverse bind matrices and local trasformation ecc ecc :( Could you suggest me some guides ?


39
Bones / Re: Animate rigged model according to given commands
« on: September 09, 2014, 04:03:05 pm »
Code: [Select]
private void targetJoint(SkeletonPose pose, int jointIndex, SimpleVector bindPoseDirection,
    SimpleVector targetPos, final float targetStrength) {
   
        final int parentIndex = pose.getSkeleton().getJoint(jointIndex).getParentIndex();

        // neckBindGlobalTransform is the neck bone -> model space transform. essentially, it is the world transform of
        // the neck bone in bind pose.
   1-     final Matrix jointInverseBindPose = pose.getSkeleton().getJoint(jointIndex).getInverseBindPose();
        final Matrix jointBindPose = jointInverseBindPose.invert();

      .........................
       
        // now remove the global/world transform of the neck's parent bone, leaving us with just the local transform of
        // neck + rotation.
        subGlobal.matMul(jointBindPose);
     2-   subGlobal.matMul(pose.getSkeleton().getJoint(parentIndex).getInverseBindPose());

      .........................
    }

But the inverseBindPose matrix is not the same for all the bones ?

In 2 can I use the inverseBindPose calculated in 1 ? No ? why ?


40
Support / Re: Simple Camera Movement example
« on: September 09, 2014, 03:54:52 pm »
ah Ok :)

Thanks :)


41
Bones / Re: Animate rigged model according to given commands
« on: September 08, 2014, 08:08:42 pm »
I searched into the web, but I didn't found an explanation of the use of matrix bindpose , matrix inverse bind pose and the relation between them.

EDIT : I found this explanation http://www.gamedev.net/topic/571044-skeletal-animation-bonespace/ . It is wrong ?

But remain this doubts :

Code: [Select]
        final Matrix jointInverseBindPose = pose.getSkeleton().getJoint(jointIndex).getInverseBindPose();
        final Matrix jointBindPose = jointInverseBindPose.invert();

jointInverseBindPose ok, now , maybe I understand whats is it.
But why do we do this :
Code: [Select]
jointBindPose =  jointBindPose = jointInverseBindPose.invert(); ?
in the precedent link this thing there isn't .. :(


Other parts of code that I don't really understand are :
Code: [Select]
        // Get a vector representing forward direction in neck space, use inverse to take from world -> neck space.
        SimpleVector forwardDirection = new SimpleVector(bindPoseDirection);
        forwardDirection.rotate(jointInverseBindPose);

        // Get a vector representing a direction to target point in neck space.
        SimpleVector targetDirection = targetPos.calcSub(pose.getGlobal(jointIndex).getTranslation()).normalize();
        targetDirection.rotate(jointInverseBindPose);


in particular why do we use jointinversebindpose to rotate the forwarDirection and the targetdirection ? to take from world to neck space don't we need to multiply vector to jointinversebindpose ?

And I don't understand this :
Code: [Select]
pose.getGlobal(jointIndex).getTranslation()
Can you give me a hand ?

42
Bones / Re: Animate rigged model according to given commands
« on: September 07, 2014, 01:12:46 pm »
Do Hacker wants to obtain your private images ? xD
Now I'm trying to understand the rotation matrix to applied it to the arms , I want they lies along the body :)
( I want to set the position of model's arms via programmatically )

43
Support / Simple Camera Movement example
« on: September 07, 2014, 12:42:06 pm »
Hi :)
In this example :
http://www.jpct.net/wiki/index.php/Simple_Camera_Movement

I don't understand this passage very well :

Code: [Select]
if (touchTurn != 0) {
SimpleVector backVect = cube.getTransformedCenter();
backVect.scalarMul(-1.0f);
rotationmatrix.translate(backVect);
rotationmatrix.rotateY(touchTurn);
rotationmatrix.translate(cube.getTransformedCenter());
touchTurn = 0;

0- I create a matrix rotationmatrix = new matrix();
1- I create a vector to centerposition of my model
2- I multiply this vector for -1 , why ?
3- I apply the traslation created to my rotationmatrix 
4- I rotate it around the Y axis
5- I traslate my matrix to center of my model, why ?

Code: [Select]
if (touchTurnUp != 0) {
transformMatrix.translate(new SimpleVector(0, -touchTurnUp * 30,0));
touchTurnUp = 0;
}

transformMatrix is a mistake, right ? I have to traslated the rotationmatrix, right ? But why I have to do that ? The rotation round the Y axis is not enough ?

and at last :
Code: [Select]
transformMatrix.setIdentity();

fb.clear(back);
world.renderScene(fb);
world.draw(fb);
fb.display();


}

I don't understand why I have to do setidentity .


Thanks :)

44
Bones / Re: Animate rigged model according to given commands
« on: September 07, 2014, 09:45:18 am »
off-topic : bones's website is down

45
Bones / Re: Animate rigged model according to given commands
« on: September 06, 2014, 09:45:21 pm »
All the object after the inserting is positionated in 0,0,0 ?

For example when I use getcamera() the camera initially is in 0,0,0 ?

I try to ask :D :
Is there an example where the model is scaled when the smartphone is rotated from portrait to landscape view ? :D

Now I'm trying to experiment with direction,simplevector and rotation matrix  ;D

Pages: 1 2 [3] 4 5 6