So, I've been occasionally annoyed by the lack of rendering order for 2D geometry at the same "depth" (i.e., two overlapping 2D (X/Y) geometries with identical Z-coordinates)
Of course, the easy (and I believe only) solution is to appropriately set the z value of geometry that I want to be above (or below). It's been mentioned somewhat recently here:
https://forum.freecadweb.org/viewtopic.php?t=27128
It would be nice to have a 'z-order' or 'z-depth' attribute on the ViewObject to allow for rendering order / layers at the scenegraph level.
I would think this is manageable easily enough - for example, geometry drawn by Tracker objects can be set to 'ontop'...
Feature Request: Z / Depth parameter for ViewObjects
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
Be nice to others! Read the FreeCAD code of conduct!
- Joel_graff
- Veteran
- Posts: 1949
- Joined: Fri Apr 28, 2017 4:23 pm
- Contact:
Feature Request: Z / Depth parameter for ViewObjects
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails
pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
Re: Feature Request: Z / Depth parameter for ViewObjects
"Same level" is for me, well, same level.What do you need this for?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: Feature Request: Z / Depth parameter for ViewObjects
I don't know the implementation, but sketcher has this. The rendering order for regular, construction, and reference can be set.Joel_graff wrote: ↑Fri Apr 19, 2019 5:11 pm I would think this is manageable easily enough - for example, geometry drawn by Tracker objects can be set to 'ontop'...
"fight the good fight"
- Joel_graff
- Veteran
- Posts: 1949
- Joined: Fri Apr 28, 2017 4:23 pm
- Contact:
Re: Feature Request: Z / Depth parameter for ViewObjects
If I have 2D geometry which overlaps, they z-fight. It would be nice to be able to specify that one has render priority over the other. In my current use case, I'm creating a tool that manipulates geometry and overlays the 'proposed' geometry on the existing as the user makes changes. I'd like the proposed geometry to always be on top and not have to increment the z-coordinate by 0.01 or something to achieve that.
I've had a few other use cases as well where I've had to fake layers to get things to render properly, though I don't recall them at the moment..
Another other issue is that selection is based on z-depth and will not pick reliably if overlapped geometry is on the same level. In that case, a render depth would also provide the selection mechanism a clue as to which geometry to choose.
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails
pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
Re: Feature Request: Z / Depth parameter for ViewObjects
I think this is not so easy to do. You would not want to give the geometry a real z offset, as this could lead to all kind of trouble with accuracy later on. So one would need to manipulate the visuals only. In coin there is a node for that:
https://grey.colorado.edu/coin3d/classS ... ml#details
But according to the documentation it seems to be too limited to be used in freecad, e.g. does not work for lines.
https://grey.colorado.edu/coin3d/classS ... ml#details
But according to the documentation it seems to be too limited to be used in freecad, e.g. does not work for lines.
- Joel_graff
- Veteran
- Posts: 1949
- Joined: Fri Apr 28, 2017 4:23 pm
- Contact:
Re: Feature Request: Z / Depth parameter for ViewObjects
In my use case, offsetting one geometry along the z-axis is not really a bad solution. But that's because I'm working in a 2D context - much like Sketcher. In fact, I'm recreating the Sketcher in a very limited sense. It's certainly a manageable problem, but it's obviously not the ideal way to go about solving it. I can see where it creates problems in a 3D context, though.ickby wrote: ↑Sat Apr 20, 2019 4:50 am I think this is not so easy to do. You would not want to give the geometry a real z offset, as this could lead to all kind of trouble with accuracy later on. So one would need to manipulate the visuals only. In coin there is a node for that:
https://grey.colorado.edu/coin3d/classS ... ml#details
But according to the documentation it seems to be too limited to be used in freecad, e.g. does not work for lines.
FreeCAD Trails workbench for transportation engineering: https://www.github.com/joelgraff/freecad.trails
pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
pivy_trackers 2D coin3D library: https://www.github.com/joelgraff/pivy_trackers
Re: Feature Request: Z / Depth parameter for ViewObjects
The SoPolygonOffset node is already used for the "Flat + lines" rendering mode so that the wireframe is always rendered on top of the faces. This is easy for one object but cannot be done for multiple independent objects.
According to https://en.wikipedia.org/wiki/Z-fighting there are several special use cases where different techniques can be used but there is no general solution that works for every use case.
According to https://en.wikipedia.org/wiki/Z-fighting there are several special use cases where different techniques can be used but there is no general solution that works for every use case.