Search the Community
Showing results for tags '3dxml'.
Found 1 result
jamesster posted a topic in LEGO Digital Designer and other digital tools3DVIA Printscreen can capture LEGO Digital Designer models and save them as 3DXML files. It was discontinued years ago, but can still be downloaded from the web archives (direct installer link). Not many programs can load 3DXML files, so I made a program to convert them to OBJ. It does some other helpful things too. Download The resulting models are far more optimized for realtime rendering (games, AR, etc) than exports from other LEGO building software, thanks to LDD's hidden stud/tube removal. For example, a small house model that's 50350 tris exported from LeoCAD is only 13548 tris with this method - and with some additional tricks, only 2586 tris. More info here. I've only made this to work with LDD captures, compatibility with captures from other programs is not guaranteed. It will automatically name materials and textures with their official LEGO names/IDs. Setup: 3DVIA Printscreen should be configured so "Capture of textures" is on, and "Group by textures" is off. LDD should have high-quality rendering options disabled. 3DVIA Printscreen must be launched BEFORE LDD. Usage: Save your LDD model in 3DXML to OBJ's "Models" folder. Launch 3DXML to OBJ and enter your LDD model name in the first text box, then click "Move camera". This saves a new LDD model with the camera set in the proper position for 3DXML capturing. Open the new LDD model (it will have CAM_SET in the name) and capture it to a 3DXML file with 3DVIA Printscreen. Make sure it's saved in 3DXML to OBJ's "Models" folder, like the LDD models. Enter the name of your 3DXML file into the second text box in 3DXML to OBJ. I recommend leaving "Weld duplicate vertices" enabled. Choose a new color palette if you'd like, and click "Convert". It sounds more complicated than it is. Here's a model being converted and imported into Unity: And now, the advanced features, which are mostly for LEGO Universe-style color variation, but keep reading for some geometry removal tricks too. For color variation, we need to randomly adjust the color of each brick... But, LDD often batches bricks of the same color together into one mesh. Thus, we can't do it after capturing a model. We have to have the randomized colors displayed in LDD itself. So, it's LDD modding time! Setting up color variation: Download this LIF Extractor. Extract db.lif, found at C:\Users\YOURNAMEHERE\AppData\Roaming\LEGO Company\LEGO Digital Designer Put the resulting db folder where the original db.lif file was, and rename db.lif to something else so LDD will use your extracted data instead of the original file. Inside your db folder is Materials.xml. Put a copy of it in the same folder as the 3DXML to OBJ EXE. Launch 3DXML to OBJ and click the "Advanced" button. In the "Edit Materials.xml" box, choose what changes to make. You can add color variation and also apply changes to the base color palette. Click "Edit" and it will create a new XML file. Now you'll want to update the program's own internal color definitions. Enter the name of the XML file you just created in the box below, and click "Update color definitions". Replace LDD's Materials.xml with your new version. Again, this all sounds more complicated than it is. There's a video further below showing how it's done. Adding color variation to LDD models is simple enough; in advanced mode there's an option for it in the same box where you set the camera position in your LDD model. Just choose how strong you want the variation to be. I strongly recommend converting all the materials to vertex colors for models with color variation. How you do this will depend on what software you prefer; in the video below I'm using Ultimate Unwrap 3D. There's one more advanced feature: You can keep meshes of certain colors from receiving color variation and/or being exported. This is useful for "dummy bricks" only placed in the model to trip LDD's hidden geometry removal. In 3DXML to OBJ_Data\StreamingAssets, you will find "Color Export Exclusion.txt" and "Color Variation Exclusion.txt". Add the desired color IDs here, one per line. Covering studs is obvious enough, but tubes are a bit more finicky. Original LDD model, vs export with the dummy bricks excluded: A simple brick has the entire underside present. These quickly add up to loads of polygons. Placing 1x1 round plates across the surface causes LDD to replace the underside with two triangles. Nice! There's a small handful of other parts with this effect, but 1x1 round plates are the best. In fact, even just one 1x1 round plate can trigger this so long as the rest is still covered. Covering the bottom entirely will cause LDD remove it 100%. Beware: Some bricks, like those rounded 2x2 pieces, will look like they have the same effect as 1x1 round plates, but actually don't... They still leave much of the tubes intact. This trick is how I got that house with 13548 tris down to only 2586 tris - simply by capping off the bottoms of the roof and walls. And finally, here's a video showing all of the advanced features, if the text wasn't clear enough: More tips and tricks! If 3DVIA Printscreen is causing LDD to freeze and/or not launch, see this post. If you have developer mode enabled in LDD, you can press Shift W to toggle wireframe mode. You can also turn rendering of different parts of bricks on and off. LDD's bricks come in four sections, and can be toggled as such: K: Toggles studs Shift K: Toggles bottom and inside of tubes Q: Toggles outside of brick Shift Q: Toggles bottom and inside of brick You can use this to, for example, capture a model without studs, and use that as a lower LOD. Don't have developer mode enabled? Go to the same AppData folder as db.lif and developermode=1 to preferences.ini. If you've modded LDD's decorations, or LDD has updated, you can update 3DXML to OBJ's internal texture definitions - just copy the Decorations folder from db to the same folder as 3DXML to OBJ's EXE, and click the button for it in advanced mode. (In case you're curious what this does: The program keeps a list of MD5 hashes of texture data, along side their file names/IDs. This allows the program to identify what textures are what in a 3DXML file, without actually containing any of the texture data itself.) You can add your own custom color palettes, just go to 3DXML to OBJ_Data\StreamingAssets\Custom Palettes and use the existing files as examples of how they work. If for some reason you need to, Shift R resets 3DXML to OBJ's saved preferences (resolution, most recent conversion options, etc). Replacing colors when converting a 3DXML with color variation will work... But look very strange, as it'll only affect bricks that happen to be the original color values. The ones that have been slightly lightened or darkened won't be changed. You can mod lower LODs of bricks from LU into LDD... But that'd be its own topic.