modelica / ModelicaStandardLibrary

Free (standard conforming) library to model mechanical (1D/3D), electrical (analog, digital, machines), magnetic, thermal, fluid, control systems and hierarchical state machines. Also numerical functions and functions for strings, files and streams are included.
https://doc.modelica.org
BSD 3-Clause "New" or "Revised" License
472 stars 168 forks source link

Transparency input for all MultiBody visualizers #3992

Open anotheruserofgithub opened 2 years ago

anotheruserofgithub commented 2 years ago

Feature Request

There are use cases where it could be great to be able to change the transparency of any visualizers in the animation window. For instance, OMEdit allows to do that through a context menu (see openmodelica/openmodelica#9083), but this has to be done each time you simulate the model as the values are not persisted. Instead, it would be very useful to have a parameter, or even a time-varying input, that can be set in the model directly. Surface already has that, but not Shape nor Vector, while I do not see what could prevent them from having such a feature. They all have a color, so why not a transparency?

HansOlsson commented 2 years ago

Historically one major reason is that transparency for multiple object is problematic; both in terms of what it implies (what happens if you split an object into two - will that be less transparent?) and in terms of implementation (ideally special shaders, depth peeling, OIT-variants).

Making one object transparent in a way that sort of works is trivial in comparison.

anotheruserofgithub commented 2 years ago

I'm new to this topic and didn't know it was so difficult. Thank you very much for the answer and the depth peeling / OIT pointers!

tobolar commented 2 years ago

@HansOlsson If I understand correctly, the thing is the ambiguous definition of "transparency".

HansOlsson commented 2 years ago

@HansOlsson If I understand correctly, the thing is the ambiguous definition of "transparency".

There are two factors - it's ambiguous and it's difficult to implement in a good way.

anotheruserofgithub commented 2 years ago

Yet, why does Surface have a transparency input, then? Should it not be removed to be consistent across visualizers? Sorry but I forgot to ask the question earlier.

If it is kept, it would be a slight improvement to modify the documentation: "Transparency of surface" instead of "Transparency of shape", not only in PartialSurface but in all models that make use of Surface (Rectangle, Torus, PipeWithScalarField).

anotheruserofgithub commented 2 years ago

@HansOlsson Would you have an answer? (Sorry for asking late.)

HansOlsson commented 2 years ago

Yet, why does Surface have a transparency input, then? Should it not be removed to be consistent across visualizers? Sorry but I forgot to ask the question earlier.

Removing things is a difficult task as some might use it.

Especially as if it is only one Surface it should work. (Well, only one surface visible per pixel; so you could have a non-overlapping set of surfaces as well).

If it is kept, it would be a slight improvement to modify the documentation: "Transparency of surface" instead of "Transparency of shape", not only in PartialSurface but in all models that make use of Surface (Rectangle, Torus, PipeWithScalarField).

Making clear that it only work for Surface and possibly having it in the correct class would be good.

anotheruserofgithub commented 2 years ago

Removing things is a difficult task as some might use it.

Especially as if it is only one Surface it should work. (Well, only one surface visible per pixel; so you could have a non-overlapping set of surfaces as well).

Understood, thanks! :)

tobolar commented 2 years ago

Reopened, since documentation shall be improved.