Problem with transformation matrices on some parts


RE: Problem with transformation matrices on some parts
#4
(2023-04-08, 12:25)Florentin Wrote: How come that softwares that use ldraw (like Studio) render them correctly? Do they manually check each part if they are correct and so they pretty much have their own library or how does that work?

No. You're not reading the matrices correctly. They are all consistent in LDraw parts.


(2023-04-08, 12:25)Florentin Wrote: EDIT: Ok i fixed the studs issues: I flipped the matrix intake around, not reading in the first 3x3 part where the rotation happens column first but row first and now I just have some random triangles flying around on some parts, so it's better but not fully correct yet (see last 2 pictures)!

I think you still aren't reading the matrix information correctly. LDView reads the components from the type 1 line in the following order:

Code:
lineType colorNumber x y z a b c d e f g h i

These then go into a 16-float transformation matrix like so:

Code:
    m_matrix[3] = 0.0f;
    m_matrix[7] = 0.0f;
    m_matrix[11] = 0.0f;
    m_matrix[15] = 1.0f;
    m_matrix[0] = a;
    m_matrix[4] = b;
    m_matrix[8] = c;
    m_matrix[1] = d;
    m_matrix[5] = e;
    m_matrix[9] = f;
    m_matrix[2] = g;
    m_matrix[6] = h;
    m_matrix[10] = i;
    m_matrix[12] = x;
    m_matrix[13] = y;
    m_matrix[14] = z;

If I had to guess, your x y z values are in the wrong place, but I could be wrong.
Reply
« Next Oldest | Next Newest »



Messages In This Thread
RE: Problem with transformation matrices on some parts - by Travis Cobbs - 2023-04-09, 5:58

Forum Jump:


Users browsing this thread: 1 Guest(s)