my goal is quite simple: for a given hierarchy, take selected objects and draw them as a wireframe with center visualized as a sphere or as lines. For the sphere it works correctly as one would expect. I add a SphereVisual3D into a hierarchy of ContentVisual3D objects with only leaves as geometry. I attached ab3d dump file - correct.txt.
However, when I try adding LineVisual3D, it messes everything up. How messed up the result is depends on order and if the lines attached are under single ModelVisual3D or each by itself. Each of these object are added as a children of the selected ContentVisual3D. One wrong hierarchy attached as well - wrong1.txt.
So the question is: Where is the catch? Why does it do this nonsense? It even messes up with a grid defined outside the model itself (it takes the major lines of the grid as shown on the second image) or with the wireframe geometry, but not its solid part...
I tried to change the order of objects and some other things but still the results were correct. I also tied adding and removing 3D lines.
Are you using Ab3d.DXEngine (DirectX 11 rendering engine) to render the scene (though I have also tried there and it looks correct)?
Do you have a Transformation set on the GeometryModel3D that is assigned to WireframeVisual3D's OriginalModel? (in your dump texts I do not see that object as child of WireframeVisual3D so you are probably adding that later).
Did you maybe get any additional clue on what could be the problem?
Btw: I do not like that you are using ContentVisual3D for grouping. You should use ModelVisual3D for that. The purpose of ContentVisual3D is to be able to use IsVisible property to quickly show or hide the Model3D that is assigned to its Content property (this is especially useful in Abd3.DXEngine). So you should only use Content property and not also Children. But because of a way how WPF 3D defined the object model (the only 3D object that can be derived from is ModelVisual3D) there is no easy way to prevent setting Children collection. Anyway, this is only a side note and should not have any effect on the problem that you are having.
Are you using Ab3d.DXEngine? Yes, I am using DXEngine. Do you have a Transformation set? Yes, I do. I double checked. I think the missing transformations in the dump should correspond to matrix identities (at least in my case).
Did I find something? I tried to compare our initialization of the WireframeVisual3D. I had set UseModelColor = true. With this anytime I switched between wireframe and material highlight it would take other objects with it. When UseModelColor is set to false, this does not happen (still don't know why). When I replaced LineVisual3D with BoxVisual3D this did not happen as well.
ContentVisual3D I am using the content visual hierarchy on purpose. It allows me to hide each part of the object (basically each part of the geometry is an object by itself). When I tried creating Model3DGroup hierarchy and for each group create a ContentVisual, the hiding didn't work.