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!
0

Custom Color to CoordinateSystemVisual

Anonymous 10 years ago updated by RS_FE 4 years ago 1
This discussion was imported from CodePlex

Goodlad wrote at 2014-07-19 09:47:

Hello,

I am trying to change the axis color on the CoordinateSystemVisual3d, but I can only get the black or the default (green, red, blue colors).
            <helix:CoordinateSystemVisual3D x:Name="Cord" ArrowLengths="10">
                <helix:CoordinateSystemVisual3D.XAxisColor>
                    <Color R="152" B="152" G="152"/>
                </helix:CoordinateSystemVisual3D.XAxisColor>
                <helix:CoordinateSystemVisual3D.YAxisColor>
                    <Color R="30" B="187" G="238"/>
                </helix:CoordinateSystemVisual3D.YAxisColor>
                <helix:CoordinateSystemVisual3D.ZAxisColor>
                    <Color R="68" B="35" G="80"/>
                </helix:CoordinateSystemVisual3D.ZAxisColor>
            </helix:CoordinateSystemVisual3D>
Thanks for any help,
John
0

Better way to load multiple models ?

Anonymous 10 years ago 0
This discussion was imported from CodePlex

Rogad wrote at 2013-12-08 18:10:

I was wondering if there is a better way to do this :
            ObjReader CurrentHelixObjReader = new ObjReader();
            neutral = CurrentHelixObjReader.Read("C:/Users/Roger/Desktop/cutie1/cutie.obj");

            ObjReader CurrentHelixObjReader2 = new ObjReader();
            anger = CurrentHelixObjReader2.Read("C:/Users/Roger/Desktop/cutie1/cutie_ExpressionAnger.obj");

            ObjReader CurrentHelixObjReader3 = new ObjReader();
            smile = CurrentHelixObjReader3.Read("C:/Users/Roger/Desktop/cutie1/cutie_ExpressionSmileOpen.obj");

            ObjReader CurrentHelixObjReader4 = new ObjReader();
            blink = CurrentHelixObjReader4.Read("C:/Users/Roger/Desktop/cutie1/cutie_ModifierBlinkLeft.obj");
So you can see I am loading 4 models.

I was thinking I could do this, but the individual models do not load, I think it's just loading the first one four times but I am not sure.
            ObjReader CurrentHelixObjReader = new ObjReader();
            neutral = CurrentHelixObjReader.Read("C:/Users/Roger/Desktop/cutie1/cutie.obj");
            anger = CurrentHelixObjReader.Read("C:/Users/Roger/Desktop/cutie1/cutie_ExpressionAnger.obj");
            smile = CurrentHelixObjReader.Read("C:/Users/Roger/Desktop/cutie1/cutie_ExpressionSmileOpen.obj");
            blink = CurrentHelixObjReader.Read("C:/Users/Roger/Desktop/cutie1/cutie_ModifierBlinkLeft.obj");

Rogad wrote at 2014-02-15 19:00:

Still stuck on this, anyone have any ideas ?

objo wrote at 2014-02-18 08:39:

The first code is correct, but I am considering adding an issue on refactoring the importers so it looks more like the second version. The exporters were recently refactored so they could be reused.
0

I wrote a pretty ugly hack for the ViewCubeVisual3D

Anonymous 10 years ago 0
This discussion was imported from CodePlex

Johan20D wrote at 2014-02-17 21:16:

It snaps to the closes 90° increment and then rotates 90° on each single click. The rotation would be nicer with arrows outside the cube. Not nice enough for a pull request, still useful imo.
        private void FaceMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (!this.IsEnabled)
            {
                return;
            }

            var faceNormal = this.faceNormals[sender];
            var faceUp = this.faceUpVectors[sender];

            var lookDirection = -faceNormal;
            var upDirection = faceUp;
            lookDirection.Normalize();
            upDirection.Normalize();

            // Double-click reverses the look direction
            if (e.ClickCount == 2)
            {
                lookDirection *= -1;
                if (upDirection != this.ModelUpDirection)
                {
                    upDirection *= -1;
                }
            }

            if (this.Viewport != null)
            {
                var camera = this.Viewport.Camera as ProjectionCamera;
                if (camera != null)
                {
                    var target = camera.Position + camera.LookDirection;
                    double distance = camera.LookDirection.Length;
                    lookDirection *= distance;
                    var newPosition = target - lookDirection;
                    Vector3D crossProduct = Vector3D.CrossProduct(upDirection, lookDirection);
                    var vector3Ds = new[] { upDirection, -1*upDirection, crossProduct, -1*crossProduct };
                    double dp = 95;
                    foreach (var v in vector3Ds)
                    {
                        double tdp =Vector3D.AngleBetween(camera.UpDirection, v);
                        if (tdp < dp)
                        {
                            dp = tdp;
                            upDirection = v;
                        }
                    }
                    if (Vector3D.AngleBetween(upDirection, camera.UpDirection)  < 0.1)
                    {
                        var rot = new RotateTransform3D(new AxisAngleRotation3D(
                                  lookDirection, 90));
                        upDirection = rot.Transform(upDirection);
                    }
                    CameraHelper.AnimateTo(camera, newPosition, lookDirection, upDirection, 500);
                }
            }

            e.Handled = true;
            this.OnClicked(lookDirection, upDirection);
        }

objo wrote at 2014-02-18 08:37:

thanks for sharing your code - I will have a look at this when I get time :)
0

Can opacity issue be resolved with SharpDX fork ??

Anonymous 10 years ago 0
This discussion was imported from CodePlex

geoarsal wrote at 2014-02-18 06:02:

I was wondering, by using the sharpdx fork of helix toolkit, would the transparency be treated as they should be in 3D??

Case:
There are two semi-transparent planes cutting each other in the scene. This case can't be handled in WPF3D due the fact the models are not depth sorted. Even with the depth sorting, as the planes are cutting each other so one plane will partially hide the other.

Using sharpdx fork, would this case be handled as it is in WPF3D(one plane partially hiding other) or would this case be handled properly (both planes are partially visible from every angle)

objo wrote at 2014-02-18 08:34:

I know improved transparency methods are planned on the sharpdx fork, but it is not there yet.
0

HelixViewport3D is missing when using Prism to load the user control to a region

Anonymous 10 years ago 0
This discussion was imported from CodePlex

sowen wrote at 2014-02-04 19:48:

Hi,

don't know if anyone has experienced this:

I try to put HelixViewport3D in a user control like this
    <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
        <h:HelixViewport3D ZoomExtentsWhenLoaded="True"
            x:Name="HelixViewport"
            Width="{Binding ActualWidth, ElementName=Container, Mode=OneWay}" 
            Height="{Binding Height, ElementName=Container, Mode=OneWay}">
            <h:SunLight />
        </h:HelixViewport3D>
    </Grid>
and in my Shell.xaml, I have this
<ContentControl cal:RegionManager.RegionName="MainCanvasRegion" Width="auto" Height="auto" />
Next, I use Prism to load the UserControl to the region like this
            _regionManager.RegisterViewWithRegion(Constants.RegionNames.MainCanvasRegion,
                                                  () => _container.Resolve<HelixCanvasView>());
the user control is placed to the ContentControl, but the user control has nothing in it.

I use Snoop to check. In the visual tree, the HelixCanvasView is in the tree, but underneather, it has nothing. Everything is gone. Very strange.

The way I am using Prism is correct. The shell has other regions, and other user controls are loaded properly. It's only this user control with HelixViewport3D. Well, technically, the control is loaded, but the HelixViewport3D is kicked out.

Does anyone know why?


Thanks

sowen wrote at 2014-02-05 15:57:

ok, I found out the problem of this issue. It's not really related to Helix control.

It feels more like a Microsoft bug.

For testing purpose, I was using a static resource of array for the items source, but as long as it's there, it kicks out the InitializeComponent method. So my user control becomes blank.

It's very strange, because the same way of defining the static resource works fine in Windows-level. The problem is only in the User Control level. and I can't find any reason or solution to it.
0

Using transparent PNGs for textures

Anonymous 10 years ago 0
This discussion was imported from CodePlex

Rogad wrote at 2014-02-09 23:37:

Hi,

I am doing quite well with my modelling. Got a little stuck though. Does HELIX allow for the use of transparent PNGs as a texture ?

I'm trying to get my human model's eyelashes to show up but they don't. I know I am locating the image okay because when I try to load a jpg in there it appears where the eyelashes should be.

The original texture for the eyelashes used alpha channel, but I don't think we can do that with HELIX at this time.

So, I used created a PNG of them instead, but then nothing appears at all. Surely something should appear ?

This is how the material looks in the MTL file :
newmtl 6_Eyelash
d 1
Kd 1 1 1
map_Kd Maps/V5BreeLashes1.png
I also made sure that the eyelashes are loaded last, as I was reading that transparent objects need to come last. Not sure if that's appropriate for what I am doing though.

Any thoughts ?

Rogad wrote at 2014-02-10 18:00:

I am so silly. I had two folders as I had to convert the alpha maps to PNG. Of course I forgot to transfer the eyelashes PNG to the working folder. So it was not finding it.

Shoot me now. All working once I had the ordering correct - transparencies need to come last !


0

TextureAddressMode

Anonymous 10 years ago updated by anonymous 7 years ago 1
This discussion was imported from CodePlex

Nikodem wrote at 2013-12-13 13:08:

Hello,

I have an application with Helix 3D Toolkit.
I am using seamless texture and I need to mapping textures (jpg) on the mesh in repeated mode (wrap mode).

mGeometries.Add(new GeometryModel3D(mesh, new DiffuseMaterial(imgBrush)));

for the imgBrush I need to have imgBrush with Wrap mode texture.

In the DirectX is enumerator TextureAddressMode.

http://msdn.microsoft.com/en-us/library/windows/desktop/bb206366(v=vs.85).aspx

How can I do this?

Many thanks
Jindrich

objo wrote at 2013-12-16 18:27:

0

Setting the Main View Model content.

Anonymous 10 years ago 0
This discussion was imported from CodePlex

Rogad wrote at 2013-12-04 20:23:

I'm working with the SimpleDemo and getting stuck as I am new to C#.

I see this in the code :
        /// <summary>
        /// Gets or sets the model.
        /// </summary>
        /// <value>The model.</value>
        public Model3D Model { get; set; }
I assume this is going to load and get the current model in the scene ?

So how can I load a model from outside of the MainViewModel.cs ?

Hopefully I can explain where I am. I reduced the size of the HelixViewPort and added a slider and a text box. At this point I am just playing, but lets say I want the slider to trigger models. So when it is to the right it is one model and to the left a different model.

I have some code I came up with for the form :
namespace ExampleBrowser
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    /// 

using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Media3D;

using HelixToolkit.Wpf;

    public partial class MainWindow : Window
    {
        public static int foo;

        public MainWindow()
        {
            InitializeComponent();
            this.DataContext = new MainViewModel();
        }

        public void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {

            ObjReader CurrentHelixObjReaderb = new ObjReader();
            Model3DGroup MyCube = CurrentHelixObjReaderb.Read("C:/Users/Roger/Desktop/cube/cube-long.obj");

            // And now what ?!


        }

        
    }
}
Here's an image of my form that may help :




I'm just stuck on loading the model into the viewer. I can do it in the MainViewModel.cs quite easily
ObjReader CurrentHelixObjReaderb = new ObjReader();
            Model3DGroup MyEnd = CurrentHelixObjReaderb.Read("C:/Users/Roger/Desktop/cube/cube-long.obj");

            this.Model = MyEnd;
But due to C# being new to me I don't know how to do it elsewhere, like make it global or something.

Many thanks for any help :)

Rogad wrote at 2013-12-05 17:10:

Please delete this thread if you see fit. I realise I was leading myself up a blind alley.
0

HelixToolkit.SharpDX.Wpf_NET40 example run

Anonymous 10 years ago 0
This discussion was imported from CodePlex

cedrelo wrote at 2013-11-06 13:40:

Hi,

First, thanks for your work with helixtoolkit!
I use it to create a 3D application to display model 3D in .stl

Now i want to try your fork HelixToolkit.SharpDX.Wpf_NET40, but it is impossible to run and try the example.

It writes "Error registering effect, unable to load d3dcompiler_43.dll"

Could you help me ?

Thanks

Cédric

cedrelo wrote at 2013-11-06 15:05:

I put d3dcompiler_43.dll in c:/windows/system32


and now i have

"Tentative de chargement d’un programme de format incorrect. (Exception de HRESULT : 0x8007000B)"

"Attempt to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)"

Any help would be fine ?


Cédric

przem321 wrote at 2013-12-02 20:28:

If you have errors with missing DirectX dlls (e.g. d3dcompiler_42.dll is missing) try installing the DirectX 2010 End-Users Runtime from: http://www.microsoft.com/en-us/download/details.aspx?id=8109 That applies also to Windows 8/8.1 even if it comes with a DX SDK.
0

Learning Helix3D while learning WPF help

Anonymous 10 years ago 0
This discussion was imported from CodePlex

David_NET wrote at 2013-11-23 01:21:

I am playing with Terrain Example

Currently the Source refers to a file to be uploaded using SurfacePlotVisual3D's

UpdateModel()

I am testing to use Helix3D as usercontrol through ElementHost in WinForm application

I am trying to figure out how to pass a new fileName string from WinForm so that I could define UpdateModel( FileName) and choose new file to load 3D data during run time.

Anyone know any example which I could study?
D.

objo wrote at 2013-12-02 20:01:

Sorry, I don't know how to use it from winforms.