By zakharm
on Wed, 06/20/2012 - 17:07
I'm having an issue with the 3D renderer that I'm trying to integrate into QCAR.
I'm passing the resulting modelViewProjection to my renderer that was derived like the ImageTargets example
[CODE]translatePoseMatrix(0.0f, 0.0f, kObjectScale, &modelViewMatrix.data[0]);
scalePoseMatrix(kObjectScale, kObjectScale, kObjectScale, &modelViewMatrix.data[0]);
multiplyMatrix(&projectionMatrix.data[0], &modelViewMatrix.data[0], &modelViewProjection.data[0]);[/CODE]
The issue I'm having is that when I rotate the camera, the model doesn't stay attached to the target - it rotates incorrectly in the wrong directions. Also, it is like the axis isn't down the center of the model, so when the model rotates it rotates off-center.
I tried first just sending the modelViewProjection to the renderer.
Next I tried doing what I did to solve this in my previous application with another AR package by doing the following to the modelViewMatrix, but it isn't working here sending the modelViewProjection or the modelViewMatrix:
[LIST=1]
[*]transpose rotational values of original matrix into matTranspose[16]
[*]mat multiply: original matrix positional values by matTranspose to matResult
[*]use the matResult position values and overwrite the original matrix positional values
[*]use original matrix with new position values to position the model
[/LIST]
On my third try, I'm getting a bit closer, the rotation is almost there - stays static, but the model position moves in the opposite direction than expected (negating doesn't work)
modelViewMatrix works best with this, but modelViewProjection gets close
[LIST=1]
[*]Transpose original matrix
[*]Multiple original position values by transpose matrix
[*]Use result for rotation and position. negate x position.
[/LIST]
Any ideas for the right combination of transpose / multiply / which rotational / which positional / etc to use?
Also, should I be trying to use the modelViewMatrix or modelViewProjection? modelViewMatrix seems to be getting it closer right now for me.
Re: modelViewProjection matrix rotational / position issues