LDD2LDraw - a working LDD mesh converter


LDD2LDraw - a working LDD mesh converter
#1
Hi,
based on this brick viewer, I have written a converter, that creates LDraw files from LDD mesh files (*.g).
I've solved the problem of the files with the g1, g2, etc. extensions. These are subparts for a model, that are colored differently or textured. My converter can merge these into a single file.
I've attached an example of a part, that was originally split into two.

If there's enogh interest, I'm willing to upload the sources to Github and create a somewhat user friendly version (currently it's a command line tool.)

Greetings

Banbury


Attached Files
.dat   part.dat (Size: 130.03 KB / Downloads: 0)
Reply
Re: LDD2LDraw - a working LDD mesh converter
#2
Looks great. More tools equals better parts so I, for one, would like to see you open the source.
Reply
Re: LDD2LDraw - a working LDD mesh converter
#3
Bring it on! Heer is someone who want's to have a look at a very, very user friendly version.

w.
LEGO ergo sum
Reply
Re: LDD2LDraw - a working LDD mesh converter
#4
Here is a sample of the parts I converted so far.


Attached Files Thumbnail(s)
   
Reply
Re: LDD2LDraw - a working LDD mesh converter
#5
Have you looked at the possibility to generate edge lines? 3dxml2dat is able to to that, and generating them only from facet angle difference (as does Edger2) is far from optimal...
Reply
Re: LDD2LDraw - a working LDD mesh converter
#6
I've already discovered Edger2 on my own. The really interesting parts have very high face counts. Creating the lines manually would be prohibitive.
I'm looking into porting the edge creating algorithm to Java for inclusion into my own program. Do you know of a better way to create the lines than Edger does?
Reply
Re: LDD2LDraw - a working LDD mesh converter
#7
As explained by Rolf, on each triangle LDD has information about normal at each vertex. If the normals are the same on matching vertices of two triangles, then a condline should be set. If the normals are different, then it's considered a sharp edge (independantly of facet angle) and a normal edge line should be set.
Quote:Creating the lines manually would be prohibitive.
Even using Edger2 automatic generation, there's still a LOT of manual work to do to sort out things between lines and condlines.
Reply
Re: LDD2LDraw - a working LDD mesh converter
#8
Philippe Hurbain Wrote:Even using Edger2 automatic generation, there's still a LOT of manual work to do to sort out things between lines and condlines.
But that's work someone else will have to do. I plan to use these parts in Blender. So I don't need the lines.
Reply
Re: LDD2LDraw - a working LDD mesh converter
#9
With the rather sparse interest in my converter, I have decided to forgo a release for the time being. (It's quite some work to create a release.)
Instead I'm going to convert all the LDD parts, that LDraw is missing. As a first step I have created a list of all LDD parts and (if applicable) their corresponding LDraw name. I have attached the file to this post.
Please note that the list contains some duplicates, since LDD has combined some parts into assemblies. There's an alias column that lists the original part number.
With over 1000 LDD parts to convert, there's no way to manually edit and correct every part. I will convert the files and create the edges with Edger2. I think that's still better than no parts.

PS: If someone wants just the source code, I will zip it and provide a download.


Attached Files
.zip   lddparts.zip (Size: 78.53 KB / Downloads: 3)
Reply
Re: LDD2LDraw - a working LDD mesh converter
#10
Pardon me if I'm being blunt, but the low interest in your converter might come from the fact that what you are doing has allready been done.

Please have a look at Rolf Osterthuns site, digital-bricks.de

What we need is more part authors that are willing to adapt the meshes to Ldraw standards.
Please read this thread

But if you want to convert them all again, as an exercise or learning experience, go ahead.
Reply
Re: LDD2LDraw - a working LDD mesh converter
#11
Allow me to be blunt, too.
I had a look at digital-bricks before creating my own converter. Nowhere on this page is any mention, that they have a mesh converter. Nor have I found any downloads for any converted parts. I'm a programmer, not a mind reader.
I'm not interested in doing any work, that already has been done. So if you can point me to a download, I will stop my own conversion effort.
Honestly I don't care one bit about LDraw's standards. They are literally from a different century. All I'm interested in are meshes, that I can use for rendering in Blender.
Reply
Re: LDD2LDraw - a working LDD mesh converter
#12
Earnest J. Banbury Wrote:Instead I'm going to convert all the LDD parts, that LDraw is missing.

This hasn't worked well for the so called L(EGO)Draw parts:

http://news.lugnet.com/cad/?n=17344

and won't work for yours. There are still plenty parts left we've got FOUR years ago as you can see here:

http://wiki.ldraw.org/index.php?title=L%...arts_Chart

For some strange reasons people prefer picking LDD data one by one and do the conversation by themselves, second the time you have to invest to maintain a second database is better invested in authoring. Third, it's not that your converter is just perfect on the first try as the missing cond. lines show. Sometimes the best input comes from the outside and boosts the thing to a new level.

I really wish I could try it out myself instead of being presented with tons of parts data.

w.
LEGO ergo sum
Reply
Re: LDD2LDraw - a working LDD mesh converter
#13
Hey Mr. Banbury,

you are absolutely right, when you point to the fact, that the parts on our webpage are not that easy to find. I am sorry for that.

The parts that we make available for download are extractions from the LDD. They should support LDraw part autors to create new LDraw parts. It is not recommended to use them in any models. And this mainly for one reason: most of them have a not LDraw like origin.

They are intended for part authors. And I believe that the most part authors read along in this forum. In addition, these parts have been created specially for LDraw. Our goal in the creation were LDraw compatible files. But you are welcome to use them as you like.

In the mentioned webpage you will find an overview of the categories that are used in the LDD. When you click on one of the categories, you get to a page (e.g. FIGURE, HEAD CLOTHING) where all the parts of this category are listed. If there is a part not yet available in LDraw, we offer it for download (e.g. TWILEK HEADPIECE).

Rolf
Reply
Re: LDD2LDraw - a working LDD mesh converter
#14
Quote:For some strange reasons people prefer picking LDD data one by one and do the conversation by themselves
A single place to look at, all potentially available parts are there.
Reply
Re: LDD2LDraw - a working LDD mesh converter
#15
Downloading parts one file at a time isn't exactly convenient. And even a cursory look shows, that you're missing lots of parts.
I'm not trying to malign your work. It's just, that I want all the parts in LDD. And I'm not too concerned with lines and pivots.
Reply
Re: LDD2LDraw - a working LDD mesh converter
#16
I just converted about 1200 files from LDD. They're not perfect, but they suit my needs just fine.
Are your 'batches' different from what's included in LDD. If yes, I would be interested. Is there a download for the complete packages?
Reply
Re: LDD2LDraw - a working LDD mesh converter
#17
Sure:

http://www.holly-wood.it/tmp/LU_DAT.zip

w.
LEGO ergo sum
Reply
Re: LDD2LDraw - a working LDD mesh converter
#18
Thanks! I'm curious if there's anything in there, that LDD hasn't.
Reply
Re: LDD2LDraw - a working LDD mesh converter
#19
Hey,

Earnest J. Banbury Wrote:Downloading parts one file at a time isn't exactly convenient.

That is true. This is on purpose.

Earnest J. Banbury Wrote:And even a cursory look shows, that you're missing lots of parts.
We only make that parts avalable for download, that does not exist in the official LDraw library (or on the parts tracker). The reason behind our conversion was to support LDraw.

Earnest J. Banbury Wrote:It's just, that I want all the parts in LDD.

That is absolutely understandable. So our supply does not match your demand.

Earnest J. Banbury Wrote:And I'm not too concerned with lines and pivots.
Yes, I got that. But are you interested in the normals?


.png   87571n.png (Size: 44.94 KB / Downloads: 48)

You are planning to use these parts in Blender? Wouldn't it be better to convert the LDD parts directly to a format like .obj (etc.)?

Rolf
Reply
Re: LDD2LDraw - a working LDD mesh converter
#20
Frightening mutated cactus ;D
Reply
Re: LDD2LDraw - a working LDD mesh converter
#21
Rolf Osterthun Wrote:That is absolutely understandable. So our supply does not match your demand.
I noticed that. That's why I made my own conversion.


Rolf Osterthun Wrote:You are planning to use these parts in Blender? Wouldn't it be better to convert the LDD parts directly to a format like .obj (etc.)?
I'm considering it. I can already read the normals. I'm almost certain, that I know where the UV coordinates are. So if I create a OBJ converter, I will generate textured parts.
But MLCad is still the best editor for Lego IMO. And converting to LDraw is easier than converting to OBJ. And I already have a LDraw importer for Blender.
Reply
Re: LDD2LDraw - a working LDD mesh converter
#22
Rolf Osterthun Wrote:[attachment=1229]

Just out of curiosity, why doesn't the lighting match the drawn normals? (As far as I can tell, the drawn normals appear to indicate what should be a smooth-shaded surface, but the lighting indicates flat shading.)
Reply
Re: LDD2LDraw - a working LDD mesh converter
#23
Hey Travis,

the image was generated with LDView 4.1. Its source is a LDraw file, which contains only lines and triangles. The tools I use have command line arguments, that influence the output.

If I generate the optional lines the result would look like this:


.png   87571nwo.png (Size: 53.94 KB / Downloads: 49)
Code:
Copied 1158 triangles, 296 lines and 891 normals; generated 1453 optional lines

Rolf
Reply
Re: LDD2LDraw - a working LDD mesh converter
#24
Hey,

Earnest J. Banbury Wrote:And converting to LDraw is easier than converting to OBJ.

Well, this is something I did not expect...

Earnest J. Banbury Wrote:And I already have a LDraw importer for Blender.
I do not want to bother you but I find it really interesting: You are going to generate a complete new LDraw compatible library based on the parts from the LDD? And with this generated parts (only triangles; no lines) you will build LEGO models in MLCad to import them into Blender? How does the importer for Blender detect the sharp edges? Or otherwise: how does it calculate the normals?

Rolf
Reply
Re: LDD2LDraw - a working LDD mesh converter
#25
Blender is very good at this kind of stuff Smile. The importer calculates the normals (by calling a Blender function), then it adds a so called modifier, that changes the normals based on the angle of neighbouring faces. Everything that's beyond a certain threshold is rendered with a sharp corner. That works pretty well. Lego pieces have a lot of sharp corners. So for most parts the results are very good.
I've attached an example, so you can see for yourself.
The importer can be downloaded here.


Attached Files Thumbnail(s)
   
Reply
Re: LDD2LDraw - a working LDD mesh converter
#26
This will work for most parts but there are lots of parts that have sharp edges under low angles (e.g. the low angle slopes)

I discovered that when I added smoothing to my LDCad editor, so using the edges during conversion is very important if you want to create hq/reallife renderings.

But given you only want to use it in blender, maybe you should also invest in converting the ldd data directly to blender (I'm guessing the ldd data has normals), then using the ldraw conversion draw your model, but use the blender objects for the final rendering (1 on 1 part mapping using the ldr).

Just my 2cts
Reply
Re: LDD2LDraw - a working LDD mesh converter
#27
Roland Melkert Wrote:This will work for most parts but there are lots of parts that have sharp edges under low angles (e.g. the low angle slopes)

I discovered that when I added smoothing to my LDCad editor, so using the edges during conversion is very important if you want to create hq/reallife renderings.

But given you only want to use it in blender, maybe you should also invest in converting the ldd data directly to blender (I'm guessing the ldd data has normals), then using the ldraw conversion draw your model, but use the blender objects for the final rendering (1 on 1 part mapping using the ldr).

Just my 2cts
I do intend to. (see above) But one thing at a time.
Right now I'm quite pleased with the quality of my renderings. The main problem regarding realism is the perfect fit of the bricks anyway. But photorealism isn't really my goal.
Reply
RE: LDD2LDraw - a working LDD mesh converter
#28
(2014-05-26, 21:47)Earnest J. Banbury Wrote: Thanks! I'm curious if there's anything in there, that LDD hasn't.

There shouldn't be.  It came from LDD originally.  At least, the final batch or two did.

    -- joshua
Reply
« Next Oldest | Next Newest »



Forum Jump:


Users browsing this thread: 1 Guest(s)