Blender LDraw import tool


Blender LDraw import tool
#1
I just came across this Blender LDraw importer on Github: https://github.com/TobyLobster/ImportLDraw

I didn't know that one existed, I only knew of another one that only supported ldr files (and hasn't been updated in a while). This one however, supports dat, ldr and mpd files and seems to be relatively active too. It also has two modes: realistic and 'instruction style', which is a nice plus too.

I'm by far not a Blender expert, but I very quickly tried it on a small mpd file and the realistic mode produces quite a nice image without any tinkering (I just imported the model and pressed render). It's by far not as realistic as those Blender renders from Mecabricks, but pretty nice nonetheless  Smile


And just to make it extra clear: I'm not the author of this tool, just figured I'd share it here because I hadn't seen it here before (correct me if I'm wrong).
Reply
RE: Blender LDraw import tool
#2
wow, thank you very much for this hint!
especially the "instructions mode" looks very cool!

the only thing that I immediately noticed in the example pictures was the lack of a "primitives substitution" mode -
round cylinders look very polygonal there.

I'll happily try this out, it looks very nice and the readme.md looks very carefully written

thanks!
Smile  Smile  Smile
Reply
RE: Blender LDraw import tool
#3
(2018-03-31, 8:45)Steffen Wrote: wow, thank you very much for this hint!
especially the "instructions mode" looks very cool!

the only thing that I immediately noticed in the example pictures was the lack of a "primitives substitution" mode -
round cylinders look very polygonal there.

I'll happily try this out, it looks very nice and the readme.md looks very carefully written

thanks!
Smile  Smile  Smile

There are a whole bunch of import options, one of which is a selection between 'Standard primitives', 'High resolution primitives' and 'Low resolution primitives'. Maybe the example image didn't use the high resolution ones?

This is a test image I rendered this morning: https://i.imgur.com/Ko95dLk.png
Like I said, it isn't perfect (especially the lighting on the top curves looks a bit weird), but it looks pretty nice nonetheless (imo), especially considering I have done absolutely nothing in Blender to enhance the render Smile
Reply
RE: Blender LDraw import tool
#4
I also tried this now Smile
I downloaded Blender 2.79b, installed that plugin and directly imported and rendered one of my 12V train test scenes,
without adjusting any settings manually:

[Image: blenderrender01.png]

I very, very much like this default result.
Rendering time was 30 minutes.
LEGO logos were turned off by default.
I notice something strange going on at the roof slopes.
The reflection there looks somehow weird.
But still: an amazing result.
Reply
RE: Blender LDraw import tool
#5
About the reflection on the slopes: I had a similar effect on (sloped) tiles. Under the import option, there's a setting called 'Use curved wall normals' which is on by default. If you turn this off, the reflections should look less weird.

The github page mentions the following about this setting:

Quote:
  • Concave walls - Optionally look as if each brick has very slightly concave walls (with the photorealistic renderer), which affects the look of light reflections.

And the idea is nice, but when parts are in a certain angle to the lighting it creates this weird effect.
Reply
RE: Blender LDraw import tool
#6
Interesting, but doesn't work very well for me... Using all default options, it took 45 minutes to generate this... mainly magenta image (here I post only a thumbnail, initial image was 1920x1080). Looking at it in Photoshop, the green layer is completely black, explaining the magenta hue. I then tried to change renderer from "cycles" to "blender render" and this time got a B/W shadow image (in a few seconds). And I found no way to change the viewpoint (camera position). I guess I'll find it easily in some tutorial, but I would have thought that it would be easier to find. I HATE Blender UI...

If someone has an idea about the weird colors I get...


Attached Files
.png   bd2.png (Size: 102.04 KB / Downloads: 270)
.png   bd3.png (Size: 15.53 KB / Downloads: 269)
Reply
RE: Blender LDraw import tool
#7
No idea what the problem could be, but I would think it has more to do with Blender itself than the import tool. Did you freshly install Blender? Maybe remove all (previous) settings? I'm not a big fan of the Blender UI either.


I just did a new test, this time at a higher (4K) resolution: https://i.imgur.com/NFyP0eA.png

I disabled the concave walls and enabled the brick seams. Looks pretty nice, although the lever parts look a bit rough. One halve is smooth and the other halve still has visible polygons, which creates a very weird look. And I think I have to slighly lower the brick seams.
Reply
RE: Blender LDraw import tool
#8
(2018-03-31, 18:26)Merlijn Wissink Wrote: No idea what the problem could be, but I would think it has more to do with Blender itself than the import tool. Did you freshly install Blender? Maybe remove all (previous) settings? I'm not a big fan of the Blender UI either.
I did an uninstall (as thorough as possible), reinstalled 2.79b... result is still the same. Only improvement: I managed to change viewpoint!


Attached Files Thumbnail(s)
   
Reply
RE: Blender LDraw import tool
#9
(2018-04-01, 8:21)Philippe Hurbain Wrote:
(2018-03-31, 18:26)Merlijn Wissink Wrote: No idea what the problem could be, but I would think it has more to do with Blender itself than the import tool. Did you freshly install Blender? Maybe remove all (previous) settings? I'm not a big fan of the Blender UI either.
I did an uninstall (as thorough as possible), reinstalled 2.79b... result is still the same. Only improvement:  I managed to change viewpoint!

Could also be a driver issue. Often graphics drivers have bugs that manifest as strange behavior in very specific circumstances, like with here. Are your drivers up to date?
Reply
RE: Blender LDraw import tool
#10
Quote:Could also be a driver issue. Often graphics drivers have bugs that manifest as strange behavior in very specific circumstances, like with here. Are your drivers up to date?
Not completely sure, but if I save the image and look at it with Photoshop, the green channel IS completely black. Why would this depend on graphics board?
Reply
RE: Blender LDraw import tool
#11
(2018-04-01, 14:03)Philippe Hurbain Wrote:
Quote:Could also be a driver issue. Often graphics drivers have bugs that manifest as strange behavior in very specific circumstances, like with here. Are your drivers up to date?
Not completely sure, but if I save the image and look at it with Photoshop, the green channel IS completely black. Why would this depend on graphics board?

I found by googling that apparently Blender can use the GPU for the rendering, not sure if it does it by default. I was wondering if the GPU manages to screw it up during the rendering phase.
Reply
RE: Blender LDraw import tool
#12
(2018-04-01, 14:10)Santeri Piippo Wrote: I found by googling that apparently Blender can use the GPU for the rendering, not sure if it does it by default. I was wondering if the GPU manages to screw it up during the rendering phase.
Interesting, but not this. Default compute device was CPU. Switching to GPU provides the same image.

Could it be a problem with the importer? If I try to render Blender default startup cube, I get a nice grey cube image, with green channel properly used!
Reply
RE: Blender LDraw import tool
#13
(2018-04-01, 14:47)Philippe Hurbain Wrote:
(2018-04-01, 14:10)Santeri Piippo Wrote: I found by googling that apparently Blender can use the GPU for the rendering, not sure if it does it by default. I was wondering if the GPU manages to screw it up during the rendering phase.
Interesting, but not this. Default compute device was CPU. Switching to GPU provides the same image.

Could it be a problem with the importer? If I try to render Blender default startup cube, I get a nice grey cube image, with green channel properly used!

Well, you could import a test LDraw file, then save the blender file and share it here so one of us could render the same file on our computer to see if something is wrong with the file  Smile

BTW: note that by default, selecting the gpu as renderer doesn't use the gpu as renderer. I was confused by this at first, but apparently you have to first select the device to use for the rendering, as can be read here: https://blender.stackexchange.com/a/73483
Reply
RE: Blender LDraw import tool
#14
(2018-03-31, 7:59)Merlijn Wissink Wrote: I just came across this Blender LDraw importer on Github: https://github.com/TobyLobster/ImportLDraw

I didn't know that one existed, I only knew of another one that only supported ldr files (and hasn't been updated in a while). This one however, supports dat, ldr and mpd files and seems to be relatively active too. It also has two modes: realistic and 'instruction style', which is a nice plus too.

I'm by far not a Blender expert, but I very quickly tried it on a small mpd file and the realistic mode produces quite a nice image without any tinkering (I just imported the model and pressed render). It's by far not as realistic as those Blender renders from Mecabricks, but pretty nice nonetheless  Smile


And just to make it extra clear: I'm not the author of this tool, just figured I'd share it here because I hadn't seen it here before (correct me if I'm wrong).

Thank for sharing this. I remember seeing something about a Blender import tool before, but your post has prompted me to try this out (I was getting very frustrated with my other Blender import method that goes via the LdrDat2Dxf tool).

I've just installed the Add-On and got this image using all the default settings - very impressed so far.
The MPD for this model can be found on this thread: https://forums.ldraw.org/thread-22295-post-26071.html


Attached Files Thumbnail(s)
   
Reply
RE: Blender LDraw import tool
#15
Going on investigations...
Marjorie.zip contains the .blend file that renders magenta on my machine.
I copied all objects and pasted them in default startup scene and rendered it. Clearly missing a lot of light, but at least the colors are right! (rendered with Blender and Cycles renderer). MarjorieOK.zip contains the .blend file of that version.


Attached Files Thumbnail(s)
       

.zip   marjorie.zip (Size: 339.76 KB / Downloads: 2)
.zip   marjorieOK.zip (Size: 323.02 KB / Downloads: 1)
Reply
RE: Blender LDraw import tool
#16
(1)
When rendering your marjorie.zip, I get the same magenta image as you.

(2)
When I download your original MPD file from
https://forums.ldraw.org/thread-15660-po...l#pid28420
, and import it myself into Blender, then I get a correct image.
I will attach the resulting *.blend file from that import to this post.

We should be able to find the problem by comparing these 2 separate Blender imports hopefully...

[Image: marjorie.png]


Attached Files
.zip   Steffen.zip (Size: 329.42 KB / Downloads: 2)
Reply
RE: Blender LDraw import tool
#17
Hmm... I can confirm your Marjorie.zip also renders with a magenta look on my machine.
However, when I import the .mpd file myself, I don't have any problems (see attached blender file). What import settings have you used exactly?

[Image: Kwb8L7O.png]


Attached Files
.zip   marjorie.zip (Size: 494.23 KB / Downloads: 1)
Reply
RE: Blender LDraw import tool
#18
(2018-03-31, 15:25)Merlijn Wissink Wrote: About the reflection on the slopes: I had a similar effect on (sloped) tiles. Under the import option, there's a setting called 'Use curved wall normals' which is on by default. If you turn this off, the reflections should look less weird.

Yes, this made the slopes problem go away:

[Image: blenderrender02.png]
Reply
RE: Blender LDraw import tool
#19
just for fun:
here is a render of the mouse in the "LEGO Instructions" look:

[Image: marjorie2.png]
Reply
RE: Blender LDraw import tool
#20
Now, matters are worse... when I open your .blend file it renders magenta!!!
Attached your blend file, just opened and saved on my machine...


Attached Files
.zip   Steffen2.zip (Size: 330.32 KB / Downloads: 1)
Reply
RE: Blender LDraw import tool
#21
Interesting - I imported mpd in this mode, and it renders fine...
Reply
RE: Blender LDraw import tool
#22
(2018-04-02, 15:28)Merlijn Wissink Wrote: What import settings have you used exactly?
Defaults ones... Worse, it seems that my machine "contaminates" files that worked fine on other's machines (see my answer to Steffen) Sad
Reply
RE: Blender LDraw import tool
#23
So this has to be somehow related to your user settings I fear.
Sadly, they are binary, so cannot be compared easily Sad

What about this option ("choose which channel to render")?

[Image: choose_blender_color_channel.png]

What is the status of these configuration buttons on your machine?

(Did I mention that I HATE the goddamn complicated Blender user interface??)
Reply
RE: Blender LDraw import tool
#24
(2018-04-02, 17:03)Steffen Wrote: (Did I mention that I HATE the goddamn complicated Blender user interface??)

I personally don't like it either. Although a while ago I followed a short beginner tutorial/course on Blender and after that the UI did make a lot more sense to me. But A) I forgot a lot of that over the months/years since I don't really use Blender and B) while the UI might be great for regular users, it's (in my opinion at least) a horrible experience for newcomers...
Reply
RE: Blender LDraw import tool
#25
(2018-04-02, 17:03)Steffen Wrote: What is the status of these configuration buttons on your machine?
I _think_ they control just what is displayed from rendered image and have no influence on the render process itself. Choosing the green channel diplays a black image
Quote:(Did I mention that I HATE the goddamn complicated Blender user interface??)
+1!!!
Quote:So this has to be somehow related to your user settings I fear.
Not so sure since when I copy paste the objects in another scene all channels are rendered...
Reply
RE: Blender LDraw import tool
#26
I installed Blender and the converter on another machine, and there it works better. I can get an image with "normal" colors when using the Cycles renderer. Unfortunately, the (faster) Blender renderer doesn't work better, providing a black shadow on grey background. Now I am not fully convinced that it is worth the trouble compared to POV:
- overall look is great
- nice little bevels on sharp edges without requiring LGEO parts
But...
- More than 1 hour to render vs. less than 3 minutes
- Weird artifacts (look at the arm shoulder of the monkey)
- Pretty clumsy to properly frame the scene compared to LDView or LDCad (OK, this may be caused by my total ignorance of Blender!)
[Image: 3628_-_perry_panda_and_chester_chimp-pov.png][Image: 3628_-_perry_panda_and_chester_chimp-bdcycles.png]
Reply
RE: Blender LDraw import tool
#27
I agree with you.
Also the front of the motorcycle looks much less smooth in Blender.
And achieving that nice default lighting of course is also possible in POVRay
if you tinker a little with radiosity and a surrounding lighting sphere.
For now I think I will stick with the combination LDView + POVRay, too.
But having the Blender importer available is a very, very nice thing to have for the Blender fans.
Reply
RE: Blender LDraw import tool
#28
(2018-03-31, 13:59)Steffen Wrote: I also tried this now Smile
I downloaded Blender 2.79b, installed that plugin and directly imported and rendered one of my 12V train test scenes,
without adjusting any settings manually:
That looks great!  How many parts are in the scene? I've used the importer on some vehicles for this April Fools Day gag, but when I tried to import a serious model (e.g. 10k parts) the importer just hung for a few minutes and I gave up.
The only problem I had with the import of the small model is one of LDraw and my target engine: LDraw models end up with a huge number of triangles because there is so much detail in each part. I've been thinking about how to write some kind of "thinning" tool, e.g. to remove the tubes from a stack of 2x4s and other totally occluded geometry.
Reply
RE: Blender LDraw import tool
#29
The biggest model I have rendered so far with this tool had about 5000 parts and the import took about 5 minutes (I think, I haven't measured it). I think the more parts the longer it takes, as it has to convert each and every part in your model to Blender. Of those 5000 parts, most are on the inside and if I'd remove those the render would look exactly the same but the import would probably be faster.
Reply
RE: Blender LDraw import tool
#30
Quote:I've been thinking about how to write some kind of "thinning" tool, e.g. to remove the tubes from a stack of 2x4s and other totally occluded geometry.
An approach like that was done at LDrawBoxer:
https://sourceforge.net/projects/ldrawboxer/
Reply
« Next Oldest | Next Newest »



Forum Jump:


Users browsing this thread: 5 Guest(s)