3D models of packages and boards


#1

From @ubruhin on Thu Oct 25 2018 19:55:49 GMT+0000 (UTC)

LibrePCB packages should have support for 3D models, so that we can implement a 3D board viewer & export.

In KiCad, footprints can have two different types of 3D models:

  • VRML for 3D board viewer and raytracing
  • STEP for export to mechanical CAD

Although it’s cumbersome to have two different file formats for 3D models, I guess this is the most reasonable solution. So I think it would make sense if we do it the same way…

Or are there other opinions?

Copied from original issue: https://github.com/LibrePCB/librepcb-rfcs/issues/32


#2

From @dbrgn on Thu Oct 25 2018 20:33:15 GMT+0000 (UTC)

VRML is horrible unfortunately… But I don’t really know a good alternative.

On the other hand, using the same format as KiCAD would allow us to use their 3D models and vice versa. With the growing popularity of KiCAD, maybe better editing tools will pop up. KiCAD libraries are licensed CC-BY-SA, so we could use them. This is probably a case where converging on a common format would give the open source community a lot of benefits.

Also, it seems that nowadays FreeCAD can generate valid VRML files for KiCAD. That wasn’t the case a few years ago :slight_smile:


#3

From @ubruhin on Fri Oct 26 2018 20:55:13 GMT+0000 (UTC)

> On the other hand, using the same format as KiCAD would allow us to use their 3D models and vice versa.

Yes, that would be really helpful!

KiCAD libraries are licensed CC-BY-SA, so we could use them.

Hmm I’m not sure if we really could/should use them. Actually I want to have all official LibrePCB libraries to be published under CC0, so that users can do absolutely everything with the libraries, without even worrying about their license. CC-BY-SA breaks this, as it has restrictions :frowning:


#4

A cursory glance at other CAD apps shows STEP is everywhere, and STL/AMF are fairly common.

The new version of STEP can contain colors it seems, so if STEP alone is good enough for a basic fallback, you could have STEP required, and allow arbitrarily many other files as well.

It seems like VRML is the one of the only things that really has an accepted way to put materials with specular reflection and the like into a file, aside from going with an app-specific format.

One could define a standard set of STEP material names, and an exporter that knows what material to apply to a GoldPlatedPin or some Solder or some BlackChipEpoxy. That kind of abstraction gives flexibility and prevents being forever tied to one model of how rendering should work.

OBJ seems to explicitly be designed for that kind of workflow, with named materials and a separate MTL thing, and it’s pretty bog standard. The MTL files have transparency and specular reflection and such.

You could just have a basic flat color+openGL viewer integrated, and leave HQ rendering to a Blender exporter with a library of shaders for each material.

This would also save parts authors from having to worry about presentation too much. They just type a material name, and LibrePCB handles making it look good.

Another pretty big advantage is that different people’s models will have the same color chips and pins and such in the render, preventing an annoying cacophony unless a part really does have a specific color.


#5

I like that. Having a standard set of materials allows for consistent look & feel in 3D renderings.