RE: Problem with transformation matrices on some parts
2023-04-08, 12:25 (This post was last modified: 2023-04-08, 18:25 by Florentin.)
2023-04-08, 12:25 (This post was last modified: 2023-04-08, 18:25 by Florentin.)
first
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?
Almost every brick that I render has some kind of problem (I put an Studio vs my software example into the attachements).
So is there a general rule how to deal with this? I mean even the website here is rendering the stuff correctly: https://library.ldraw.org/official/9458
So there must be some kind of trickery to fix that.
Mabye my code is just poo, though I just can't figure out what exactly is wrong, it's pretty much only parsing the lines and then recusively multiplying the matrices with the vertices, not very complex, oh well
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)!
(2023-04-08, 11:57)Magnus Forsberg Wrote: No, you are correct. Two stud primitives are incorrectly flipped in 4733, and should be corrected.
Stud primitives should be rotated into the wanted position. Never fipped.
(The only exception is the bottom stud that is always used mirrored, but only on the y-axis. https://www.ldraw.org/library/primref/#studstud )
LDraw uses a right-handed co-ordinate system where -Y is "up".
https://www.ldraw.org/article/218.html#coords
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?
Almost every brick that I render has some kind of problem (I put an Studio vs my software example into the attachements).
So is there a general rule how to deal with this? I mean even the website here is rendering the stuff correctly: https://library.ldraw.org/official/9458
So there must be some kind of trickery to fix that.
Mabye my code is just poo, though I just can't figure out what exactly is wrong, it's pretty much only parsing the lines and then recusively multiplying the matrices with the vertices, not very complex, oh well
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)!