![]() |
|
Lines created via WpfModelVisual3DNode no longer render in version 6.0 - Printable Version +- AB4D Forum (https://forum.ab4d.com) +-- Forum: Products Forums (https://forum.ab4d.com/forumdisplay.php?fid=4) +--- Forum: Ab3d.DXEngine (https://forum.ab4d.com/forumdisplay.php?fid=11) +--- Thread: Lines created via WpfModelVisual3DNode no longer render in version 6.0 (/showthread.php?tid=4403) |
Lines created via WpfModelVisual3DNode no longer render in version 6.0 - henkt - 07-09-2023 In a scenario using DxEngine directly in a WinForms app, lines (Ab3d.Visuals.LineVisual3D, Ab3d.Visuals.PolyLineVisual3D) created via WpfModelVisual3DNode no longer display when using version 6.0 of DxEngine Please find a sample solution with one project using 5.0 and one using 6.0 illustrating the issue: https://drive.google.com/drive/folders/1MBePQNq9eJ6HuF1Nb7Z-y14IGeZwU51W?usp=drive_link RE: Lines created via WpfModelVisual3DNode no longer render in version 6.0 - abenedik - 07-10-2023 Thank you for providing the sample project that reproduced the issue. This significantly helped me understand the problem and find the cause of the problem. In the last version of the libraries the initialization of the 3D lines was significantly improved. Before it may happen that the MeshGeometry3D for a 3D was initially generated on the CPU by the LinesUpdater even if the lines were shown by the DXEngine and the geometry was generated in the GPU's geometry shader (this slowed down the initialization and created unused 3D objects). This may happen when 3D lines from Visual3D are initialized before the DXEngine is fully initialized. What is more, new line objects may be created on each line property change. Those two issue were solved by waiting until the 3D line was actually visible (added to a visible Visual3D parent) and until DXEngine is initialized (when present). After that either MeshGeometry3D for the line is generated (in case there is no DXEngine) or the line's data is passed to the DXEngine to generate the line in the geometry shader. This worked well in all of my tests. But I have not anticipated generating a LineVisual3D and passing it to the WpfModelVisual3DNode constructor. In this case the LineVisual3D is never actually visible and therefore the DXEngine does not get the line's data. When working with DXEngine objects (such as WpfModelVisual3DNode) it was expected that a ScreenSpaceLineNode would be created instead of WpfModelVisual3DNode and LineVisual3D. This is much more optimal because you do not create slow WPF objects (LineVisual3D) but directly create the ScreenSpaceLineNode (which is also generated behind the scenes when passing a LineVisual3D to WpfModelVisual3DNode). Creating ScreenSpaceLineNode objects is demonstrated in the DXEngineAdvanced/ScreenSpaceLineNodeSample sample in the Ab3d.DXEngine samples projects. It is recommended that you update your code to create the ScreenSpaceLineNode. Here is the updated code from your sample project (the old code is commented): Code: //var line = new Ab3d.Visuals.LineVisual3D()However, I admit that creating a WpfModelVisual3DNode from a LineVisual3D is a perfectly valid scenario. Therefore I have updated the code in DXEngine to correctly handle that use case. Because this issue has a workaround that works better than the original code, I do not plan to release an official hotfix for that. So this fix will be published with the next version (or with a hotfix if there is a bigger issue found). Anyway, if you want to get a fixed version, I can send you updated NuGet packages, but you will need to use a local NuGet source to use them. |