Hello all,

Attached you will find my contribution to 3d-viewer. I hope that it can be 
incorporated in the trunk of KiCad development.
This (not so simple) additions will give to KiCad a more “pro” look that was 
missing in the 3d-viewer.

Have a look in the screen-shots attached to get an idea of the new look I 
propose.

My time is short but, in meanwhile, if you find small issues I will try to 
quickly fix and submit it.

Have fun!
 

New features / changes:

+ It tried to use as much as possible data structures from glm library.
+ I tried to separate the load of the file model from the OpenGL render. (still 
need some work for full detach, see missing features) Now there are new class 
with new data structures that store 3d model data and render it later.
+ x3d now support per face diffuse color (== you can use blender exporter to 
generate this format !).
+ add support for VRML 1 mesh format (== you can now use directly files from 
3dContentCentral !).
+ recode and improve VRML 2 support (it now supports more complex hierarchical 
files and materials, == you can use FreeCAD export to generate this format !).


Eye-candy render:

+ Smooth normal calculation.
+ PCB texture.
+ Silk screen texture.
+ Diffuse shadow per object Front/Back side.
+ Diffuse shadow for all board.
+ Background gradient.


Bug fixes:

+ x3d loader was not setting locales C so files are not loaded in some language 
settings. (Bug #1341231)


Know issues / missing features:

- I found some models files to have invalid face index (example face is 
declared using the triangle indexes: 1, 3, 1 and it cannot have two index 
points of the same value). Some easy fix can/should be added in future.

- Model files are loaded twice (this was happen already in older kicad 
version). In complex boards, the 3d-viewer in my (not so fast) computer can 
take 10 to 20 or more seconds.
This happen because it try first load the opaque objects and then the 
transparent ones. I didn't understand it clear so I didn't change it.
I do believe that with the changes I did, someone now with more kicad dev 
knowledge should have a look and see how the files are loaded and some how try 
to first load all different files and then just render the object by its file 
name. (first make a list of different models, then render each component for 
same models..etc)

- Also it would be nice to cache models between sessions? So it will not 
load/reload every time you want to refresh your PCB because you did some 
changes.

- It could also disk cache information regarding the 3d models, as an example, 
the bounding boxes so it will render the BBox in some fast (non realistic) 
mode. (I miss this information to proper render the board shadow, that I am 
using a fixed Z value now, and it should be related with the Z of all board 
component models)

- Some selectable options may be added to improve 3d-viewer (colors, render 
options, etc).

- I added options in the source code to use or not the material properties of 
model files. I disabled emissive, specular color, ambient and shininess because 
some currently well know models (ex: walter) have that properties with bad 
values and it will make the render look bad or too exaggerated.

- Because the way VRML Export is implemented, it will add a “link” to other 
VRML files. If you are using VRML 1 files and if your external software don't 
support VRML 1 format it won't be able to load that exporter file. (and I do 
believe that it will be the case of most of free software, blender, freecad, 
etc). The way to properly implement this should be export the VRML 1 file to 
VRML 2 or embedded the VRML 1 file in the exporter file it self.

- Because now I had implemented a 3d_mesh_model.h for loading all model files, 
it should be easy to port the remaining source code and implement a new 3D file 
exporter (to some mesh format, obj, x3d, …)

- I notice that some VRML 2 models with transparency may are not being 
correctly rendered.


Mario Luzeiro
_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to     : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp

Reply via email to