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 - MrYogi

Pages: [1] 2
1
Support / Re: integrating JPCT-ae with QCAR(vuforia)
« on: October 22, 2012, 09:48:07 am »
Remove them from the matrix and feed them into translate() (maybe after some required transformation between spaces).

what kind of  required transformation between spaces? because when i applied those values into translate() model disappears,sorry for bieng so novice in matrix terms.. :-\

2
Support / Re: integrating JPCT-ae with QCAR(vuforia)
« on: October 22, 2012, 07:46:03 am »
so what operation should be done on  translation values of default matrix ?

3
Support / Re: integrating JPCT-ae with QCAR(vuforia)
« on: October 20, 2012, 02:19:21 pm »
sorry i can't get you,which translation?
and exactly what matrix is needed to draw model ?Rotaional,model or view matrix? and what is the role of FOV ?

4
Support / Re: integrating JPCT-ae with QCAR(vuforia)
« on: October 20, 2012, 01:25:57 pm »
the coordinate system QCAR uses is:




please have a look at this thread for QCAR matrix:https://ar.qualcomm.at/content/how-get-quaternion-or-rotationmatrix-pose-matrix#comment-2014099


if i remove 13,14 and 15 matrix element assuming 3*3 rotation matrix...model is rotated properly but translation(in and out movement of image) is not there..i am really stuck at this position,,can anyone help me? :( :( :(

5
Support / Re: integrating JPCT-ae with QCAR(vuforia)
« on: October 20, 2012, 11:20:04 am »
You can convert the matrices by simply rotating by PI around X. I've no idea if that fixes the problem though. It's a bit unlucky that QCAR returns a model view matrix. The camera's matrix is actually the rotational part of the view matrix. The model matrix is the one that transforms the object. Both combined are the modelview matrix, but that's actually not what the camera should contain. If done correctly, it'll work though...but it's still not the right way...

i am posting matrices to be more clear:

modelviewmatrix:

1.512537      -159.66255   -10.275316   0.0
-89.86529      -1.1592013   4.7839375            0.0
-8.619186     10.179538     -159.44305   0.0
59.182976        93.205956     437.2832            1.0

 modelviewmatrix after reverse using cam.setBack(modelviewmatrix.invert(modelviewmatrix)) :

5.9083453E-5   -0.01109448   -3.3668696E-4   0.0
0.0040540528   -3.8752193E-4   0.0047518034   0.0
-0.004756433   -4.6811014E-4   0.0040459237   0.0
0.7533285     0.4116795            2.7063704   0.9999999

 
exactly what matrix is needed to draw model ?Rotaional,model or view matrix and what is the role of FOV ?i am bit confuse between these,please help me out

6
Support / Re: integrating JPCT-ae with QCAR(vuforia)
« on: October 19, 2012, 09:26:11 am »
thanks for your reply...
i inverted modelview matrix and now it is responsive to position of image detected,but it is misplaced,assuming the coordinate system stated above it tried to rectify it but seems that axis positions are taking effect correctly but axis angles are not ...i tried everything from cam.rotateX() to invertmatrix.rotateX() but nothing is solving my issue,could you please explain how to get proper positioning by changes in angles? :(

7
Support / integrating JPCT-ae with QCAR(vuforia)
« on: October 18, 2012, 03:27:11 pm »
Hi All

i know what i am going to ask is already discussed sometimes in this forum but after going through all of them i can't found my complete answer so i am asking it in a new thread.

when i tried integrating JPCT with QCAR all goes well as expected, i got my modelview matrix from renderframe from jni and successfully transferred that in java to jpct model is shown perfectly as expected. but when i tried to pass this matrix to JPCT world camera my model disappear.

my code:in onsurfacechanged:
Code: [Select]
world = new World();
world.setAmbientLight(20, 20, 20);
sun = new Light(world);
sun.setIntensity(250, 250, 250);
cube = Primitives.getCube(1);
cube.calcTextureWrapSpherical();
cube.strip();
cube.build();
world.addObject(cube);
cam = world.getCamera();
cam.moveCamera(Camera.CAMERA_MOVEOUT, 10);
cam.lookAt(cube.getTransformedCenter());
SimpleVector sv = new SimpleVector();
sv.set(cube.getTransformedCenter());
sv.y -= 100;
sv.z -= 100;
sun.setPosition(sv);
MemoryHelper.compact();

and in ondraw:
Code: [Select]
com.threed.jpct.Matrix mResult = new com.threed.jpct.Matrix();
mResult.setDump(modelviewMatrix );  //modelviewMatrix i get from Qcar
cube.setRotationMatrix(mResult);
cam.setBack(mResult);
                         fb.clear(back);
world.renderScene(fb);
world.draw(fb);
fb.display();

after some research i found that QCAR uses a right-handed coordinate system meaning that the X positive goes right, the Y positive goes up and the Z positive comes out of screen but in JPCT coordinate system the X positive goes right, the Y positive goes down and the Z positive goes into the screen.

so please suggest me what i am missing here?

8
Support / Re: Making explosion/animated sprite
« on: June 25, 2012, 03:18:25 pm »
Thanks alot Egon, this kind of animation works fine.

One more Q: how to make this texture transparent?
Tried
Code: [Select]

texture = new Texture(context.getAssets().open("ani4.png"),true);
TextureManager.getInstance().addTexture("explode", texture);
With png file containing alpha channel & black-backgrounded png file. Can't get transparent texture(
use simple transparent background png image.

9
Support / Re: Making explosion/animated sprite
« on: June 25, 2012, 03:15:19 pm »
hi, by using the way you suggested,the TextureMatrix is setting only last row as sprite,only after using some delay so that the sprite can show ,because without that it is so fast for eye.
my code for TextureMatrix in onDrawFrame is :
Code: [Select]
com.threed.jpct.Matrix texMat=new com.threed.jpct.Matrix();
texMat.scalarMul(0.25f);

if(sprite)
{
float x,y=0;
plane.setVisibility(true);
for (x=0;x<4;x++)
{

for(y=0;y<4;y++)
{
frameCount++;
if(frameCount==200)
{
frameCount=0;

texMat.translate(0.25f*(float)x, 0.25f*(float)y, 0);
plane.setTextureMatrix(texMat);

}

}

}
}

10
Support / Re: Making explosion/animated sprite
« on: June 22, 2012, 03:17:14 pm »
You can create a texture that contains for example 16 (4*4) explosion textures, create quad with texture coordinates (0,0)-(0.25,0.25) and modify the texture matrix at runtime to "jump" to the proper explosion image for the given frame.
hi EgonOlsen,
i,m also trying the same thing ,as i'm new to Jpct :-\ so could you plz elaborate your ans.i have image with explosion texture.but how to use texture coordinate puzzling me.
thanks for your help 

11
Support / Re: proper tutorial for model animation
« on: June 20, 2012, 11:16:55 am »
That's because the model textures contain black parts, which jPCT will default to zero alpha. This doesn't matter if you render into an opaque buffer, but in your case, it does. Solution should be simple: create the textures with "new Texture(..., true);"
ya that was the problem ,thanx a lot

12
Support / Re: proper tutorial for model animation
« on: June 20, 2012, 10:35:47 am »
hey i can't guess where was  the problem but now it's animating,
i'm attaching screen shot,in which you can see that some portion are transparent,every model facing the same problem.

[attachment deleted by admin]

13
Support / Re: how to pass modelviewmatrix to get proper rendering
« on: June 20, 2012, 09:30:58 am »
hey for those who faced the same problem i found the solution:

these lines done all for me in onDrawFrame:
Code: [Select]
com.threed.jpct.Matrix mResult = new com.threed.jpct.Matrix();
mResult.setDump(modelviewMatrix);  //modelviewMatrix i get from Qcar
// cube.setRotationMatrix(mResult);
cam.setBack(mResult);


setRotationMatrix(mResult) and cam.setBack(mResult) both works for me.

14
Support / Re: proper tutorial for model animation
« on: June 20, 2012, 09:13:06 am »

hey no result means i'm talking about no animation
here is my code:
Code: [Select]
public void onSurfaceChanged(GL10 gl, int w, int h) {
if (fb != null) {
fb.dispose();
}
fb = new FrameBuffer(gl, w, h);
world = new World();
world.setAmbientLight(20, 20, 20);

sun = new Light(world);
sun.setIntensity(250, 250, 250);
Resources res = ImageTargets.getImageTarget().getResources();
TextureManager tm = TextureManager.getInstance();

Texture ogro1 = new Texture(res.openRawResource(R.drawable.ogrobase));
tm.addTexture("ogro", ogro1);
ogro = Loader.loadMD2(res.openRawResource(R.raw.ogro), 1f);
ogro.setTexture("ogro");
// ogro.rotateY(-20);
// ogro.rotateZ(110);
ogro.rotateX(90);
world.buildAllObjects();
world.addObject(ogro);
Camera cam = world.getCamera();
cam.moveCamera(Camera.CAMERA_MOVEOUT, 50);
cam.lookAt(ogro.getTransformedCenter());
SimpleVector sv = new SimpleVector();
sv.set(ogro.getTransformedCenter());
sv.x -= 300;
sv.z -= 0;
sun.setPosition(sv);
MemoryHelper.compact();
}
public void onDrawFrame(GL10 gl) {
ogro.animate(anim, 0);
if (anim>1) {
anim=0;
} else {
anim+=0.1f;
}
fb.clear();
world.renderScene(fb);
world.draw(fb);
fb.display();

if (System.currentTimeMillis() - time >= 1000) {
Logger.log(fps + "fps");
fps = 0;
time = System.currentTimeMillis();
}
fps++;
}
}

15
Support / proper tutorial for model animation
« on: June 20, 2012, 08:03:08 am »
hi all,
I gone through forum and wiki for finding how can I animate my models specially md2 with in build animation but finally got bit confused.
I used  model.animate() but no result. can anyone simply suggest how to use in build multiple animations of md2.
and another question ,my md2 models are not fully rendering some small portions are transparent ,what could be reason for that?
thanks in advance

Pages: [1] 2