This is the discussion forum for Helix Toolkit.
For bugs and new features, use the issue tracker located at GitHub.
Also try the chat room!
+2

Viewcube image

Denwood 3 years ago in Question 0
I want to add an image to my Helix viewcube( all 6 directions). How to do it?
WPF
+1

AddExtrudedGeometry problem

MCv 7 months ago in Question 0

Hi Everyone,

I'm trying to create a simple 3d object, extruded one out of 4 pairs of 2D coordinates. But what I'm getting - is a 2d object. I can't understand: it's a my mistake or something else is wrong?


Here is my xaml code:

<Grid>
        <helix:HelixViewport3D x:Name="view1" Background="LightBlue" IsHeadLightEnabled="True" >

            <helix:MeshGeometryVisual3D  MeshGeometry="{Binding GlassGeometry}" Fill="White"/>
        </helix:HelixViewport3D>
    </Grid>


And code behind method:

  public MeshGeometry3D GlassGeometry
        {
            get
            {
                var builder = new MeshBuilder(true, true);                 List<Point> pints2D = new List<Point>()
                {
                    new Point(-1, -1),
                    new Point(0, -1),
                    new Point(1, 1),
                    new Point(-1, 1)
                };
                Point3D sp = new Point3D(0, 0, 0);
                Point3D ep = new Point3D(0, 0, 1);

               builder.AddExtrudedGeometry(pints2D, new Vector3D(1,0, 0), sp, ep);

                return builder.ToMesh(true);
            }

What I'm expecting to see is just a cube(in this case). But in the future I would like to get something like this:



But now my result looks like:

Or is it a possibility to create a 3d Object in code using 8 pairs of 3D coordinates?

Thank you in advance.

WPF
+1

Color Interpolation for object surface

Ehsan M.A. 2 years ago in Question • updated by anonymous 1 month ago 2

I have a mesh, say for example a triangle with three corners p1, p2 and p3.

i want to create a gradient that cause for example color C1 in P1 corner of triangle, C2 in P2 corner and C3 in P3 corner. Please note that C1 and C2 and C3 are different.

Any idea on how to do it?

+1

I can't use Helix toolkit to viewport multiple model part at the same time

Philip 2 years ago in Question • updated by anonymous 1 year ago 1

Hi Everyone,

I've got an existing Winsform application that model a multi-joint robotic arm, that allows the user to use a trackbar to rotate each joint for a certain degree (snipping of the winsform app below).


Since I've worked out the TranslateTransform and RotateTransform relationship in 2D drawing, I did like to convert it to 3D. I heard that helix toolkit is very good at 3D modelling things. Since I never used it before, so I would like to give helix toolkit a try. What I'm doing is draw the robot arm in wpf and use elementhost to host the drawing in winsform, and in the end aim to achieve the same results as above but in 3D. Currently I applied the same logic I used for the 2D modelling, but with set rotation angle and translation length, as well as I'm trying to get 2 joints connected.

Yet when I run my code, instead of both joints being display (similar to picture above), only 1 joint is present (as shown in picture below).

I don't understands what I did wrong, and since there is very limited documentation available I can't debug and solve the problem myself. So I hope to seek help and solution here.

below is my code:

using System;

using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.IO.Ports;
using System.Windows.Threading;
using HelixToolkit.Wpf;
using HelixToolkit;
using System.Windows.Media.Media3D;

namespace _3DModel
{
/// <summary>
/// Interaction logic for Drawing.xaml
/// </summary>
public partial class Drawing : UserControl
{
HelixViewport3D viewport = new HelixViewport3D();

public Drawing()
{
InitializeComponent();
Draw();
}

private void Draw()
{

#region Camera Viewpoint of the 3D Model
//camera
this.ArmCanvas.Children.Add(viewport);
viewport.DefaultCamera = new PerspectiveCamera();
viewport.DefaultCamera.Position = new Point3D(0, 600, 600);
viewport.DefaultCamera.LookDirection = new Vector3D(0, -600, -600);
viewport.DefaultCamera.UpDirection = new Vector3D(0, 1, 0);

//lighting
DefaultLights light = new DefaultLights();
viewport.Children.Add(light);
#endregion
Model3D joint2, joint3, joint4, joint5, joint6, joint7, baselink;
ModelVisual3D model3d = new ModelVisual3D();
Model3DGroup group = new Model3DGroup();
ModelImporter import = new ModelImporter();

baselink = import.Load(@"C:\Users\tombf\Desktop\Winsform 3D Model\Base Link.obj");
joint2 = import.Load(@"C:\Users\tombf\Desktop\Winsform 3D Model\Link.obj");
joint3 = joint2.Clone();
joint4 = joint2.Clone();
joint5 = joint2.Clone();
joint6 = joint2.Clone();
joint7 = joint2.Clone();

viewport.Children.Remove(model3d);
/*
#region Base Link
Transform3DGroup baseLinkMove = new Transform3DGroup();
TranslateTransform3D baseLinkTranslate = new TranslateTransform3D();
baseLinkTranslate.OffsetX = 0;
baseLinkTranslate.OffsetY = 0;
baseLinkTranslate.OffsetZ = 0;

baseLinkMove.Children.Add(baseLinkTranslate);


RotateTransform3D baseLinkRotate = new RotateTransform3D();
baseLinkRotate.Rotation = new AxisAngleRotation3D(new Vector3D(0, 0, 0), 0);
baseLinkMove.Children.Add(baseLinkRotate);
baselink.Transform = baseLinkMove;

group.Children.Add(baselink);
model3d.Content = group;
viewport.Children.Add(model3d);
#endregion

#region 1st Joint
Transform3DGroup firstJointMove = new Transform3DGroup();
TranslateTransform3D firstJointTranslate = new TranslateTransform3D();
firstJointTranslate.OffsetX = 10;
firstJointTranslate.OffsetY = 0;
firstJointTranslate.OffsetZ = 0;

firstJointMove.Children.Add(firstJointTranslate);


RotateTransform3D firstJointRotate = new RotateTransform3D();
firstJointRotate.Rotation = new AxisAngleRotation3D(new Vector3D(0, 0, 0), 10);
firstJointMove.Children.Add(firstJointRotate);
joint2.Transform = firstJointMove;
group.Children.Add(joint2);
model3d.Content = group;
viewport.Children.Add(model3d);
#endregion

//viewport.Children.Add(model3d);
*/

Transform3DGroup arm = new Transform3DGroup();

TranslateTransform3D armTranslate = new TranslateTransform3D();
RotateTransform3D armRotate = new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 0, 1), 0));
armTranslate.OffsetX = 0;
armTranslate.OffsetY = 0;
armTranslate.OffsetZ = 0;
arm.Children.Add(armTranslate);
baselink.Transform = arm;
arm.Children.Add(armRotate);
baselink.Transform = arm;
group.Children.Add(baselink);
model3d.Content = group;

armTranslate = new TranslateTransform3D();
armRotate = new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(0, 0, 1), 180));
armTranslate.OffsetX = 20;
armTranslate.OffsetY = 0;
armTranslate.OffsetZ = 0;
arm.Children.Add(armTranslate);
joint2.Transform = arm;
arm.Children.Add(armRotate);
joint2.Transform = arm;
//arm.Children.Add(joint2.Transform);
group.Children.Add(joint2);
model3d.Content = group;
viewport.Children.Add(model3d);
}
}
}


+1

[SharpDX] Why does my model look better when using the deferred RenderTechnique instead of e.g. Blinn/Phong

Daniel Zibion 2 years ago in Question • updated 2 years ago 1

Hello everyone,


When visualizing geometry in the sharpDX viewport, I noticed that all the edges are very jagged and not smooth at all.


Blinn Rendering


Deferred Rendering

This got a lot better when switching to the deferred rendering.

Is this normal? Is there maybe a way to improve the anti aliasing for the default rendering that I'm not aware of?

SharpDX
+1

space navigator integration

JNK 2 years ago in Question 0

Hello,

I have a 3D connexion space navigator. What I must do for integration of this 3D space navigator in my WPF helix toolkit project. Exists some sample?

Thank you very much.

JNK

+1

Reference bugs in examples/source?

zangatsu 3 years ago in Question • updated 3 years ago 0

Hi I just downloaded the newest source of the helix-toolkit. I wanted to get through all the examples to learn about the application, but unfortunately I get a lot of reference errors and I do not know why. I could solve most of them by reinstalling NuGetPackages and adjusting the fakes assemblies, however there are still a lot left. For example in MainViewModel:BaseViewModel class I get the reference error:




Error CS0246 The type or namespace name 'Camera' could not be found (are you missing a using directive or an assembly reference?) DemoCore _NET40 C:\..\helix-toolkit-master\Source\Examples\WPF.SharpDX\DemoCore\BaseViewModel.cs 29 Active.


This goes on with RenderTechnique, IEffectsManager and so on.


Do you have any solution? My references in DemoCore_NET40 all seem to work fine, at least I am getting no yellow symbol in the solution explorer...


SharpDX WPF
+1

How to use ExtrudedVisual3D to get a solid shape

jclu98 3 years ago in Question • updated by anonymous 11 months ago 1

I was able to use ExtrudedVisual3D to get a extruded shape along a 3D path. But how do I make it solid? Right now, the extruded shape I got is hollow (means you can see through). How do I make it solid or at least add caps to both ends. I already spent many days on this but still could not figure out.

WPF
+1
Under review

HelixVisual3d not updating after created

Rodrigo Basniak 4 years ago in Question • updated by Franz Spitaler 2 years ago 5
Hi,

I'm need to show a circular torus on the viewport. The closest option I found was the HelixVisual3D, but it has open ends. So I tried to create my own class to draw this, with a HelixVisual3D and two thin cones to close the ends. I used the classes from the Building Demo as reference, so I came up with this:

public class TorusVisual3D : UIElement3D
{
    public static readonly DependencyProperty AngleProperty = DependencyPropertyEx.Register("Angle", 90, (s, e) => s.AppearanceChanged());
    public static readonly DependencyProperty RadiusProperty = DependencyPropertyEx.Register("Radius", 0.35, (s, e) => s.AppearanceChanged());
    public static readonly DependencyProperty DiameterProperty = DependencyPropertyEx.Register("Diameter", 0.1, (s, e) => s.AppearanceChanged());

    private GeometryModel3D torus = new GeometryModel3D();
    private GeometryModel3D cap1 = new GeometryModel3D();
    private GeometryModel3D cap2 = new GeometryModel3D();

    public TorusVisual3D()
    {
        AppearanceChanged();

        Model3DGroup model = new Model3DGroup();

        model.Children.Add(this.torus);
        model.Children.Add(this.cap1);
        model.Children.Add(this.cap2);

        this.Visual3DModel = model;
    }


    public double Angle
    {
        get
        {
            return (double)this.GetValue(AngleProperty);
        }
        set
       {
           this.SetValue(AngleProperty, value);
       }
    }

    public double Radius
    {
        get
        {
            return (double)this.GetValue(RadiusProperty);
        }
        set
        {
            this.SetValue(RadiusProperty, value);
        }
    }

    public double Diameter
    {
        get
        {
            return (double)this.GetValue(DiameterProperty);
        }
        set
        {
            this.SetValue(DiameterProperty, value);
        }
    }

    private void AppearanceChanged()
    {
        Material mat = MaterialHelper.CreateMaterial(Utils.GetRandomColor());

        HelixVisual3D h = new HelixVisual3D();
        h.Origin = new Point3D(0, 0, 0);
        h.Diameter = Diameter;
        h.Turns = Angle / 360.0;
        h.Radius = Radius;
        h.Length = 0;
        h.BackMaterial = mat;
        h.Material = mat;
        h.UpdateModel();
        this.torus = h.Model;

        MeshBuilder cap1Builder = new MeshBuilder(false, false);
        Point3D p1 = new Point3D(0, Radius, 0);
        cap1Builder.AddCone(p1, new Vector3D(0, 1, 0), h.Diameter / 2, h.Diameter / 2, 0.0001, true, true, 40);
        this.cap1.Material = MaterialHelper.CreateMaterial(Colors.Yellow);
        this.cap1.Geometry = cap1Builder.ToMesh();


        MeshBuilder cap2Builder = new MeshBuilder(false, false);
        Point3D p2 = new Point3D(-1, 0, 0);
        cap2Builder.AddCone(p2, new Vector3D(1, 0, 0), h.Diameter / 2, h.Diameter / 2, 0.0001, true, true, 40);
        this.cap2.Material = MaterialHelper.CreateMaterial(Colors.Red);
        this.cap2.Geometry = cap2Builder.ToMesh();
    }
}

To draw it I'm using the following code: 

    TorusVisual3D t = new TorusVisual3D();
    t.Angle = m_angle;
    t.Radius = m_radius1;
    t.Diameter = m_radius2 * 2.0;
    t.Transform = new TranslateTransform3D(0, 0, 0);
    ModelVisual3D model = new ModelVisual3D();
    model.Children.Add(t);
    var container = new ContainerUIElement3D();
    container.Children.Add(model);
    viewport.Children.Add(container);

The problem is that the Helix is drawn with the default values (Radius=0.35, Diameter=0.1 and Angle=90) and is never updated again. No matter what values I set on the Properties, it stays the same. The both cylinder are updated correctly, just the Helix isn't.

What am I'm doing wrong?

Thanks in advance,
Rodrigo
WPF Media3D
+1

Show wireframe as quads with Helix and SharpDX

Raul Burgos 3 years ago in Question • updated by anonymous 1 month ago 19
Hello,
Is it possible to get this effect ( Connected Mesh to QuadFaces ) in the viewportDX when a .OBJ model is readed on it?.
I'm using HelixToolkit.Wpf.SharpDX.
Somebody can post a example?
Thanks in advance.

SharpDX WPF