Take the 2-minute tour ×
LEGO® Answers is a question and answer site for LEGO® and building block enthusiasts. It's 100% free, no registration required.

I've been taking a look at the structure of the LDD files recently to see if it's feasible to create a plugin for 3D studio max that allows you to directly open LXF files for higher quality rendering...

It seems possible, but to get some preliminary tests happening I just need to understand exactly how the transformation string works:

transformation="0,0,1,0,1,0,-1,0,0,0.40000009536743164,0,-0.40000009536743164"

It seems pretty obvious from playing around that the last 3 relate to the position of the piece, and the first 9 somehow relate it's rotation (and perhaps 1 or 2 other things I'm not aware of yet). If anyone knows I'd love a detailed explanation as it would save me a LOT of messing around =)

Also are there any good resources of info on lxf files? I have only come across fairly basic stuff so far, would love to find a good resource...

share|improve this question

1 Answer 1

up vote 2 down vote accepted

There's a fairly in-depth discussion on the Eurobricks Digital Designer Forum in the post Understanding LDDs LFXML Schema, where the transformation element is defined as:

Transformation contains 12 comma separated double precision floating point values that represent the first three columns of a 3d transformation matrix and are thus able to handle any linear transformation. It's something that you'll need to learn for yourself but the first 9 entries handle rotation, the last 3 are translation. It's worth noting that the origin of most bricks is at the bottom with the y-axis heading up through the center of a stud, this makes rotations around the axis of the stud slightly easier. Brick width is 0.8, brick height is 0.96 and plate height 0.32. This probably ties in with real world dimensions in some form, but I don't have the details to hand. The double precision floating point format can't necessary cope with precise decimal values as we might expect to see them, therefore you'll see slight deviations from the values given above, eg. -0.79999935626983643 instead of -0.8. Those 0.707 values are 45 degree rotations, they correspond to the sin or cosine of 45 degrees (or PI/4 in radians) and are part of the transformation. Transformations are in world coordinates.

As Philo points out in the comments, the values that The_Cook queries as "probably ties in with real world dimensions" are indeed the sizes of bricks in centimetres, which means you should be able to transform between systems nicely.

In response to your final goal (building a plugin for 3ds Max) what you're really going to need is a complete set of high-quality meshes - the LDD format works with part models rather than vertices/faces/edges/etc. that 3ds uses. Therefore what you'll probably want to take a look at is a tool to convert from LDD to something like LDraw (you could just use the "Export" function in the LDD file menu), and then use the LDraw model library as your basis for importing into 3ds, or use the features in LDView to export to .3ds (the older, text based file type 3d Studio used before it became "Max").

share|improve this answer
2  
"Brick width is 0.8, brick height is 0.96 and plate height 0.32.": These are dimensions of bricks in centimeters... –  Philo Jun 2 at 11:30
    
Good catch, indeed we've covered those nicely on What are the dimensions of a LEGO brick, but it's nice to see that internally LDD is using real world units as well - makes converting easier ;) –  Zhaph - Ben Duguid Jun 2 at 11:47
1  
Thanks for the info and link, just what I was after =) I've been building a max part library for a while by doing exactly that - importing parts in .3ds and completely rebuilding them for best use in max... hopefully have something fun for others to play with one of these days –  Phil Jun 2 at 12:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.