holance on develop
Adds dedicated thread for proce… Make sure to dispose parallel t… Merge branch 'helix-toolkit:dev… and 1 more (compare)
Hi there folks. I'm finding it difficult to find documentation for Helix-toolkit WPF sharpdx specifically.
I have a large scale project that we would ideally like to stick with WPF as of now. We have a 3d viewer to display a 3d model of a facilities HVAC system. We separated all of the hvac components into separate .obj files. These files amount to 80mb. The problem is, even after switching to SharpDX, our loading times are not very good (and we plan to add on to the list of 3d models to import). We're seeing even 15 second loading times on a 1080Ti card.
We've looked into Google's Draco compression algorithm and are impressed with the post-compression size. This will help us with distribution of the model files however we cannot seem to find a way to import the .drc files when using HelixToolkit.Wpf.SharpDX, it appears that we need to use HelixToolkit.SharpDX.Core.Assimp in order to do so. The trouble is, we've seen that you cannot combine SharpDX.Core and Wpf.SharpDX together.
Is there any way to resolve this? Is Helix.Wpf even worth it? (We're planning on shipping a piece of software that will be used in very large scale (>100000 clients))
So HelixToolkit.SharpDX.Core.Assimp 's Loader will bring in google draco files apparently, but the loader produces a HelixToolkitScene, which has one or many SceneNode's.
HelixToolkit.WPF.SharpDX also has its own SceneNode class. I'm trying to now copy all properties requires from the SharpDX.Core SceneNode to the WPF.SharpDX SceneNode. The only matching property I can find that matters is ModelMatrix, although the WPF.SharpDX SceneNode also requires geometry, otherwise I get a null pointer exception when adding the node to the Viewport3DX.
My current question is, is this really the only way to go about this? Or is there something standardized to import google draco into a WPF environment
Okay after a ton of reading in this thread all the way back to 2019
I found a comment that mentions a prereleased package : helixtoolkit.sharpdx.core.wpf
You have to use a package manager console to get it
Install-Package HelixToolkit.SharpDX.Core.Wpf -Version 2.12.0
Then you remove HelixToolkit.WPF.SharpDX Package
After that, there is no difference in scenenode. If only this information was publicly accessible
@holance I understand the difference in namespace; but from my testing, importing things like gitF is not possible in the available file reader classes in HelixToolkit.WPF.SharpDX since it doesn't completely wrap assimp (from what I can see).
Where HelixToolkit.SharpDx.Core does completely wrap assimp. So I got my gitF loader working.
Next, since I am using WPF, I had to download HelixToolkit.SharpDx.Core.WPF using the package manager console as the package manager didn't publicly list the package nor is there any documentation about it anywhere I could find.
I suggest adding some documentation regarding the importance of selecting either namespace and the solutions for things like trying to use core.sharpdx with assimp and WPF.
All around I'm finding it hard and losing time to solve issues. Now I have a SceneNodeGroupModel3D which contains all of the scenenodes imported using core.sharpdx.assimp, which allows me to drop nodes into the WPF Viewport3DX, however I am not getting any bounds feedback on the SceneNodeGroupModel3D, I instead of to traverse and use encapsulate methods to add up all of the meshnode geometry bounds.
Unless, is there something I can do to refresh the bounds information for the node tree?
NodeGroup_OnClearto listen for events on the group and maintain a bounding box in a BoundingBoxGroup class. This is how the octree works as well if you need some reference.
Specified element is already the logical child of another element. Disconnect it first.. If I remove the Viewport3DX it doesn't seem to have this issue. Afaict I'm not re-using anything here, but somehow it seems like maybe the Viewport is reusing things internally. Perhaps I'm not correctly disposing things. Any ideas as to what I could be doing wrong?
// Load the object. SceneNode scene = await OpenFile("test_model.obj"); // Create the arrow model. var arrowModel = new MeshGeometryModel3D(); MeshBuilder mb = new MeshBuilder(); mb.AddArrow(new Vector3(0, 0, 0), new Vector3(0, 0, 1), 0.05); arrowModel.Geometry = mb.ToMeshGeometry3D(); arrowModel.Material = PhongMaterials.Gray; arrowModel.Transform = Transform3D.Identity; // Group them together. // Is this the right type of "group" to use? SceneNodeGroupModel3D group = new SceneNodeGroupModel3D(); group.AddNode(scene); group.AddNode(arrowModel); // This is the line that gives an error - "cannot convert from MeshGeometryModel3D to SceneNode"
sharpdx_direct3d11_effects_x86.dllin HelixToolkit.SharpDX versions after v2.0 release
I did ZoomFit
Vector2 center = new Vector2(Convert.ToSingle((xMax + xMin) / 2), Convert.ToSingle((yMax + yMin) / 2));//Center 2D
Vector3 center3D = new Vector3();
DieCreationWindow.ViewPort.UnProjectOnPlane(center, new Vector3(0, 0, 0), DieCreationWindow.ViewPort.Camera.LookDirection.ToVector3(), out center3D);//Find center 3D
DieCreationWindow.ViewPort.ZoomToRectangle(new Rect(new System.Windows.Point(xMin - 5, yMin - 5), new Size(sizeX + 10, sizeY + 10)));
Vector3D lookDirection = DieCreationWindow.ViewPort.Camera.LookDirection;
DieCreationWindow.ViewPort.Camera.LookDirection = lookDirection;
after using it then use the zoom to maximize, model vibrates