Skip to content

ScanMountGoat/ldr_tools_blender

Repository files navigation

ldr_tools_blender GitHub release (latest by date including pre-releases)

falcon render

Cycles render of 10179-1 Millennium Falcon UCS (LDraw OMR)

An addon for importing LDraw files into Blender 4.1. Check out discussions for reading announcements, asking questions, or suggesting new features. Report bugs or request new features in issues. Download the latest version from releases.

Features

The goal of this project is to provided a reliable and performant way to import digital LEGO models into modern versions of Blender for rendering. This includes importing and rendering Bricklink Studio models or models built with LDraw editing programs. Studio models should be exported as LDraw under File > Export As in Studio before importing into Blender.

  • Compatible with LDR and MPD files. If you have a file that doesn't open correctly or an LDraw extension you'd like supported, please report it in issues.
  • Easily load LEGO models with hundreds of thousands of parts. For extremely large scenes, see performance.
  • Create photorealistc renders taking full advantage of Blender Cycles with automatically created PBR materials with accurate colors and procedurally generated surface detail.

Getting Started

  1. Install the LDraw parts library if you haven't already. Bricklink Studio bundles its own LDraw library and should be detected automatically by the addon.
  2. Download the appropriate version of the addon for your system from releases. For older Blender versions, download one of the previous releases.
  3. In Blender, navigate to Edit > Preferences > Addon and click Install. Select the zip downloaded in step 2. Do not extract the zip file!
  4. The addons menu should now allow you to check the ldr_tools_blender addon to enable it.
  5. Import an LDraw model into Blender by clicking File > Import > LDraw and selecting a .mpd or .ldr file.

Uninstalling/Upgrading

Upgrading the addon requires uninstalling the addon, downloading the latest version from releases, and then reinstalling the addon. On some operating systems, it may be necessary to disable the addon, restart Blender, and then uninstall the addon. This workaround is only be necessary on Windows.

Performance

This project is built from the ground up with performance in mind. The ldr_tools_blender addon can easily handle very large models with hundreds of thousands of parts. The addon will always instance geometry by part name and color to reduce memory usage and improve import times. Memory usage will be similar for both methods. Blender itself does not scale well with the number of objects created in the scene. For large scenes with more than 10000 parts, it's recommended to use "Geometry Nodes" as the instance type before importing. Geometry nodes make the individual objects harder to edit but avoids most of the Blender overhead for scenes with high object counts. For very large scenes that don't need to be rendered up close, setting the stud type to "Normal" to remove stud logos can greatly reduce memory usage and improve import times.

Projects

ldr_tools

A Rust library for working with LDraw files. This performs all the parsing and geometry handling. This project can be used in other Rust projects by adding the following line to the Cargo.toml. ldr_tools is used for loading models in the ldr_wgpu renderer.

ldr_tools = { git = "https://github.com/ScanMountGoat/ldr_tools_blender" }

ldr_tools_py

Python bindings to ldr_tools using PyO3. This enables ldr_tools to be usable in Blender. ldr_tools_py makes heavy use of numpy arrays to reduce the overhead for converting data from Rust to Python to Blender.

ldr_tools_blender

The Blender addon for importing LDraw files making use of ldr_tools_py. This is not a pure Python project. See the building instructions for details on how to build this from source.

Building

The easiest way to see the steps used to create a new release is to check the release.yaml script that runs using Github actions. See development for working on your personal machine. See contributing for contributing to this project. Make sure to set the Python interpreter using the PYO3_PYTHON environment variable to Blender's Python binary or one with the same version!

Copyrights

LDraw™ is a trademark owned and licensed by the Jessiman Estate, which does not sponsor, endorse, or authorize this project.

LEGO® is a registered trademark of the LEGO Group, which does not sponsor, endorse, or authorize this project.