2019-06-15, 12:11
Hi, I’m new to the forum! I’m mainly a digital Lego builder, with a soft spot for real space and sci-fi models. I’ve been a long-time dabbler with Lego Digital Designer, using LDraw to format models for instruction manuals and recently exploring Mecabricks and Blender for rendering. However, since Lego has confirmed that LDD will not be updated to run on MacOS Catalina (which is dropping support for 32-bit apps) and I haven’t found any alternative Mac editors that I feel comfortable using, I’m seriously looking at the possibility of creating my own Lego CAD program - a native MacOS app, coded in Swift, using the Metal 3D graphics framework.
I’ve never actually coded for the Mac before, so I am not sure how far I will get with this. But I used to play with the Dark Basic programming language and some low-level DirectX 9 commands, so I know the basics of high-level 3D object manipulation, and my day job is partly spent writing C++ programs. Would there be room for another LDraw editor in the community, any interest in having something for the Mac?
I also had a few questions after reading up on the LDraw file format. Please, please don’t take these as criticisms of the library, or think that I am asking/suggesting that anything should be changed, I am only asking to try and get a deeper understanding of how the format works.
Why do you use a right-handed coordinate system, with negative y straight up? The two main conventions are +x to the right, +y upwards, and +z either into or out of the screen (for left or right handed). So why was this one chosen?
Each brick in the library is constructed from a series of recursive primitives, so what’s the best way to manage a brick in a program? Do you consider the brick as an object with multiple child limbs (with the limb structure preserving the LDraw primitive file hierarchy)? Or is it better to combine the geometry data of all of the primitives into a single 3D mesh? And has anyone ever pursued the LDD approach of hiding studs and anti-studs once they are connected, to reduce the scene poly-count?
None of the bricks contain normal data for the vertices, so how do you go about computing this? I mean, I know it’s a vector cross-product for each triangle, but how do you work out if an edge should be a hard edge (like for sides of a 2x4 brick) or a soft edge (like the rounded surface of a minifig head)? How do you go about searching the vertex data for shared edges? (And out of historical curiosity, why wasn’t the LDraw library designed to include the normal data? Was the original intention to use flat shading only?)
What is the importance of the back-face culling commands in the file format? Polygons can be rendered as single or double sided, but single sided is the default for performance reasons, and polygons facing away from the camera can be automatically culled by the 3D render engine. So why does this need to be such a major part of the file format specification? Is this used to help determine which way a normal vector should point when creating a triangle?
For the ROTSTEP command, why does it specify three Euler angles for the rotation instead of a quaternion? And what’s the rotation order (x,y,z, z,y,x, …)? Also, am I correct in assuming that REL and ABS denote use of perspective or orthographic rendering modes?
When defining parts in a model, the file format specifies x,y,z positions then a 3x3 rotation matrix. Why isn’t a full 4x4 matrix used, so that all position, scale, rotation information could be encoded in one structure?
From looking at the Bricksmith editor, steps seem to have a default rotation of x,y,z = 31,41,21 degrees. Why is this angle chosen, does the default ever vary from program to program?
Again, please don’t take any of these questions as criticisms of the LDraw format, I really am just trying to understand how the file format has evolved and how it works currently.
Oh, and sorry for such a huge first post, it’s turned out way longer than I expected!
I’ve never actually coded for the Mac before, so I am not sure how far I will get with this. But I used to play with the Dark Basic programming language and some low-level DirectX 9 commands, so I know the basics of high-level 3D object manipulation, and my day job is partly spent writing C++ programs. Would there be room for another LDraw editor in the community, any interest in having something for the Mac?
I also had a few questions after reading up on the LDraw file format. Please, please don’t take these as criticisms of the library, or think that I am asking/suggesting that anything should be changed, I am only asking to try and get a deeper understanding of how the format works.
Why do you use a right-handed coordinate system, with negative y straight up? The two main conventions are +x to the right, +y upwards, and +z either into or out of the screen (for left or right handed). So why was this one chosen?
Each brick in the library is constructed from a series of recursive primitives, so what’s the best way to manage a brick in a program? Do you consider the brick as an object with multiple child limbs (with the limb structure preserving the LDraw primitive file hierarchy)? Or is it better to combine the geometry data of all of the primitives into a single 3D mesh? And has anyone ever pursued the LDD approach of hiding studs and anti-studs once they are connected, to reduce the scene poly-count?
None of the bricks contain normal data for the vertices, so how do you go about computing this? I mean, I know it’s a vector cross-product for each triangle, but how do you work out if an edge should be a hard edge (like for sides of a 2x4 brick) or a soft edge (like the rounded surface of a minifig head)? How do you go about searching the vertex data for shared edges? (And out of historical curiosity, why wasn’t the LDraw library designed to include the normal data? Was the original intention to use flat shading only?)
What is the importance of the back-face culling commands in the file format? Polygons can be rendered as single or double sided, but single sided is the default for performance reasons, and polygons facing away from the camera can be automatically culled by the 3D render engine. So why does this need to be such a major part of the file format specification? Is this used to help determine which way a normal vector should point when creating a triangle?
For the ROTSTEP command, why does it specify three Euler angles for the rotation instead of a quaternion? And what’s the rotation order (x,y,z, z,y,x, …)? Also, am I correct in assuming that REL and ABS denote use of perspective or orthographic rendering modes?
When defining parts in a model, the file format specifies x,y,z positions then a 3x3 rotation matrix. Why isn’t a full 4x4 matrix used, so that all position, scale, rotation information could be encoded in one structure?
From looking at the Bricksmith editor, steps seem to have a default rotation of x,y,z = 31,41,21 degrees. Why is this angle chosen, does the default ever vary from program to program?
Again, please don’t take any of these questions as criticisms of the LDraw format, I really am just trying to understand how the file format has evolved and how it works currently.
Oh, and sorry for such a huge first post, it’s turned out way longer than I expected!