Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 08:48
    chenhao86 commented #1866
  • 08:24
    antithing closed #1865
  • 08:24
    antithing commented #1865
  • Nov 30 14:34
    holance commented #1865
  • Nov 30 12:19
    antithing commented #1862
  • Nov 30 11:43
    JamesTingle commented #1862
  • Nov 30 10:20
    antithing commented #1865
  • Nov 30 07:50
    holance commented #1866
  • Nov 30 06:44
    chenhao86 opened #1866
  • Nov 29 19:41
    holance commented #1865
  • Nov 29 19:40
    holance commented #1865
  • Nov 29 19:40
    holance commented #1865
  • Nov 29 17:01
    antithing commented #1865
  • Nov 29 17:00
    antithing commented #1865
  • Nov 29 14:49
    holance commented #1865
  • Nov 29 12:04
    antithing commented #1865
  • Nov 29 11:54
    antithing commented #1865
  • Nov 29 11:54
    antithing commented #1865
  • Nov 29 05:18
    chenhao86 closed #1857
  • Nov 29 05:18
    chenhao86 commented #1857
Mythanon
@Mythanon
Please don't take my feedback here as negative, I love HelixToolkit so far.
Mythanon
@Mythanon
@holance To simplify my question. Given a SceneNodeGroupModel3D and/or respective SceneNode, is there a way to get the Bounds or Center of the entire SceneNode and all items within?
Mythanon
@Mythanon
My workaround for now
BoundingBox modelBounds = new BoundingBox();
foreach (MeshNode mesh in mouseOverModelController.model.SceneNode.Traverse().Where(x => x is MeshNode).Select(x => (x as MeshNode))) {
modelBounds = BoundingBox.Merge(modelBounds, mesh.Bounds);
}
Lunci
@holance
@Mythanon I believe you are using Dot Net Core version of WPF instead of Dot Net WPF, that's why you need HelixToolkit.SharpDx.Core.WPF instead of HelixToolkit.WPF.SharpDX.
We do not support bounds for groups. You need to calculate the bound yourself.
Chris Hill
@robotron2084
That works @Mythanon . If the performance is too poor, you can use the NodeGroup_OnAddChildNode, NodeGroup_OnRemoveChildNode, and NodeGroup_OnClear to 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.
Lunci
@holance
@robotron2084 The gizmo is view cube, you can turn it off from Viewport3DX.ShowViewCube = false
Lunci
@holance
@Mythanon For documentation, since this project is maintained by us at spare time, we don't really have bandwidth to update our documentation. Contribution to the documentation is always welcome for anyone.
Chris Hill
@robotron2084
@holance awesome! thank you.
'view cube'...makes sense now that I know it :)
venelin-p-petrov
@venelin-p-petrov
Hi everyone. I am trying to display some transparent meshes using WPF .NET Core and HelixToolkit.SharpDX.Core.WPF, very similar to the OrderIndependantTransparentRendering example. I want to achieve pretty much the same, but instead of using PhongMaterial I want to use VertColorMaterial. Is this possible? If I just change the material and set the IsTransparent property on the MeshGeometryModel3D to FALSE, the transparency works only when looking through the last mesh added in the scene. Which is not order-independent transparency. If I leave the IsTransparent property to TRUE, then the meshes are not rendered at all.
Lunci
@holance
@venelin-p-petrov Currently VertColorMaterial does not support OIT rendering, you can set Viewport3DX.EnableOITRendering = false to workaround the issue.
Chris Hill
@robotron2084
I have a Viewport3DX in a custom UserControl (wpf). This usercontrol is embedded in a window, which is opened and closed. When I close the window, then open another copy of the window, I get the error: 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?
Mythanon
@Mythanon
@holance Thanks a lot, if I have time I will definitely contribute.
@robotron2084 Thanks Chris, I only need the bounds to get the 3d center point in order to draw an overlay of a line to a box in WPF when mousing over certain model groups. So calculating per mouseover event isn't that computationally expensive. Thanks for offering an additional option using events.
Lunci
@holance
@robotron2084 You cannot share wpf elements with two logical parents. You need to set your window content to null when close the window before reuse any wpf elements for another window.
Chris Hill
@robotron2084
@holance hmm...i see. I'm not sharing these objects on purpose but I shall see if nulling out the contents will help.
well that's interesting. It looks like setting the content to null does work. And it looks like it is recycling my view...somehow. Which is a more wpf-related question I will investigate elsewhere. Thanks for your help!
redrabbit007
@redrabbit007
I'm trying to load a model from a file and then add a model created with a MeshBuilder to the same Group. That way I can transform them together. What am I doing wrong here?
// 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"
Chris Hill
@robotron2084
so i think what you want to do is create a GroupNode and AddChildNode your nodes to that. THEN AddNode that to the SceneNodeGroupModel3D. But I cannot give you a good reason why, as I'm still figuring this out as well. :)
Minsung
@nbright
There was no response on this question https://helixtoolkit.userecho.com/communities/1/topics/439-loading-issue-of-sharpdx-on-xbap. Is it available using HelixToolkit-SharpDx on the web?
Lunci
@holance
@redrabbit007 SceneNodeGroupModel3D only accepts SceneNode type. If you want to add WPF models, you need to use GroupModel3D.
Or change the arrowModel type to MeshNode
@nbright We no longer needs sharpdx_direct3d11_effects_x86.dll in HelixToolkit.SharpDX versions after v2.0 release
thienmenh294
@thienmenh294
In helixtoolkit.sharpdx, can I set rotation's center is model's center?
Lunci
@holance
@thienmenh294 Set Viewport3DX.FixedRotationPointEnabled = true and then set Viewport3DX.FixedRotationPoint to your model center.
Chris Hill
@robotron2084
@holance I have emailed you at the gmail address in the readme, in case you don't check that email very often. :)
John
@heyufei2008
Hi
<ht:BillboardVisual3D Position="6,10,3" Width="100" Height="100" Material="{ht:ImageMaterial roadsign.png, IsEmissive=true}"/>
How to set position of a billboardVisual3D?
what does the position mean?
Chris Hill
@robotron2084
@heyufei2008 A billboard contains a collection of ImageInfo objects, which define the positions of the billboards. The ImageInfo object defines a Position that can be used to define where the billboard should be placed.
thienmenh294
@thienmenh294
Hi
In Sharpdx, Model vibrates when zooming. How to fix it?
Lunci
@holance
@thienmenh294 Could you provide a sample to show the issue?
thienmenh294
@thienmenh294
How to send project
thienmenh294
@thienmenh294

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;
lookDirection.Normalize();
DieCreationWindow.ViewPort.Camera.LookDirection = lookDirection;
DieCreationWindow.ViewPort.Camera.LookAt(center3D, 0);

after using it then use the zoom to maximize, model vibrates

thienmenh294
@thienmenh294
Can I set PostEffectMeshXRay for GroupModel3D?
thienmenh294
@thienmenh294
How to always see a hidden Model?
Lunci
@holance
@thienmenh294 GroupModel3D doesn't support effect.
Not sure what you mean by show hidden model.
thienmenh294
@thienmenh294
How to always see a obscured Model?
thienmenh294
@thienmenh294
Do you know the cause of my model vibrates when zooming?
Lunci
@holance
@thienmenh294 You can create an issue in github upload a sample there.
thienmenh294
@thienmenh294
can I send a email to you?
Fichtelcoder
@FrankenApps
I would like to apply a runtime generated ImageTexture to a Cube. All that I am getting no matter how I tried is a white cube. This is my code. I would greatly appreciate any help or hint to what I am doing wrong.
public MainWindow()
        {
            InitializeComponent();

            Create3DViewPort();
        }

        private void Create3DViewPort()
        {
            var hVp3D = new HelixViewport3D{ 
                ShowFrameRate = true,
                ShowViewCube = true,
                ShowCoordinateSystem = true,
                ShowTriangleCountInfo = true
            };
            var lights = new DefaultLights();
            hVp3D.Children.Add(lights);

            var meshBuilder = new MeshBuilder();
            meshBuilder.AddBox(new Point3D(0, 0, 0.5), 1, 1, 1);

            hVp3D.Items.Add(new MeshGeometryVisual3D
            {
                MeshGeometry = meshBuilder.ToMesh(),
                Fill = GetTextMaterial("T")
            });

            hVp3D.Children.Add(new GridLinesVisual3D
            {
                Width = 8,
                Length = 8,
                MajorDistance = 1,
                MinorDistance = 1,
                Thickness = 0.01
            });

            h3dContainer.Children.Add(hVp3D);
        }

        private System.Windows.Media.Brush GetTextMaterial(string text)
        {
            Bitmap bmp = new Bitmap(64, 64);
            RectangleF rectf = new RectangleF(0, 0, bmp.Width, bmp.Height);

            Graphics g = Graphics.FromImage(bmp);
            g.SmoothingMode = SmoothingMode.AntiAlias;
            g.InterpolationMode = InterpolationMode.HighQualityBicubic;
            g.PixelOffsetMode = PixelOffsetMode.HighQuality;
            g.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;

            g.FillRectangle(System.Drawing.Brushes.Green, rectf);

            StringFormat format = new StringFormat()
            {
                Alignment = StringAlignment.Center,
                LineAlignment = StringAlignment.Center
            };

            g.DrawString(text, new Font("Tahoma", 8), System.Drawing.Brushes.Black, rectf, format);
            g.Flush();

            var bmpImage = Bitmap2BitmapImage(bmp);
            var material = MaterialHelper.CreateImageMaterial(bmpImage, 1, true);
            var imageBrush = new ImageBrush(bmpImage);
            return imageBrush;
        }

        private BitmapImage Bitmap2BitmapImage(Bitmap bitmap)
        {
            using (MemoryStream ms = new MemoryStream())
            {
                bitmap.Save(ms, ImageFormat.Png);
                ms.Position = 0;
                BitmapImage bi = new BitmapImage();
                bi.BeginInit();
                bi.StreamSource = ms;
                bi.EndInit();

                return bi;
            }
        }
}
Fichtelcoder
@FrankenApps
I suspect it has to do with the texture coordinates, but still I do not understand why I do not see any green, which I would expect in that case...
Lunci
@holance
@FrankenApps There are several parameters on mesh builder constructor. Make sure you set generate texture coordinate to true
F1e2r
@F1e2r
Hello! I am new to helix toolkit. I use helix toolkit wpf, everything great! And now I want to print HelixViewport3D (on real or PDF printer). I use PrintVisual method of PrintDialog and it works, but quality of image not so good as expected. It seems that wpf print it in wpf's standart 96 dpi, not in 300, 600 or 1200 dpi that I choose in printer settings. Is there any way to set dpi of image rendering for printing? Thanks in advance!
Fichtelcoder
@FrankenApps
sc.png
@holance I did. Sadly I still only see a white surface.
yonghua
@dayang
image.png