New feature: 3D Opacity Property (WIP)

I think @kammutierspule and @JeffYoung can continue in the relevant issue https://gitlab.com/kicad/code/kicad/-/issues/2087 and some forum moderator could move these discussions to another thread.

(It appears Mario isn’t on GiLab yet, so we’ll have to continue here for now…)

I’ve merged the GUI and file R/W code. Over to you, @kammutierspule. :slight_smile:

1 Like

Which post should the split start at?

Don’t ask me, I’ve got enough gray hairs already. There are two threads intertwined. I would of course prefer starting new threads immediately after the initial announcements of new features, to keep this long thread readable.

Moved, I think I untangled it

1 Like

Adding the UI and file processing for a 3D opacity setting would be reasonably easy. However, the 3D rendering code is one area I know nothing about…

I am pretty sure there is support for translucent materials somehow. There are LED’s in the standard library that are translucent.

true! but we are referring to a parameter/property related to the footprints, not the materials of 3D shapes

Yes, there are several possible use cases for semi-transparent models. For example I have a model for an OLED display:

It’s easy to put SMD components under it. But if I want to check the design, I have to switch off the model altogether or I can’t see what’s under it. Making it semi-transparent would make it possible to see everything when I need to, yet keeping the model itself normally opaque.

Of course even more obvious use case is having an opaque chassis model through which you want to see while at the same time having it visible.

Is that STEp or WRL? I suspect the latter

Test please!


4 Likes

Nice addition Thanx! :smiley:
I found one small issue… if I add a second 3D model to a footprint and apply opacity, only the first one respects the value, the second keeps its opacity to 100% even if it is set to i.e. 50%
And a wish… would it be possible to add a switch in the Render option menu beside the “use all properties”, “diffuse only”, like i.e. “disable opacity” to be able to toggle all the 3D models opacity from the set value to 100%?
Maurice

Good finding, I didn’t proper tested it.
I just pushed a new updated. Also, it should work with Raytracing.

Related with the feature request… I will evaluate it latter once this get merged…

If I understand correctly it would ignore the opacity setting of each model, using 100% for all models. Right?

It doesn’t build for me after the update

OK, @kammutierspule I re-cloned from scratch and now it does build and works properly :smiley:
Thx

yes, exactly… the idea is to be able to toggle transparency to all items in a similar way as it is possible to tweak now switching from ‘all properties’ to ‘diffuse’ switching in 3d viewer from transparent objects to fully opaque. The best would be to add a shortcut to this fucntion, been able to toggle without involving the 3d viewer menu

No, not exactly… It is not toggling or ignore but is “modulating” by multiplying the two values
It is (or it should, unless any bug still present) in fact preserving the transparency of each model and for each material of a shape in a file.

FinalOpacity = OriginalOpacityFromTheModel * OpacityOptionOnGUI

As an example, a 3Dmodel.file of a Valve. It has two shapes with two materials. The shape of a Valve has a “Support” that is opaque (1.0) and has shape of a “Glass” that its material is 0.5 opaque.

If the opacity option on GUI for that model is set to 0.5 (50%) the final result will be the “Support” = 1.0*0.5 = 0.5 and the “Valve” = 0.5 * 0.5 = 0.25

Hope that is more clear ( or transparent) now! :sweat_smile:

I think you misunderstood this part of the discussion - we weren’t talking about the opaqueness/transparency setting which you have implemented, but the option to ignore it so that each model can have its own external opaqueness/transparency setting kept but all models would be shown in their original state, without the setting applied, as if each model in KiCad footprints had the external opaqueness setting 100%/fully opaque. That option wouldn’t naturally affect the model’s internal parts, they would obey the model’s own internal properties.

So, quoting your formula, the option’s effect would be

FinalOpacity = OriginalOpacityFromTheModel * 100%

but the OpacityOptionOnGUI wouldn’t be changed in the footprint’s settings.

Correct! Sorry I misunderstood it, I guess I read it only from last Maurice quote and not from your original post (where I miss the context)!

I will think on that option latter once that part is approved for merge.
Thanks for the suggestions!

2 Likes

it seems this has been merged… thx!

A fantastic interface in 3d viewer would be like the one used in other CADs: a dialog in the 3D viewer to enable and set visibility and opacity for the 3D models… (a search filter would also be very useful)


1 Like