Removing underlayer from Visual3d_View

Forums: 

We are very likely to consider 2D layer (API for drawing 2D objects over the 3D scene) design improvement as one of further improvements of OCCT visualization.

Removing "underlayer" and keeping only one 2D layer ("overlayer") would simplify this work to a certain extent.
Our feeling is that many people use "overlayer" but nobody actually uses "underlayer".

If somebody sees any sense in keeping "underlayer", please reply in this thread.

Shockwave's picture

Which is the use of the underlayer?

It could be usefull to have a list of layer where to draw.
If I have 3 different 2d object to be drawn over the 3d scene, I'd like to draw each object in a single layer as the update of the different objects could be made from different parts of the software.
For example if I have to draw a rectangle on the layer 1 and a circle on the layer 2, if something change on the objects of the layer 1 I need to update only the objects on this layer (this could be made in a specific module that doesn't know the items on the other layers).
Now if the rectangle change I need to clear and redraw all the objects on the layer, the rectangle (that is changed) and the circle (that isn't changed and could be put on another layer and not redrawn)

Another useful feature is the possibility to add a layer with a glif, a semitransparent image like a logo, but in this case this layer is the same and it have no need to be updated as the items in the other layers change.

Kirill Gavrilov's picture

It should be noted, that OCCT supports several options which can be generally assumed as "layers":
- "3D" layers. Z-buffer is cleared at the very beginning of the layer, thus objects draw at lower layers are always overwritten by objects from higher layers regardless of actual depth of the objects in 3D space. By default, all objects displayed in main layer.
- Priorities within single "3D" layer. Priority alters display order, and naturally affects objects within the same depth (physically overlapped).
- Overlayer and Underlayer, designed to redraw 2D objects defined in pixels.

Overlayer and Underlayer are not for normal 2D objects, but for on-screen elements like color-scale, FPS meter and so on.

Normal 2D objects should be drawn as normal 3D objects. Usually applications display such objects with 0.0 Z-coordinate or implement 2D layers adjusting Z-coordinate. It is also possible to create "ideal" 2D layers assigning objects to different "3D" layers, taking into account more resources to be abused for this purpose. Though technique described in your post can be implemented for 3D-layers, but does not directly related to current plans.

So the subject of this post is the Underlayer designed for on-screen elements, not for normal 2D objects.