Jump to content

GDB to PLY converter


grappigegovert
 Share

Recommended Posts

grappigegovert

With the recent topics on the GDB format, I decided to remake an old GDB to PLY converter I had laying around.
So here it is!
It saves a ply file including texture coordinates and vertex colors.
Update 2019-03-11 (v3) :
- Now has an option to create a ply file per material.
It names the output file as <file>_<materialname>.ply
Most material names are exactly the same as the name of the texture they use, but not all. You can check that in the MDB file.

- This version also includes a half-finished ply->gdb converter which was apparently still in the code that I'd never released.

It probably only works with small or really specific meshes. (Or not at all, I didn't test it :D)

Update 2015-05-08 (v2?) :
New version!
-Now uses WillKirkby's LibLR to read GDB files.
-Messed up polygons fixed thanks to Sluicer's research!


Download:

Thanks to WillKirkby for the binary file reader, this wouldn't be possible without it.

TSTK.gdb imported into blender:

large.untitled.png.b5a2e43b1cccb7a2bc2a6
 

Yes, I plan on making ply to gdb too.

Edited by grappigegovert
New version
Link to comment
Share on other sites

ProfessorBrickkeeper

You had me at vertex colors.

The preservation of texture coordinates should also save those of us who enjoy creating custom textures some time, as we can just test them out on the extracted models in various 3D programs, as supposed to having to go through the tedious process of decompiling, recompiling, and replacing LEGO.JAM every time we have to make a slight texture tweak and wish to see it on one of the models.

Thanks a ton!

Link to comment
Share on other sites

Awesome! I already looked into this, I saw that ply was somewhat similar to gdb.

But I did not know what to do to get it working.

Now onto the ply to gdb! :P

Link to comment
Share on other sites

Woohoooo!

 

I'm looking forward to your reverse converter if you get around to it, that would be so awesome. Hopefully LEGO Racers can handle the number of polygons made possible with more modern 3D tools/PCs.

 

A little off-topic-on-topic, but is it relatively easy to import LDD models to Blender? If so then you, sir, deserve a medal. Not that you don't already. ;)

Link to comment
Share on other sites

Refresh my memory, UV maps are located where, again?

@JJ Yes, Blender is possible. I'm thinking it is a standard I/O plugin, not 100% sure.

Link to comment
Share on other sites

I think this is a tutorial on how to get ldd pieces to ply:

http://www.youtube.com/watch?v=TaOeQpQMUQo

 

Refresh my memory, UV maps are located where, again?
 

When I understood your question properly, the tracks' GDB files are saved in GAMEDATA**Racefolder**

It is usually the biggest GDB file in there.

Link to comment
Share on other sites

I think this is a tutorial on how to get ldd pieces to ply:

 

You are partly right. During the conversion from the LDD to .ldr format, the library changes. Not all parts might by exported. When you export the .ldr file with LeoCad to .obj files, you use the LDraw library not the LDD files. At least this is no big issue - but I want to mention it.

Link to comment
Share on other sites

As far as I know the LDraw library is nearly the same as the LDD library, only bigger (so, even more parts that LDD hasn't)... but I'm not 100% sure about that.

Link to comment
Share on other sites

ProfessorBrickkeeper

In response to some of the thoughts posted up above, although higher maintenance, I would suggest using the LDD .lif extractor/brick geometry to .obj converter posted awhile ago somewhere on RRU and then importing the .obj bricks into a 3d program and rebuilding and optimizing the creation in there if you want models with more accurate geometry than the LDraw one.

 

Alternatively, you could use the new .obj exporter functionality on www.mecabricks.com (It does require a free account, though). While the library is certainly smaller than the LDraw and LDD libraries, it is a nice alternative as far as functionality and ease of use goes.

 

By the way, does anybody know of a .ply importer/exporter for Maya 2014 (Mac)? It's quite an annoying process otherwise. (.ply=>.blend=>.dae=>.mb/.mb=>.dae=>.blend=>.ply)

Link to comment
Share on other sites

As far as I know the LDraw library is nearly the same as the LDD library, only bigger (so, even more parts that LDD hasn't)... but I'm not 100% sure about that.

I think there is a huge gap between the two libraries. The LDD has more of the newer parts and LDraw has more of the older parts. But there is still a big amout of parts in both libraries. And, in LDraw you can create your own parts/ modifiy existing parts.

 

In response to some of the thoughts posted up above

My thoughts: I think that the LDD is a very mighty tool. With digital Lego you have always a big issue: the great amout of studs and the inside of parts. They eat performance. Even when they are inside another part. The LDD has some kind of technic to detect this unseeable vertices and removes a big amount of them. So that would be a good start for a resource for a computer game.

 

But this is only possible if you build a model with the LDD and use a 3D screen capture tool (I think that is the name). The LDD will remove the most of the unseeable vertices for you.

Link to comment
Share on other sites

The LDD has some kind of technic to detect this unseeable vertices and removes a big amount of them.

I would like to visualize that:

 

EZdhTgY.jpg

 

Left would be the result with .lxf file and .g files. Right would be the result with screen capturing (when the parts would not be transparent). 544 vs. 166 triangles.

Link to comment
Share on other sites

ProfessorBrickkeeper

I finally got to try out the converter, and it is pretty nice considering the fact that there was not much in the way of testing. I do, however, have some bugs to report and some suggestions to make. The main one I encountered was where the program would give an error around the lines of "The conversion process cannot be completed. Click enter or cancel." when converting certain tracks (such as the Knightmare-A-Thon). The conversion process would then stop and go back to the main menu. Another error I encounter was when trying to import the .ply models into Blender, I would receive an error about the properties in certain .ply files being invalid, and the importing process would quit. Enough of the criticisms, though.

Some features and improvements I would suggest for the next version would be keeping the models in the separate mesh subsections for the easy application of materials and textures to the different meshes. Another suggestion would be for the support of animated models such as minifigures, which do not currently import. Oh, and one last thing, some of the polygons making the models suffer from some slight deformation, with some polygon vertexes shifting positions during the conversion process.

Anyway, I cannot wait to see where this tool goes!

Link to comment
Share on other sites

  • 6 months later...
grappigegovert

New version!
The program now uses LibLR for reading GDB files (Thanks WillKirkby!) (I don't know if it's okay to include the dll?)
Thanks to Sluicer's new information about the GDB files, it does no longer produce ply files with wrong polygons.

Also, I would like to note that this solution with PLY files is not ideal, because it can't save all data in a GDB file.
This means I may not finish the GDB writing part of this application.
I think the best solution would be either an importer for a popular 3d-editing program, or a dedicated program for editing GDB files directly.

Link to comment
Share on other sites

@grappigegovert: Nice! Yes, if not all data can be saved into a GDB file, models would easily get messed up, I'm aware of that. When creating an GDB importer for, ehm, let's say Blender, eventually you'd want to create an exporter as well for saving files in GDB format which might give you the exact same data problem. On the other hand, creating a dedicated program for editing GDB files directly sounds really cool and might even be possible, but it will take some time to create it.

I'm curious of what the current knowledge concering GDB will bring us. Thanks for the new version, gonna try it out.

Link to comment
Share on other sites

  • 1 year later...
  • 2 months later...
On October 26, 2014 at 11:24 AM, JimbobJeffers said:

Woohoooo!

 

I'm looking forward to your reverse converter if you get around to it, that would be so awesome. Hopefully LEGO Racers can handle the number of polygons made possible with more modern 3D tools/PCs.

 

A little off-topic-on-topic, but is it relatively easy to import LDD models to Blender? If so then you, sir, deserve a medal. Not that you don't already. ;)

Here are the converted models and sounds from Lego Racers 1.

Link: https://mega.nz/#!L1QCnCDb!kY7GT2rk3C_oDzhV82SWo3LKbSzvkLJeLO6WPdlck8c

Link to comment
Share on other sites

grappigegovert

As per @mumboking's request, the converter now includes an option to export 1 ply file per material, to make adding the textures easier.
Download link in the OP.

Link to comment
Share on other sites

Fluffy Cupcake
On 10/25/2014 at 7:37 PM, grappigegovert said:

- This version also includes a half-finished ply->gdb converter which was apparently still in the code that I'd never released.

It probably only works with small or really specific meshes. (Or not at all, I didn't test it :D) 

:gasp: - got any plans to throw time at improving this any time soon?

Link to comment
Share on other sites

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.