For bugs and new features, use the issue tracker located at GitHub.
Also try the chat room!
Problem mouse gestures when try using Helix with WPF 3.5
viettp wrote at 2011-09-23 10:04:
I must use WPF 3.5 (.NET 3.5) in my solution.
And I've tried build release of Helix in .NET 3.5.
When using the output .dll files (.xml files included) in an WPF4 application, it's ok. But when I try those .dll files with my WPF3.5 application (also with examples with setting in .NET 3.5), it didn't recognize mouse gestures.
Any advice??
viettp wrote at 2011-09-23 10:09:
Problem happened when I was trying to rotate the model in HelixViewbox3D
viettp wrote at 2011-09-23 11:43:
I've found the reason. Somehow binding in .NET 3.5 is different with in .NET 4.0.
In .NET 3.5, the bindings in those lines in theme "Generic.xaml" don't work:
<local:CameraController.InputBindings> <local:InputBindingX Gezture="{Binding Path=ResetCameraKeyGesture, RelativeSource={RelativeSource Mode=TemplatedParent}}" Command="{x:Static local:CameraController.ResetCameraCommand}"/> <local:InputBindingX Gezture="{Binding Path=RotateGesture, RelativeSource={RelativeSource Mode=TemplatedParent}}" Command="{x:Static local:CameraController.RotateCommand}"/> <local:InputBindingX Gezture="{Binding Path=PanGesture, RelativeSource={RelativeSource Mode=TemplatedParent}}" Command="{x:Static local:CameraController.PanCommand}"/> <local:InputBindingX Gezture="{Binding Path=ZoomGesture, RelativeSource={RelativeSource Mode=TemplatedParent}}" Command="{x:Static local:CameraController.ZoomCommand}"/> <local:InputBindingX Gezture="{Binding Path=ZoomRectangleGesture, RelativeSource={RelativeSource Mode=TemplatedParent}}" Command="{x:Static local:CameraController.ZoomRectangleCommand}"/> <local:InputBindingX Gezture="{Binding Path=ChangeFieldOfViewGesture, RelativeSource={RelativeSource Mode=TemplatedParent}}" Command="{x:Static local:CameraController.ChangeFieldOfViewCommand}"/> <local:InputBindingX Gezture="{Binding Path=ChangeLookAtGesture, RelativeSource={RelativeSource Mode=TemplatedParent}}" Command="{x:Static local:CameraController.ChangeLookAtCommand}"/> <local:InputBindingX Gezture="{Binding Path=ZoomExtentsGesture, RelativeSource={RelativeSource Mode=TemplatedParent}}" Command="{x:Static local:CameraController.ZoomExtentsCommand}"/> <local:InputBindingX Gezture="{Binding Path=ResetCameraGesture, RelativeSource={RelativeSource Mode=TemplatedParent}}" Command="{x:Static local:CameraController.ResetCameraCommand}"/> <local:InputBindingX Gezture="{Binding Path=TopViewGesture, RelativeSource={RelativeSource Mode=TemplatedParent}}" Command="{x:Static local:CameraController.TopViewCommand}"/> <local:InputBindingX Gezture="{Binding Path=BottomViewGesture, RelativeSource={RelativeSource Mode=TemplatedParent}}" Command="{x:Static local:CameraController.BottomViewCommand}"/> <local:InputBindingX Gezture="{Binding Path=LeftViewGesture, RelativeSource={RelativeSource Mode=TemplatedParent}}" Command="{x:Static local:CameraController.LeftViewCommand}"/> <local:InputBindingX Gezture="{Binding Path=RightViewGesture, RelativeSource={RelativeSource Mode=TemplatedParent}}" Command="{x:Static local:CameraController.RightViewCommand}"/> <local:InputBindingX Gezture="{Binding Path=FrontViewGesture, RelativeSource={RelativeSource Mode=TemplatedParent}}" Command="{x:Static local:CameraController.FrontViewCommand}"/> <local:InputBindingX Gezture="{Binding Path=BackViewGesture, RelativeSource={RelativeSource Mode=TemplatedParent}}" Command="{x:Static local:CameraController.BackViewCommand}"/> <local:InputBindingX Gezture="{Binding Path=OrthographicToggleGesture, RelativeSource={RelativeSource Mode=Self}}" Command="{x:Static local:HelixViewport3D.OrthographicToggleCommand}"/> </local:CameraController.InputBindings>
So, I write some additional binding code in HelixViewport3D.OnApplyTemplate() doing the same work:
if (this.cameraController == null) { this.cameraController = this.Template.FindName(PartCameraController, this) as CameraController; if (this.cameraController != null) { this.cameraController.Viewport = this.Viewport; this.cameraController.InputBindings.Add(new InputBinding(CameraController.RotateCommand, this.RotateGesture)); ... } }
I think this's a notable attention for you.
objo wrote at 2011-09-30 07:30:
thanks for the feedback, I will have a look at this soon.
I will check if setting the input bindings in code could help - note that the xaml also bind the gestures.
objo wrote at 2011-10-03 19:59:
I just tried building the library with .NET 3.5, and everything seems to work ok. The mouse gestures work just like they do in 4.0.
Can you try again, and let us know if you still have the problem.
viettp wrote at 2011-10-04 03:54:
If I compile HelixToolkit in .NET 3.5 AND use the library in a .NET 3.5 WPF project, the problem will happen
keithtmccartney wrote at 2011-10-31 14:37:
Hey there, I'm currently toying with the panorama sample but am having trouble alternating between the left mouse button (LMB) and the default right mouse button (RMB) for controlling the camera around the pano's.
How would I go about changing this gesture?
Thank you.
viettp wrote at 2011-10-31 16:11:
Search for InitBinding() function in solution, you'll see ;)
keithtmccartney wrote at 2011-11-01 11:55:
I'm having difficulty finding that function Việt.
I firstly used Ctrl+F to search the above throughout the entire solution, but found nothing.
I then searched throughout the HelixToolkit reference in the object browser, but could locate nothing.
I searched throughout Google with the above function as keywords, but located only Java-related articles, but did find one C#-related article with no thorough material that I could've used.
If you are able to assist me further please do so, I would really love to swop the default right-button manoeuvring to the left-button.
Thank you, Keith.
viettp wrote at 2011-11-01 16:57:
the function is CameraController.InitializeBindings() . Sorry for my mistake.
You can find these things in HelixToolkit project that make input structure:
---- The binding for intput: in file Themes\Generic.xaml
this contains the ControlTemplate for the HelixViewport3D. You can find tag CameraController.InputBindings in this file. It bind gestures with corresponding command of CameraController (a part of HelixViewport3D).
---- The gesture definitions: in file Controls\HelixViewport3D.cs
this contains default definitions for all mouse gesture. You can find RotateGestureProperty . It is set MouseAction.RightClick. Change it to MouseAction.LeftClick for your need.
---- The binding for commands: in file Controls\CameraController\CameraController.cs
in function InitializeBindings() you can see the binding for command with corresponding handler. If you want to change what to do with a command, you can make it here.
Regards,
Việt.
objo wrote at 2011-11-01 20:37:
thanks for replying to this question, Việt! You are right, the RotateGesture property should be used to change which mouse button to use. I think you can also add additional InputBindings to the HelixViewport3D instance, but I have not tested this.
keithtmccartney wrote at 2011-11-02 14:01:
Thank you very much for that Việt.
I have now implemented my panorama project with left-click mouse gesturing.
Also, I have updated my project to the now stable engine status.
Within the project there is jumping from panorama to panorama through xml.
However, I am experiencing problems with that very functionality whereas with engine version: 0.9.0.0 it worked suitably.
Below are links to the updated/original versions of the project.
Please help in debugging this, if availability prevents this, then I can resort to the original use of the version. Although, progress would be nice (I like the new 'Move' cursor, it's seemingly more fluid!).
Thank you Việt for your help, and thank you Objo for your wonderful engine.
Keith.
keithtmccartney wrote at 2011-11-02 14:33:
Here are the links (Mediafire):
Original: http://www.mediafire.com/?340cb7lcfbuc0vi
(If the 'PanoramaCube3D' Source is set to 'Opera' then the MouseWheel function should be set to GrandHotel, and vice versa.
The zoom point is in the XML. For 'Opera', the zoom point in on the steps to the very left of the 'Right' face between the two lights.
For 'GrandHotel', the zoom point is on the face - 'Back' - and is located on the policeman with horse foot-patrol.)
Updated (Present): http://www.mediafire.com/?9245lb63skc626t
Thanks.
objo wrote at 2011-11-02 19:56:
cool project, I like the way you zoom in to go to a new panorama :)
Reading the transition.xml didn't work with my culture (',' decimal point) - so I just added this line to your demo
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
The rotation gesture can be set by xaml:
<ht:HelixViewport3D.RotateGesture> <MouseGesture MouseAction="LeftClick"/> </ht:HelixViewport3D.RotateGesture>
or in code
myHelixView3D.RotateGesture = new MouseGesture(MouseAction.LeftClick);
I see there are a few more features to be added to the control (e.g. don't allow change of camera position, reset camera etc. in this application) but I don't have time to implement that myself right now.
keithtmccartney wrote at 2011-11-03 11:48:
Ahh, Objo, so you managed to transition onto a new panorama in the updated version?!
I am having difficulty doing this. There is no 'RotateGesture' in the original version which is why I am limited to progress with my alpha-state reference library.
Please do so continue working on those features and keep me notified of updated.
Or suggest to me some guidance on progressing them myself.
I'm currently trying to implement some visual cue's (hotspots) for multimedia, using the same ideology as that what I'm using for the transitioning hotspot's.
Would you be able to link me to a download of the project with the above fixes?
Thank you, Keith.
objo wrote at 2011-11-03 23:04:
hi Keith, I only checked that RotateGesture property worked as intended. Sorry I don't know why your hotspot code doesn't work. Did you consider using spherical coordinates for the hotspots?
TDxInput
rufus9876 wrote at 2011-10-07 08:34:
I had a look at the SpaceNavigatorDecorator.
The SpaceNavigatorDecorator within HelixToolkit.Input uses TDxInput (TDx.TDxInput.dll).
I was wondering about the origin of the dll (3dconnexion?) and if it is allowed to spread the dll together with any kind of project using the HelixToolkit3D?
objo wrote at 2011-10-07 09:02:
Go to 3dconnexion, register and accept their SDK license agreement
http://www.3dconnexion.com/service/software-developer/licence-agreement.html
TubeVisual over TubeVisual
terry_513 wrote at 2014-01-23 13:13:
I want to create a TubeVisual3D on a TubeVisual3D - inner tube & outer tube. I want the inner tube to be on the Outer tube -so inner tube can be visible over outer. My code is :-
<HelixToolkit:TubeVisual3D Path="-12 7 -1.45 -2 0.5 0 -8 -55 0.45" x:Name="myTube" Diameter="5" Fill="Gray" IsPathClosed="False"
/>
<HelixToolkit:TubeVisual3D Path="-10 5 -0.45 2 0.5 0 -8 -55 0.45" x:Name="myInnerTube" Diameter="2" Fill="White"
/>
But with this, myInnerTube (the inner tube) is seen behind the outer. How do I make it see the myInnerTube on the outer tube ?? What should I add in that tube control ?
Also I am not able to bind the Path of the TubeVisual3D.
<HelixToolkit:TubeVisual3D x:Name="tube1" Path="{Binding TubePipe}" Diameter="1.5" IsPathClosed="False"
Fill="#FFD61D1D"/>
// Code Behind
public WellBoreWindow()
{
InitializeComponent();
//Pipe = CreatePath();
TubePipe = CreateTubeVisual();
DataContext = this;
}
private IList<Point3D> CreateTubeVisual()
{
// -9 0 -0.45 -8 0.1 0 -9 0 0.45
List<Point3D> pts = new List<Point3D>();
pts.Add(new Point3D(-12, 0, 0.45));
pts.Add(new Point3D(-11, 0.1, 0));
pts.Add(new Point3D(-12, 0, 0.45));
return pts.ToList();
}
public IList<Point3D> TubePipe { get; set; }
It doesn't show naything, why so ??objo wrote at 2014-01-25 22:36:
I think this needs an approach similar to GLE - http://linas.org/gle/
2) Note that the
Path
dependency property is of type Point3DCollection
. It seems like the
Point3DCollectionConverter
converter only supports strings, not
IList<Point3D>
. You can work around by changing to TubePipe = new Point3DCollection(CreateTubeVisual());
You also need to change the points in your example (same reason as for #1) to see anything: pts.Add(new Point3D(-12, 0, 0.45));
pts.Add(new Point3D(-11, 0.1, 0));
pts.Add(new Point3D(-10, 0, 0.45));
terry_513 wrote at 2014-01-27 06:56:
My binding issue got resolved.
So u mean, I can't draw a tube on a tube. Then how an I achieve this goal....1) Sharp corners on the tube and extruded visuals are not supported.
I need to draw a tube, an inner tube in it (through which chemical/liquid passes). So got to show chemical, arrow also on it. Which control to use to achieve the goal....
I didn't get how GLE can help me with this...
Thanks
objo wrote at 2014-02-02 12:02:
GLE is a tubing and extrusion library for OpenGL, written in C. This library does proper joins - see http://linas.org/gle/join.html
I am not aware of anything similar in C#.
We can add it as a new feature in the issue list, but I think it is a rather big task to implement this.
Cracks in Texture of OBJ
cmouritsen wrote at 2014-01-31 00:49:
objo wrote at 2014-02-02 12:11:
What does the textures look like? Examine the edges in a image editor.
Could it be a problem with the ImageBrush? Are texture coordinates clamped in [0,1]?
cmouritsen wrote at 2014-02-19 15:40:
Thanks.
objo wrote at 2014-02-19 20:56:
I guess the problem is with the material since this is only a problem on the edges. Can you post the texture image?
You could also try changing the TileMode of the ImageBrush (my wild guess).
cmouritsen wrote at 2014-02-20 17:54:
Also, my colleague who knows more about 3D than I do thinks that the trouble crops up only where the UV map has a discontinuity, i.e., you have triangles that are adjacent in the mesh, but map to portions of the texture image that aren't adjacent to each other.
Finally, I have tried all of the different TileModes (I assume you mean in the CreateTextureBrush method?) and it didn't make any difference.
Thanks for your help.
objo wrote at 2014-02-20 20:53:
cmouritsen wrote at 2014-02-20 20:57:
Great. Thanks.
Rogad wrote at 2014-02-27 21:06:
Loads fine in MeshLab, but not in Helix...
objo wrote at 2014-02-27 23:04:
I will look into the OBJ importer when refactoring it to the new PCL library (#10023). This should include a test suite of OBJ models, also including models with ´texture cracks´.
Rogad wrote at 2014-02-27 23:20:
I've been doing a fair bit of work with my models so I am starting to understand better how OBJ files work. So I just drop my observations in here when I think they are useful.
badgerbadger wrote at 2014-05-28 17:08:
How to fill with tile texture?
veerammalkumaran wrote at 2014-08-01 08:53:
below is my XAML
<h:HelixViewport3D Name="viewPort3D" >
<h:SunLight />
<ModelVisual3D x:Name="vis3D">
</ModelVisual3D>
</h:HelixViewport3D>
below is my code var mb = new MeshBuilder(false, true);
IList<Point3D> pnts = new List<Point3D>();
pnts.Add(new Point3D(0, 0, 0));
pnts.Add(new Point3D(100, 0, 0));
pnts.Add(new Point3D(100, 100, 0));
pnts.Add(new Point3D(0, 100, 0));
mb.AddPolygon(pnts);
var mesh = mb.ToMesh(true);
ImageBrush brush = new ImageBrush();
brush.ImageSource = new BitmapImage(new Uri(@"C:\box.jpg"));
brush.TileMode = TileMode.Tile;
brush.ViewportUnits = BrushMappingMode.Absolute;
brush.ViewboxUnits = BrushMappingMode.Absolute;
brush.Stretch = Stretch.None;
brush.AlignmentX = AlignmentX.Left;
brush.AlignmentY = AlignmentY.Top;
brush.Viewport = new Rect(0, 0, brush.ImageSource.Width, brush.ImageSource.Height);
DiffuseMaterial mat = new DiffuseMaterial(brush);
GeometryModel3D gModel3D = new GeometryModel3D { Geometry = mesh, Material = mat };
vis3D.Content = gModel3D;
The above code doesn't work. What I missed in this?veerammalkumaran wrote at 2014-08-01 10:12:
below is the box.jpg
veerammalkumaran wrote at 2014-08-14 06:53:
http://uselesstechnical.wordpress.com/2014/08/14/helix-3d-toolkit-tile-texture/
HalfEdge mesh representation
govert wrote at 2012-02-03 13:57:
HalfEdge-based representations of unstructured polygonal meshes are common in contemporary mesh processing libraries like OpenMesh, VCG and CGAL. A previous discussion here mentioned the HalfEdge representations briefly, and I wanted to add some links I've run into recently and start a discussion on the topic, as some integration of such representations and related algorithms into the Helix Toolkit would be great (though not an urgent priority for me).
The typical HalfEdge implementations are template heavy C++ code, using traits to embed additional data into the structures. This makes the conversion of such data types to .NET quite tricky, though keeping some compatibility with the C++ data structures can be useful to ease porting of the processing algorithms to .NET.
Having a look around a bit, I found this article by Alexander Kolliopoupos which discusses the implementation issues and suggests an elegant implementation in C#: http://www.dgp.toronto.edu/~alexk/halfedge.pdf. He also has an open source (liberal zlib/libpng license) library that implements these data structures here: http://www.dgp.toronto.edu/~alexk/lydos.html. It doesn't look like it is actively maintained, but might be a good start for integrating such a mesh representation into the Helix Toolkit.
If other users have some experience working with HalfEdge or related mesh representations in .NET, I'd be interested in any pointers. I'm particularly interested in pragmatic algorithms for model repair, smoothing and simplification. I also wonder what people think about implementing these in C# vs. wrapping one of the C++- based libraries in a .NET wrapper. (The GPL licensing of the existing libraries is a bit of a problem for me.)
Any thoughts appreciated...
objo wrote at 2012-02-03 14:09:
This looks very interesting! Will have a look at Kolliopoulos' article and code.
objo wrote at 2012-02-21 21:29:
I tried to make a naive halfedge class using LINQ, but don't have time to finish it right now. I checked it into the examples anyway. See HalfEdgeMeshDemo. I hope to continue this class later, it's an interesting algorithm to explore :)
At this point I did not include any generic traits (as the referenced libraries do) and did not focus on performance, I just wanted to see if I could get the data structure right. I also added a Visual3D class that lets you point and click to see adjacent vertices/edges/faces.
Texture Can't be seen after loading
charismatubagus wrote at 2013-01-23 15:31:
Hi,
I have successfully displayed a 3ds file in my WPF scene. But, the material color is just black and no texture is applied on it.
<h:FileModelVisual3D x:Name="model3D" > <h:FileModelVisual3D.Transform> <Transform3DGroup> <ScaleTransform3D ScaleY="5.0" ScaleX="3.0" ScaleZ="2.0"/> <TranslateTransform3D OffsetX="0" OffsetY="3" OffsetZ="0"/> </Transform3DGroup> </h:FileModelVisual3D.Transform> </h:FileModelVisual3D>How can I load the texture as well automatically? Thanks in a million.
objo wrote at 2013-01-23 20:21:
is the texture in .tga format? .tga is not supported. Change the images to .png, and the importer will replace .tga with .png in the file names when loading the textures...
charismatubagus wrote at 2013-01-25 07:53:
The texture format is jpg. So you're saying I just need to convert the image format into png?
objo wrote at 2013-02-04 15:15:
zoras wrote at 2013-06-02 21:29:
My problem:
I'm reading all the .3ds and .obj file in the execution folder and loading them in a list where i can choose the one i want and show it in an HelixViewPort3D. All this part goes really well, the problem is with the texture. I don't see them at all :(
the way i'm loading the models:
FileModelVisual3D MyModel = new FileModelVisual3D();
MyModel.Source = MODELS[i]; //where MODELS[i] is a string containing the path of a model (i.e. .../.../ship.3ds)
this.view1.Children.Add(MyModel); //where view1 is my HelixViewPort3D
I also read in this forum that i can use the StudioReader. Well, i tried, but i cannot figure out on how convert the Model3D from the reader into something Visual that i can then add as a children to my viewport.
I also tried to use a ModelVisual3D in the .xaml file, like in this sample http://helixtoolkit.codeplex.com/discussions/354077, binding its content to MyModel, but it doesn't work for me, for two reasons: first of all it does not load the .obj file; second one, when it loads a .3ds, in the viewport i cannot see nothing :(
pls help! :(
i just want to show or attach the texture to my model! :)
thanks so much for the library!
objo wrote at 2013-06-08 07:24:
I recommend setting a breakpoint on line 527 in StudioReader.cs, then you can check if the texture is loaded correctly!
meshbuilder use in SurfacePlotDemo
lizichao wrote at 2011-07-09 10:44:
How to use meshbuilder in SurfacePlotDemo? I guess there should be a subclass of ParametricSurface3D. But I didnt find it.
Thanks.
Best regards!
objo wrote at 2011-07-11 11:58:
hi Lizichao,
I combined both the surface and the axes into the SurfacePlotVisual3D class in the demo. You can define the surface simply by setting the Points property.
This demo is currently not working with other Visual3Ds, but the plan is to move the axis visuals over to the HelixToolkit to make it easier to reuse!
VB.net simple program
rinaldin wrote at 2013-09-25 17:09:
I'm new to the Helix 3D Toolkit, and I just want to use it in VB.net programs. I started a new WPF project, referenced the libraries needed, and added the following code:
Imports System
Imports System.Collections.Generic
Imports System.Windows
Imports System.Windows.Media
Imports System.Windows.Media.Media3D
Imports HelixToolkit.Wpf
Class MainWindow
Dim visualChild As New ModelVisual3D
Dim plotmodel As New Model3DGroup
Private Sub Window_Loaded(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded
Dim label1 As GeometryModel3D = TextCreator.CreateTextLabelModel3D("test", Brushes.White, True, 32,
New Point3D(0, 0, 0),
New Vector3D(1, 0, 0), New Vector3D(0, 1, 0))
plotmodel.Children.Add(label1)
visualChild.Content = plotmodel
HelixViewport3D1.Children.Add(visualChild)
End Sub
End Class
The XAML code is:<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Prova" Height="378" Width="605" xmlns:h="http://helixtoolkit.codeplex.com" WindowStartupLocation="CenterScreen">
<Grid>
<h:HelixViewport3D HorizontalAlignment="Stretch" Name="HelixViewport3D1" VerticalAlignment="Stretch" Background="Black" Margin="0" TextBrush="White" CoordinateSystemLabelForeground="White" InfoForeground="White" />
</Grid>
</Window>
I get no error messages, but I expect to see in the viewport the string "text", but nothing happens! Can you help me please? I think this thread would be very important for who wants to start developing with Helix in VB.net.
Thank you,
Giovanni
rinaldin wrote at 2013-09-25 21:30:
I think there's a bug in the Helix code, because the code I posted worked fine, exept for the TextColor property in the line:
Dim label1 As GeometryModel3D = TextCreator.CreateTextLabelModel3D("test", Brushes.White, True, 32,
The value Brushes.White has no effect!!! The text is still rendered in black. I try to modify also the HelixViewport3D1.TextBrush property, but still no changes!
I'm opening a new issue on this site.
Giovanni
objo wrote at 2013-09-25 23:16:
rinaldin wrote at 2013-09-26 10:46:
plotmodel.Children.Add(New AmbientLight(Colors.White))
and all text has the proper color.Customer support service by UserEcho