Hi guys, maybe someone can help me here. I have some geometry and a camera position coming from a RH system. My camera transform seems to be pretty messed up, but I don't really know what's wrong.

I've been struggling with: LH vs RH, rowwise vs columnwise output, and the execution order of transformations before WorldBegin (does order matter here, and/or do I need to worry about ConcatTransform instead of Transform?)

Maybe someone sees something obvious?

--------- rib file ------------------

...

FrameBegin 1

# camera transformations

Projection "perspective" "fov" 9.500000

Transform [0.798635 -0.601816 0.000000 0.000000 0.300908 0.399317 -0.866025 0.000000 0.521188 0.691638 0.500000 0.000000 -193.401300 -265.154600 -220.481900 1.000000]

Translate 193.401300 265.154600 -220.481900

WorldBegin

Scale 1.000000 1.000000 -0.900000

... geometry here ...

--------- matlab calculations --------

% these are coordinates from matlab, RH native...

target = 26 26 10

camera = -193.4013 -265.1546 220.4819

up = 0 0 1

v = target - camera;

v = v/norm(v)

% get the orthonormal basis of the projection plane (su):

s = cross(v,up);

s = s/norm(s);

u = cross(s,v);

u = u/norm(u);

% i'm still not sure what the correct homogenous 4x4 transform is, it seems every book has a slightly different variation on this... perhaps it's because opengl keeps a separate transform? anyway...

m = [s 0; u 0; -v 0; camera 1]

m =

0.7986 -0.6018 0 0

0.3009 0.3993 0.8660 0

-0.5212 -0.6916 0.5000 0

-193.4013 -265.1546 220.4819 1.0000

% convert from RH to LH coordinates...

B = eye(4);

B(3,3) = -1;

% B is it's own inverse.

m = B*m*B

m =

0.7986 -0.6018 0 0

0.3009 0.3993 -0.8660 0

0.5212 0.6916 0.5000 0

-193.4013 -265.1546 -220.4819 1.0000