Does the 3D viewer support textures?

The 3D renderer is being rewritten but there are currently no plans for textures. They might be added when the job is finished, depending on how difficult they are to implement, but for now thereā€™s nothing. It will be a while before the newer code is ready; work has been going on since about July but thereā€™s a very long way to go yet.

As (co)author of the current version of the 3d-viewer, I confirm that I didnā€™t implement any textures :wink:
I am working (with @cbernardo ) on a new 3d-viewer, supporting for textures (on models) wonā€™t be too difficult but it will be on the bottom of the list.
Most of the models you find online donā€™t have textures (3D CAD models, only have 3D information), so I believe it will only be useful for a few people. Would you like to share your 3d model with /without textures? and the 3D of your board?

Maybe some more people would like to join the 3d-viewer development so that can speed up and we will see textures soonā€¦

Mario

@maui @cbernardo
One nice wish thing would be if in future we can support textures, then maybe we can add textures to parametric models or/and improve somehow the realism of the rendering add more info to the materials of the VRMLsā€¦

Hi @cbernardo @kammutierspule @rolandking
there is a dirty trick to have texture available in VRML file ā€¦
if you just export your 3d board and VRML models with kicad copying the models to 3D path, and then change your VRML model without texture with a model with texture in that folder, you can have a VRML representation of board and modules with the desired texture

that would be nice/useful e.g. for povray generation of 3d realistic rendering or blender picture rendering or animation
3d screenshot in kicad

3d screenshot in FreeCAD with texture (VRML file exported from kicad)

Maurice :slight_smile:

cool! I was thinking on that tooā€¦ you should be able to use/convert with 3rd part softwares. I didnt know that FreeCAD supports textures.
@maui Are you able to use one exports of your script and use eg FreeCAD to export to some format to render in eg Blender ?

@kammutierspule FreeCAD is a very nice 3D CAD tool!

and yes, it is possible to use my kicad StepUp parametric generated VRML models, to be rendered with Blender
this is a video of a kicad board where all 3D models comes from my script generator and are converted from FreeCAD (MCAD) to STEP and exported to VRML format.
The VRML assembly, generated from kicad VRML export routine, can be imported in Blender and manipulated to obtain nice rendering or animations and videos.

Blender has a limited VRML import support
http://forum.freecadweb.org/viewtopic.php?t=10815
so FreeCAD VRML exported models are not rendered well in standard Blender import routinesā€¦
hyOzd (the guy that Iā€™ve developed the module parametric library with) has developed a python patch plugin that fills the gapā€¦
http://forum.freecadweb.org/viewtopic.php?t=10815#p103529
Then you will get a clean scene in blender with VRML files exported from FreeCAD
:slight_smile:

@maui Soā€¦ can you show us a nice render sample with blender ?

@kammutierspule the video is done with Blenderā€¦ that is the rendering I obtained from FreeCAD generated modelsā€¦
and for me it is niceā€¦ :smile:
Iā€™m not a Blender artist, but the point is that when you have your models in Blender, you can edit your models any way you want with Blenderā€™s tools to create realistic and very nice renders.

Ah ok, I was not able to watch the video at that time. I was thinking that you could do a render with a some more complex board. yeah, you need to add more detailed materials in blender to get a more decent realistic render.

@kammutierspule

if you look one reply before the one with the video, you get a more complex board rendered in FreeCAD
that hackrf-one board can be rendered in FreeCAD as in Blender, and moreover with the texture :wink:

ā€œyou need to add more detailed materials in blender to get a more decent realistic renderā€
you are right, my 3D models, and in general 3D models coming from FreeCAD will have only diffuseColor property
and they will not have
emissive and specular properties

My approach to 3D models is a mechanical approach, more then aesthetic
I need 3D to check the pcb routes and to check enclosures constrainsā€¦

this is a common philosophy that also the other ECAD sw have ā€¦

but, coming back to VRML models, as Wayne stated at this thread
http://www.mail-archive.com/kicad-developers%40lists.launchpad.net/msg15662.html
ā€œI hope at some point in the future our 3D models could be improved
(some of material properties are very wrong)
now that FreeCAD exports vrml files that the 3D viewer can use.ā€
the 3D libs are far from being perfect at the momentā€¦

I would prefer not to include those rendering properties, if they are not correctly assignedā€¦
I used to render the official 3D models with the 3d-viewer option ā€œrender material propertiesā€ OFF

Anyway, we could have a solution that will leave all happyā€¦
My parametric 3D models, exported by FreeCAD in VRML are managed by a scriptā€¦
so a script could add emissive and specular properties to the material of the VRMLs
e.g. giving a color table correspondence, injecting in the VRML generated all the properties you are looking atā€¦
You are very welcome if may consider to have a look at the VRML format generated by FreeCAD to suggest or create a solution for this riddle :smile:
here the link to my 3D parametric STEP and VRML models










Maurice

@kammutierspule
Iā€™m not a 3D designer, so if you suggest me some values for:

  • metal pin material
  • chip body material
    for the following data:
    diffuseColor
    ambientIntensity
    emissiveColor
    specularColor
    shininess
    I could try to add those values to my scripted models and will send them to you to see if the result will add realistic performance to the models
    :smile:

Yes, but I was asking for a proper render in Blender. Something more ā€˜artisticā€™ā€¦ that was something I had in mind to try.

Sure, that is why it is nice to have different interests form different people in opensource projects, so they will make different contributions.

There was issues with some models from some authors that didnā€™t set correctly the materials, so in 3D viewer we develop a flag to not use materials from models (Actually, if the flag is set it only use diffuse properties)

Some authors, eg:
http://smisioto.no-ip.org/elettronica/kicad/kicad-en.htm
start to fix theirs modules with correct materials and also normal properties so it will render properly.

If you are adding the properties to the models, you can assigned it correctly.
I believe we keep the option to render or not the materials, but, hopping that authors will have in mind to check the correctness of the assigned materials, so that can be proper render and add realist for who how need/like it.

I dont know how your script works, but if you know if you are adding a pin (as eg), you know that it is a shinning metal, so probably you can add some properties to it. Or if it is the black epoxy packageā€¦
You can have a look at:
http://devernay.free.fr/cours/opengl/materials.html
http://vrmlstuff.free.fr/materials/
http://www.graco.unb.br/alvares/pub/qualificacao/www.web3d.org/www.web3d.org/x3d/content/examples/UniversalMediaMaterials/index.html

I will try to suggest some values but only testing it and see how it looks will tell if they look ok.

I am not a designer too, but some explanation:

(default values)

diffuseColor(0.8 0.8 0.8) - it is the main color of the object
emissiveColor(0 0 0) - you can set this value for example if it is a LED, that will be the light it will emit.
shininess(0.2) - a lower value, it will diffuse/blur the shinning, an high value (1.0) will make a very high shining spots of the lights (it will depend on material properties, need to check a table)
specularColor(0 0 0) - it is the light that will be reflected if the face is reflecting the light (it usually depends on material propertiesā€¦ so probably you need to consult some table)
transparency(0.0) - 0.0 will be opac, 1.0 will be total transparent (use it for glass, LEDsā€¦ etc)
ambientIntensity(0.2) - when some face is obscured by the light, this will be how much it will light that face.

Guys,
Looking for some footprints and 3dmodels ? Maybe what youā€™re looking for are in my repository here :

@kammutierspule
hi againā€¦
Iā€™ve done some homework :wink:

attached a self containing kicad project with 2 SMD capacitors:
one with only diffuse color (standard FreeCAD export script)
and one with diffuse, specular, ambient, shininess props

I used Silver for pins and Bronze for body as following:
silver: diffuseColor 0.50754 0.50754 0.50754, specularColor 0.508273 0.508273 0.508273, emissiveColor 0 0 0, ambientIntensity 0.37879, shininess 0.4
bronze: diffuseColor 0.714 0.4284 0.18144, specularColor 0.393548 0.271906 0.166721, emissiveColor 0 0 0, ambientIntensity 0.29762, shininess 0.2
referring to vrml materials

please let me know if you think that the result is fine for improved 3D renderingā€¦
the method can be easily scripted to maintain STEP model as original model for parts, and to obtain VRML model with material properties added to FreeCAD export routines
Maurice

vrml-materials-test.zip (62.9 KB)

Maybe you want to make the shininess lower, I guess ceramic in the caps dont shine so much.
You can use this software to view the models:
http://castle-engine.sourceforge.net/view3dscene.php

@kammutierspule,
thank you for the tip and the VRML viewer link! I didnā€™t know it
I was using freeWRL, but this one is much betterā€¦ and it renders very easy with a friendly GUIā€¦

OK, so now I have to play a bit with my scripts to add materials for VRML modelsā€¦ but the way is doneā€¦
Iā€™m going to have a lib of 3D models with parametric dimensions for 3D mechanical export and collaboration (STEP AP214) and VRML models (generated from mechanical models) with the same aspect and with material properties for nicer artistic rendering!
All this features can be used with kicad StepUp script and the actual kicad version!
And moreover we also have a trick to add texture to VRML board and parts model :wink:

Now I donā€™t see, for me, any reason to use Wings3D anymoreā€¦
ā€œRule, FreeCAD!ā€ :grinning:

Thank you again for your useful suggestions :smile:
Maurice

Alright. Maybe in future I will ask you if you can add some textures, ā€¦ if kicad supports it!..

1 Like

A post was split to a new topic: Textured WRL in 3d= viewer