_SCAR 139 Posted October 17, 2017 All, I read in the Wrp File Format specifications that an object is represented as: Object { float TransformMatrix[3][4]; // standard directX transform matrix ulong ObjectId; String P3dFileName[Length]; // "ca\buildings\ryb_domek.p3d" } I'm trying to understand this 3x4 transformation matrix. From the 8WVR format one can read: Quote The 'TransformMatrix' for a given object is a standard 4 x 3 transform matrix which when decomposed determines the objects x,z,y position, scale & orientation (NB: Special logic must be applied to decompose the orientation from a Matrix.). From OPRW2: Quote Transform[4][3]; This is the transform matrix used directly by Microsoft DirectX engines. In fact, the 'correct' matrix is actually 4 x 4, but the last column always represents 0,0,0,1 thus M11,M12 M13 (0.0) M21,M22,M23 (0.0) M31,M32,M33 (0.0) M41,M42,M43 (1.0) and so is never stored. This identical matrix is used for WRP files (both formats) and RTM files. The last row (M41...) happens to be the position of the object X Z Y co-ordinates, and is often referred to separately. For further information visit Microsoft. However the link is dead. Mikero DePew's docs state that: Quote Orientation, pitch, slant, skew, position and scale are derived from this matrix. The internal transform matrix, held by a pew, and used by visitor, is in 'row' format. All other transforms used by bis, including wrps, are in column format. One wrinkle with pew transforms is that the height information of the object is stored in the 'Y' position. Most external tools expect an XYZ of LeftMost, UpperMost, and Height. Where can I find some information on how to build such a matrix? I don't understand how to insert Pos (x,y,z), rotation (pitch, roll, yaw) and scale in such a matrix. The reason I'm dealing with this? I'm trying to fix the wrong 3DEN to TB imports that mess up completely rotations, hence making it real hard for Terrain Builders to use fast tools such as XCam. Any inputs warmly welcome. Share this post Link to post Share on other sites
t_d 47 Posted October 18, 2017 There are so many ways to create such transformations matrices: Most commonly you create a matrix for each operation you want to perform like rotating, scaling, translating, mirroring etc. and then you multiply those in order of the operations to get a single matrix that holds all those operations. Here you can see how those single operation matrices are built. 1 Share this post Link to post Share on other sites