LDraw.org Discussion Forums

Full Version: Working on a Blender (collada) export, need some help
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Hello all.

Orion pointed my to the Collada format in this thread:
https://forums.ldraw.org/thread-23915-po...l#pid36135

Couple of hours later I had a very basic highly experimental export for it in LDCad opening many exiting possibilities for using LDraw content inside blender.

But my lack of Blender experience is a bit of slowdown.

I would really appropriate some help in setting up some basic materials to use on the LDraw meshes/objects.

Can anyone share some pointers on this ?

A basic LEGO like plastic and rubber would be a great starter.
Maybe get in contact with the Mecabricks folks? They already have a working export and I'd love to see a closer collaboration between us and them.
(2020-02-29, 20:49)Orion Pobursky Wrote: [ -> ]Maybe get in contact with the Mecabricks folks? They already have a working export and I'd love to see a closer collaboration between us and them.

Might be an idea, but they use a custom written blender plugin,

I really prefer to generate a single/some stand alone file(s) just like with the pov-ray export.


The one big problem I'm running into at the moment is that Blender doesn't really import the materials defined in the collada file, it seem to only use the given names.

So you'll have to edit all (unique) materials after an import by hand.

I'm looking into the possibility to link to the blender material library instead.

You could also solve this with a small plugin/macro which replaces the materials after import, but like I said I rather have it all standalone Angry
Some progress
[attachment=4926]

But I had to 'color' it manually inside blender.

For this you select a random brick of color x and edit its material, it will then change all bricks using that same color.

I'm also not sure how to handle the recursive nature of LDraw, how would one organize 'collections' etc inside Blender to get the model submodel feel of things?

It now generates this:
[attachment=4927]

Again some pointers from experienced blender users would be highly appreciated.
Some more progress, this is how it now renders 'out-of-the-box':
[attachment=4928]

Turned out the missing material was due to a typo in some ID tag Big Grin

It now only seem to ignore the alpha channel in the diffuse value.

Also something weird is going on with the material binding as it sometimes attaches to the mesh while it should always be attached to the node object.
[attachment=4929]

Anyone has a clue on why that could happen, all the refs are defined in a loop and thus exactly the same except for some names and matrices and there is nothing special/different about the parts referenced ether.
(2020-03-01, 2:11)Roland Melkert Wrote: [ -> ]Some more progress, this is how it now renders 'out-of-the-box':


Turned out the missing material was due to a typo in some ID tag Big Grin

It now only seem to ignore the alpha channel in the diffuse value.

Also something weird is going on with the material binding as it sometimes attaches to the mesh while it should always be attached to the node object.


Anyone has a clue on why that could happen, all the refs are defined in a loop and thus exactly the same except for some names and matrices and there is nothing special/different about the parts referenced ether.

Hi Roland - I started with Toby Nelson’s LDraw Blender importer and created an additional module to automate the render. I modified the importer to enable common LDraw capabilities like supporting multiple search paths, importing an archive library etc... The addon can be used by any application using the out of the box Blender API/addon calls. You can see full details at my GitHub repo repo. I believe working directly with the LDraw format is optimal.

[attachment=4930]

Cheers,
(2020-03-01, 13:07)Trevor Sandy Wrote: [ -> ]Hi Roland - I started with Toby Nelson’s LDraw Blender importer and created an additional module to automate the render. I modified the importer to enable common LDraw capabilities like supporting multiple search paths, importing an archive library etc... The addon can be used by any application using the out of the box Blender API/addon calls. You can see full details at my GitHub repo repo. I believe working directly with the LDraw format is optimal.
Seems very interesting, I'll take a look at it.

I'm still hoping to setup something universal though as my goal is to be able to export animations with the promise of Blender's faster (then povray) rendering at similar or better quality.

Export is the easiest to do this with as the LDCad internals know exactly how to process LDraw and animation scripts already.
Another update on my progress

It now handles MPD, transparency and fake seams.

[attachment=4934]



I also seem to have indirectly solved the material binding problem as a result of using a different approach which was needed to preserve the LDraw recursion (submodels) inside the export file.



Lighting is still a bit overexposed haven't really played with lighting in blender nor the collada file itself.

Still need a lot of tweaks and cleanup as the whole process is still very fragile (e.g. mpd's using embedded parts won't export correctly).

I'm still hoping to find someone willing to help me with the collada materials etc.
(2020-03-02, 1:41)Roland Melkert Wrote: [ -> ]I'm still hoping to find someone willing to help me with the collada materials etc.

Unfortunately I think you'd get better luck in a Blender focused forum or a larger AFOL community forum.
(2020-03-02, 1:47)Orion Pobursky Wrote: [ -> ]Unfortunately I think you'd get better luck in a Blender focused forum or a larger AFOL community forum.

Hello, I am the Mecabricks guy Wink
If you want to get in touch with me, I could answer your Blender questions I saw in this thread. However, I can already tell you that if you want to get photorealistic results, you will have to write your own addon for Blender in order to build your specialised materials for the built in renderers (Cycles/Eevee). Generic formats like collada can only output generic materials. In the case of Blender, it is basically the principled shader with default settings. Besides as you already found out, you do not have a great control over how material and mesh data are structured which has a great impact on the render time and memory used.
Pages: 1 2 3