knotian

Lego models to .obj files

Recommended Posts

I have noticed several discussions on covering Lego bricks to .obj so they can be used in other drawing /cad programs. I've worked with a very nice terrain generator, there are several, and I was wondering if there was any software in existence or being worked on, that takes a completed Lego model and converts the entire model into one .obj file. This would be the visible exterior of all six sides, not the bricks or functional parts in the interior of the model. [ Although having a Lego model that could be rigged would be a blast:laugh: ]

The availability of such software would allow the inclusion of Lego models in many graphics creations. I'm pretty sure that there is something available, but it might be proprietary.

Share this post


Link to post
Share on other sites

I have a very early version of lxf to rib (rib is Pixar rendermans format). I am thinking if I can add a lxf to obj option. 

Share this post


Link to post
Share on other sites
On 2/24/2019 at 10:50 AM, knotian said:

This would be the visible exterior of all six sides, not the bricks or functional parts in the interior of the model.

This is the tricky part. I think some LDraw based programs might have some methods of replacing bricks with simple stretched cubes to save the poly count, but it's been quite a while since I've used any so I don't remember details.

As far as LDD goes, this conversion method retains the poly reduction LDD does on the fly, and gives models much more optimized and ready for realtime rendering. But it has a few downsides; it's relatively cumbersome and involves multiple programs (though still only takes a few seconds once you know the workflow) and most bricks of the same color are merged together into a single mesh (which may be a good or bad thing, depending on what your goal is).

If optimization isn't a concern, there's a variety of other ways to get complete LEGO models as OBJ, most of them involving LDraw-based programs. I'm sure other folks here could give more details on those, I'm rather out of the loop on LDraw stuff.

Edit - Also, Mecabricks has OBJ exporting - as far as I know it doesn't have any automatic optimization like what you're looking for, but it's definitely worth checking out: https://mecabricks.com/

Edited by jamesster

Share this post


Link to post
Share on other sites
On 2/24/2019 at 6:50 PM, knotian said:

I was wondering if there was any software in existence or being worked on, that takes a completed Lego model and converts the entire model into one .obj file. 

Not sure if that would be even that terribly useful, given how limited the OBJ format is in itself. It would be pretty messy and likely you'd spend a ton of time reorganising the model in your 3D program. 300 parts may not sound much in LDraw, but it already is quite cumbersome even on a simple model as my modified Technic Gyrocopter. You end up cleaning out redundant material tags, dissolving or creating groups, fixing botched normals from the low-res geometry. Not fun at all.

On 2/24/2019 at 6:50 PM, knotian said:

This would be the visible exterior of all six sides, not the bricks or functional parts in the interior of the model. [ Although having a Lego model that could be rigged would be a blast:laugh: ]

Not to ruin your day, but that's why for the LEGO movies they rebuild the models in Houdini and Maya in the first place. An automated algorithm can only do so much. It already fails with any transparent part and you don't need to dream about complex Technic models with lots of open spaces. You can optimize that away based on view angles in a 3D rendering algorithm, but there's no general recipe to optimize a model from all sides and still visually retain its consistency and functional logic.

On 2/24/2019 at 6:50 PM, knotian said:

[ Although having a Lego model that could be rigged would be a blast:laugh: ]

And there's the rub: Until the LEGO CAD programs get smarter, there's nothing to rig automatically. When you don't even have persistent rotation pivots, how would you determine object hierarchies and kinetic chains? I know I sound like a party pooper, but this would require a fundamental change to how virtual brick models are even created.

Mylenium

Share this post


Link to post
Share on other sites

Don’t think it’s necessary to remove invisible sides. LDD doesn’t do that and if there is a performance issue with too many parts (and sides) this would first affect you in LDD and only after that in the 3D editor of your choice (3DS Max, Blender, Maya, etc.). 

If you talk about rendering, the renderer will take care of the invisible parts itself (even so there are certain performance gains in case this is done before). But unless you target ‘The Lego Movie’ complexity and size of scenes it doesn’t matter. 

For the 1st LEGO movie they had a LDD - Maya importer. But I am pretty sure this didn’t use OBJ for interchange but rather brick reference and LDD transformation info (rotation, translation) as TLG has its brick library in Maya I heared. 

For us hobbyists I however see a direct LDD - OBJ exporter could be useful to provide more flexibility and choice when it comes to rendering. 

In fact I guess modifying my LXFtoRIB script to output OBJ shouldn’t be too hard. One would just have to apply matrix transformation to all bricks read in based on the lxf read in. 

Share this post


Link to post
Share on other sites

LEGO actually has part libraries (with multiple resolutions) in Maya for model presentation/rendering which is different from the manufacturing CAD models. For the LEGO movies, animallogic is using its own library.

Edited by Scrubs

Share this post


Link to post
Share on other sites
4 hours ago, M2m said:

For us hobbyists I however see a direct LDD - OBJ exporter could be useful to provide more flexibility and choice when it comes to rendering.

But that would require for LEGO to release their parts library under an Open Source license, which no doubt is the main hiccup here. So unless their position on this matter changes and they also proactively maintain the library to always include the latest new parts, the wole thing remains somehwat dubious.

Mylenium

Share this post


Link to post
Share on other sites
11 minutes ago, Mylenium said:

But that would require for LEGO to release their parts library under an Open Source license, which no doubt is the main hiccup here. So unless their position on this matter changes and they also proactively maintain the library to always include the latest new parts, the wole thing remains somehwat dubious.

Mylenium

In 2012 the European Court of Justice ruled that “copyright protection does not extend to the software functionality, the programming language used and the format of the data files used by the program...” (https://en.m.wikipedia.org/wiki/SAS_Institute_Inc_v_World_Programming_Ltd?wprov=sfti1) I guess using data files of LDD is in line with the courts rule. 

As of the EULA of LDD it is governed by Danish Law so I expect the EU Court is relevant (as long as there is no DEXIT at least :wink: )

Edited by M2m

Share this post


Link to post
Share on other sites
30 minutes ago, M2m said:

As of the EULA of LDD it is governed by Danish Law so I expect the EU Court is relevant (as long as there is no DEXIT at least :wink: )

But then the design of the parts themselves still falls under IP rights and suddenly none of that matters. That's ultimately the point. Sorry to pee on your lawn, but it's not about the software side of things. That aside, they could still file each of their their designs as trademarks or file their stuff outside the EU plus competing legal claims would still apply. In the end people outside the EU might be unable to use the software legally, even if you were to enforce the alleged "it's just data" claim (through which any judge with half a brain will shoot a hole, see above) and create a precedent. You need to look at the bigger picture here. It's a lot more complicated. Unless LEGO proactively fully waive any of their claims, including secondary and so on use cases, this can't be pinned on this regulation, at least not in a way that would achieve what's at the heart of it - the full release of the model files as public domain/ open source.

Mylenium

Share this post


Link to post
Share on other sites

I don’t challenge that the design of bricks is IP, but using them to render creations is as dubious as rebuilding full sets in LDD (sets are certainly also IP) or taking screenshots of LDD or its parts (or any other program if it really matters). Anyway I guess we can agree on our disagreement. 

Share this post


Link to post
Share on other sites

Didn't know I was going to start such a discussion. I'll expand my request with details.

I use a terrain generator galled Terragen. It imports object files in two formats.

Wavefront (.obj)

Lightwave (.lwo)

I am looking for a tool to take a completed model from stud.io (exported in any of stud.io's export formats) and convert it into one of the two formats above. If it is at all possible. If I am able it will allow me to bypass using Blender.

Share this post


Link to post
Share on other sites

There used to be a LDD to LWO converter. And I am personally working on LXF (LDD) to OBJ converter which I can however only test once I am back at my computer at home. 

PS: don’t worry about the ‘heated’ discussion. 

Edited by M2m

Share this post


Link to post
Share on other sites
2 hours ago, knotian said:

I am looking for a tool to take a completed model from stud.io (exported in any of stud.io's export formats) and convert it into one of the two formats above. If it is at all possible. If I am able it will allow me to bypass using Blender.

And the other way around?  Converting your generated landscape into a custom Studio part.

Well, okay, Studio is a resource hog…

 

12 hours ago, M2m said:

Don’t think it’s necessary to remove invisible sides. LDD doesn’t do that […]

LDD at least removes connected studs and simplifies the bottoms too (put enough round plates under any brick and you’ll see the brick “fillled”).

Share this post


Link to post
Share on other sites
8 hours ago, SylvainLS said:

LDD at least removes connected studs and simplifies the bottoms too (put enough round plates under any brick and you’ll see the brick “fillled”).

True. That’s in the viewer. I am however sure that other commercial 3D applications also have viewport optimizations. 

Share this post


Link to post
Share on other sites

I've found a way to convert Lego bricks to obj.

Stud.io has an extension called part designer, which is used to make your own custom Lego bricks. But it also has a feature to import and export obj files.

You can't convert your whole build in one go but you can convert individual bricks, import them into your 3d software, and rig the build there

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.