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!

Color Interpolation for object surface

Ehsan M.A. 2 years ago in Question • updated by anonymous 3 months 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?


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()

private void Draw()

#region Camera Viewpoint of the 3D Model
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);

DefaultLights light = new DefaultLights();
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();

#region Base Link
Transform3DGroup baseLinkMove = new Transform3DGroup();
TranslateTransform3D baseLinkTranslate = new TranslateTransform3D();
baseLinkTranslate.OffsetX = 0;
baseLinkTranslate.OffsetY = 0;
baseLinkTranslate.OffsetZ = 0;


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

model3d.Content = group;

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


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


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;
baselink.Transform = arm;
baselink.Transform = arm;
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;
joint2.Transform = arm;
joint2.Transform = arm;
model3d.Content = group;


[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?


space navigator integration

JNK 3 years ago in Question 0


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.



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...


HelixToolkit.Wpf.SharpDX - Custom Shader

Anonymous 4 years ago 0
This discussion was imported from CodePlex

eonxxx wrote at 2014-08-14 12:11:

hi there a chance to use custom shaders in HelixToolkit.Wpf.SharpDX?
how does it works, if so?

do i need to use fx0.5 effects for it?

is it possible to use generated (shaderbytecode.compilefromfile) bytecode?

Texture coordinates from ObjReader

Anonymous 4 years ago 0
This discussion was imported from CodePlex

Lolligeir wrote at 2013-03-22 18:08:

Hey! Thanks for an awesome tool.

I am reading some obj files for a ray tracer and I have managed to read the Points of each triangle and the normals but the texture coordinate don´t seem to be working correctly. This is how I am reading the file:
            ObjReader r = new ObjReader();
            Model3DGroup model = r.Read(modelUrl);
            GeometryModel3D gm1 = (GeometryModel3D)model.Children[0];
            MeshGeometry3D mg1 = (MeshGeometry3D)gm1.Geometry;
            Vector3DCollection normals = mg1.Normals;     
            System.Windows.Media.PointCollection textureCoordinates = mg1.TextureCoordinates;
            System.Windows.Media.Int32Collection indices = mg1.TriangleIndices;
            Point3DCollection points = mg1.Positions;

            for (int index = 0; index < indices.Count; index += 3)
                Point3D p0 = points[indices[index]];
                Point3D p1 = points[indices[index + 1]];
                Point3D p2 = points[indices[index + 2]];          
                Vector3D n0 = normals[indices[index]];
                Vector3D n1 = normals[indices[index + 1]];
                Vector3D n2 = normals[indices[index + 2]];

                System.Windows.Point t0 = textureCoordinates[indices[index]];
                System.Windows.Point t1 = textureCoordinates[indices[index + 1]];
                System.Windows.Point t2 = textureCoordinates[indices[index + 2]];
This loads the correct points and normals but the texture coordinates come out wrong. Am I approacing this incorrectly? How do you read the correct texture coordinate for every face?

The obj file I have been using (Removed text after vertices to get the objReader to read it) :

Best regards,

How to use ExtrudedVisual3D to get a solid shape

jclu98 3 years ago in Question • updated by anonymous 1 year 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.


How to access different component from .3ds file

Anonymous 4 years ago 0
This discussion was imported from CodePlex

GhufranZahidi wrote at 2012-11-20 10:04:


I want to access multiple component from .3ds file by name and try to move particular component, is it possible if yes then give method name, please reply

Under review

HelixVisual3d not updating after created

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

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()

        Model3DGroup model = new Model3DGroup();


        this.Visual3DModel = model;

    public double Angle
            return (double)this.GetValue(AngleProperty);
           this.SetValue(AngleProperty, value);

    public double Radius
            return (double)this.GetValue(RadiusProperty);
            this.SetValue(RadiusProperty, value);

    public double Diameter
            return (double)this.GetValue(DiameterProperty);
            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;
        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();
    var container = new ContainerUIElement3D();

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,
WPF Media3D