For bugs and new features, use the issue tracker located at GitHub.
Also try the chat room!
Best place to trigger element sorting when camera position changes
PhilDotC wrote at 2014-04-17 23:12:
objo wrote at 2014-04-29 10:18:
Should the billboards be shown behind or in front of the other objects in the scene?
Can you create an example/demo?
PhilDotC wrote at 2014-04-29 13:02:
Download demo solution zip file
If you pan around you will see that depending upon which direction you are looking from the transparency works or doesn't depending on which billboard is nearest the camera. I need to add code to sort the viewport contents depending on their distance from the camera but I am unsure where to hook this in. It would be nice if the was a camera position changed event or something like that or perhaps you can suggest a better solution.
objo wrote at 2014-05-05 15:03:
I created https://helixtoolkit.codeplex.com/workitem/10046
How to render an arch
My math/geometry is a bit rusty, but I can puzzle it out.
Thank you...
Problems with textures in complex OBJ files.
_ViSoR_ wrote at 2011-11-02 00:47:
Hello,
I have model that is a composition of 17 parts. Each part uses same material with texture. This model is stored as .OBJ file and looks fine in the 3D Studio Max, but Helix renders it with incorrect positions and scallings of the textures.
Helix 2011.7 and 2010.10 produce same result.
3D Studio Max: http://i.imgur.com/lfDUf.png
Helix 3D: http://i.imgur.com/UyPOO.png
Texture: http://i.imgur.com/W2SSP.jpg
Matherial description file: http://pastie.org/2796173
What can I do for correct rendering? Same behavior if model is saved as .3DS file. Model is about 8MB and can't be imported by Expression Blend - it crashes on import.
Thanks,
Vladimir
objo wrote at 2011-11-02 19:58:
hi Vladimir, can you also upload the .obj file?
_ViSoR_ wrote at 2011-11-02 20:11:
Hi,
It is link to the full package http://dl.dropbox.com/u/11097641/roomba_625.zip
Vladimir
objo wrote at 2011-11-03 23:11:
thanks, I see there is an error in the handling of texture coordinates here. I didn't find the bug yet, the texture coordinates (only flipped in Y direction) looks correct. Does anyone know how texture coordinates are scaled in obj files? It seems like some files have texture coordinates in ranges like [-5,5], when I expected [0,1]...
ps. MeshLab is great for testing these files!
bcblanka wrote at 2012-02-28 14:51:
Hi objo,
I think this bug is caused by the viewport unit of the image brush applied on the material. http://msdn.microsoft.com/en-us/library/system.windows.media.tilebrush.viewportunits.aspx
Here is the change I made in the code to make this OBJ model display correctly: ObjReader.cs, line 798
var textureBrush = new ImageBrush(img) { Opacity = this.Dissolved, ViewportUnits = BrushMappingMode.Absolute };
I have tested this fix on a few OBJ models and they are displayed correctly.
PS: Do you know already what is the date of the next stable release?
Cheers,
Blanka
bcblanka wrote at 2012-02-29 11:49:
I found some OBJ files where the BrushMappingMode.Absolute is breaking the texture, so this fix is not quite right. Those OBJ models have texture coordinates outside the 0-1 interval.
objo wrote at 2012-03-10 16:36:
thanks for the ViewportUnits fix - I submit it even if you have seen errors when the texture coordinates are outside [0,1]. It seems to work well on the roomba model. We should make some simple test .obj files with different variations on texture coordinates.
release plan: No, there is no release schedule since this is a side project without deadlines :) But I try to keep the default branch as stable as possible so you can always use the latest version. The Nuget package is updated at every build. The downloads are updated manually, when some bugs have been fixed or major features have been added. But I will try to make a roadmap for the project, listing some ideas of what could be added/improved...
objo wrote at 2012-03-11 20:36:
See change set f96d75e7d15a. Adding TileMode = TileMode.Tile to the ImageBrush seems to help. I also added three texture test models - they are all working now.
Disable double click from right button to centre camera
Marcwell wrote at 2014-04-22 11:38:
I can't get a few thing to work however:
- if I long-press (or double click with the right mouse button) the view is centred and zoomed in.
- When I touch the screen, the round grey circle in the middle of the screen appears even though nothing is rotated.
Thank you, regards.
objo wrote at 2014-04-29 10:11:
https://helixtoolkit.codeplex.com/workitem/10035
https://helixtoolkit.codeplex.com/workitem/10036
UP direction swapped ?
steunissen wrote at 2010-10-29 14:51:
Hi there. First of all : Great great work !! Really usefull.
But I have an issue. I used to be displaying my 3D model with the <Viewport3D>.
Now I converted to <HelixView3D>. But the "up" direction seems to be wrong... I created my model according to the "standard coordinate system" being z-axis is up.
But using HelixView3D, the up direction seems to be the Y-axis...No I am using a <RotationTransform> to display it correctly...
Please continue the good work !
Sander.
objo wrote at 2010-10-31 16:59:
hi Sander, the HelixView3D control sets the camera UpDirection to the positive z-axis. All the demo applications have z-axis up. (and the default camera position is (2,16,20), looking at the origin).
Can you add a "CoordinateSystemVisual3D" to your model, and check that the blue arrow points up? It should not be neccessary to rotate your model.
steunissen wrote at 2010-12-17 15:20:
Hi Objo,
I guess I was sleeping when I wrote my opening mail...
I'm picking up the implementation of the helix toolkit into my program. Although I am not saying your up-direction is incorrect, I was really expecting the Y-direction to be up as it is in the opengl and direct3d coordinate systems as well. (my original viewport3d has this Y=up to. So implementing your viewport is not that easy as I would have hoped....
objo wrote at 2010-12-17 15:44:
did you try setting the Camera UpDirection to (0,1,0)? I can add an example for this later. The CameraController might need a small modification for this to work properly with the "2-axis" rotation mode.
steunissen wrote at 2010-12-18 09:42:
By using the Updirection for my camera I cannot use the HelixView3D if I am not mistaken. And I think as a consequence I loose the nice options of "showing the coordinate axes", the "view cube" etc.... I think I am going to do a axis-rotation transform on my model... Not that nice, but hopefully effective...
objo wrote at 2010-12-19 12:34:
see the new UpDirectionDemo :-)
steunissen wrote at 2010-12-21 08:54:
Thanks ! Downloading it now....
3D coordinate system axis names
michaeldjackson wrote at 2012-10-18 14:58:
Does anyone know how to add "X", "Y", "Z" text on the coordinate system, without modifying source code?
RobPerkins wrote at 2012-10-19 17:43:
To do this without modifying the source code of Helix3D, you would have to reconstitute the <style> of the HelixViewport3D. You can find the original style in the Generic.xaml file in the codebase for a template.
Copy and place it in any resource dictionary, and then modify the "PART_CoordinateView" portion to read:
<Viewport3D x:Name="PART_CoordinateView" Width="{TemplateBinding CoordinateSystemWidth}" Height="{TemplateBinding CoordinateSystemHeight}" Margin="0" HorizontalAlignment="{TemplateBinding CoordinateSystemHorizontalPosition}" VerticalAlignment="{TemplateBinding CoordinateSystemVerticalPosition}" ClipToBounds="False" Visibility="{TemplateBinding ShowCoordinateSystem, Converter={StaticResource BoolToVisibilityConverter}}"> <local:ArrowVisual3D Point2="8 0 0" Fill="#964B4B" /> <local:TextBillboardVisual3D Position="9 -2 1" Text="X" Height="10" /> <local:ArrowVisual3D Point2="0 8 0" Fill="#4B964B" /> <local:TextBillboardVisual3D Position="-2 9 1" Text="Y" Height="10" /> <local:ArrowVisual3D Point2="0 0 8" Fill="#4B4B96" /> <local:TextBillboardVisual3D Position="-2 -1 9" Text="Z" Height="10" /> </Viewport3D>
michaeldjackson wrote at 2012-10-19 17:56:
Rob,
Thanks for the reply.
I placed the style in my Resource Dictionary, but I get the error:
"Could not register named object. Names not supported under ResurceDictionary scope."
When I remove the x:Name="PART_CoordinateView", the previous error goes away, but I get this error:
"Failed to creat a 'DependencyProperty' from the text 'CoordinateSystemWidth'."
Michael Jackson
Senior Sofware Developer / Analyst
Department of Petroleum and Geosystems Engineering
University of Texas at Austin
CPE 5.116
Sent: Friday, October 19, 2012 10:43 AM
To: Jackson, Michael D
Subject: Re: 3D coordinate system axis names [helixToolkit:399901]
From: RobPerkins
To do this without modifying the source code of Helix3D, you would have to reconstitute the <style> of the HelixViewport3D. You can find the original style in the Generic.xaml file in the codebase for a template.
Copy and place it in any resource dictionary, and then modify the "PART_CoordinateView" portion to read:
<Viewport3D x:Name="PART_CoordinateView" Width="{TemplateBinding CoordinateSystemWidth}" Height="{TemplateBinding CoordinateSystemHeight}" Margin="0" HorizontalAlignment="{TemplateBinding CoordinateSystemHorizontalPosition}" VerticalAlignment="{TemplateBinding CoordinateSystemVerticalPosition}" ClipToBounds="False" Visibility="{TemplateBinding ShowCoordinateSystem, Converter={StaticResource BoolToVisibilityConverter}}"> <local:ArrowVisual3D Point2="8 0 0" Fill="#964B4B" /> <local:TextBillboardVisual3D Position="9 -2 1" Text="X" Height="10" /> <local:ArrowVisual3D Point2="0 8 0" Fill="#4B964B" /> <local:TextBillboardVisual3D Position="-2 9 1" Text="Y" Height="10" /> <local:ArrowVisual3D Point2="0 0 8" Fill="#4B4B96" /> <local:TextBillboardVisual3D Position="-2 -1 9" Text="Z" Height="10" /> </Viewport3D>
RobPerkins wrote at 2012-10-19 18:00:
I can't see your code, but, you need the entire style from the Default.xml for HelixViewport3D; I only posted the part that needs changing.
The PART_CoordinateView x:Name must stay attached to this Viewport3D snippet within the style.
michaeldjackson wrote at 2012-10-19 19:09:
That was dumb of me. Thanks for the help.
Are you able to help with another problem?
I draw piping systems based on an observable collection, then setting ViewPort3D ItemsSource to this collection. This works fine, however when I first load the application, it fires an event on my treeview, which loads a "case", which loads the collection of pipe. But the pipe system does not appear. I have had to add a button to "redraw" the pipe system.
I tested yesteray and determine that if I create a meshbuilder, with the .AddPipe method per objo's suggestion (Jun 25, 2012 1:33), it works as expected.
However, I need to create one PipeVisual3D at a time in order to color the object with a gradient (it is colored based on temperature, pressure, etc.
Also, I need elbows to join pipe. In the works?, or any suggestions?
Thanks for any help or ideas?
Michael Jackson
Senior Sofware Developer / Analyst
Department of Petroleum and Geosystems Engineering
University of Texas at Austin
CPE 5.116
Sent: Friday, October 19, 2012 11:00 AM
To: Jackson, Michael D
Subject: Re: 3D coordinate system axis names [helixToolkit:399901]
From: RobPerkins
I can't see your code, but, you need the entire style from the Default.xml for HelixViewport3D; I only posted the part that needs changing.
The PART_CoordinateView x:Name must stay attached to this Viewport3D snippet within the style.
RobPerkins wrote at 2012-10-19 21:50:
Two PipeVisual3D's and a sphere, scaled to the sizes you need, should resemble a pipe elbow. You'd need to write the class that emits it and scale the results.
I'm working on similar graphics problems but I don't have employer permission to release code.
You could also use texture coordinates, correlated with triangle vertices, and combined with a GradientBrush to plot color data along your surface. A pipe geometry is a relatively simple thing to tessellate. It wouldn't be hard to further tessellate so that you get vertices at points along the pipe that align with your data results.
objo wrote at 2012-10-22 22:46:
I added the coordinate system labels to the default template. I hope it is ok for everyone...
Thanks for sharing the code, Rob!
Export Import
Mrme wrote at 2013-08-02 10:50:
SeanV12 wrote at 2013-10-01 04:15:
Mrme wrote at 2014-05-07 16:22:
How to Animate (fade) a tube fill (SolidColorBrush) in the Flights Demo?
BogusException wrote at 2014-07-07 04:08:
I've been at it all day, trying everything I can find on the Internet. All I want to do is have the 'flight' tube (flight path) fade over time.
Right now the program is complaining that no mater which Dispatcher.BeginInvoke I use, I can't access the Fill property of the tube from the thread I'm on. I've tried the Flight's thread and the 'parent' thread, but VS doesn't give you much beyond the line number and {"The calling thread cannot access this object because a different thread owns it."} ...
I even try creating a new SolidColorBrush, and then applying that to the tube as tube.Fill, but no joy-the same error...
Is the AnimateOpacity extension made for this kind of thing? I asked earlier about it, as I can't find any docs on it, and just invoking it as it says to fails with no feedback.
TIA!
objo wrote at 2014-07-11 21:54:
Refreshing Viewport
murray_b wrote at 2012-04-23 05:33:
Hi Objo
I am having issues with drawing of a line on the viewport.
I am drawing by mousedown and mousemove. With the mousemove reseting the second point in the line LineVisual3D.
What I am not getting is the line being drawn on the viewport. Even once I stop the drawing (using MouseUp) it is not until I rotate the viewport that the line is drawn on the viewport.
I am sure I am missing something simple here but I can't work out what it is. Any ideas what I might be doing wrong to not have the viewport automatically refreshing. Is there a method I can call to force the redraw?
thanks
Murray
private void HViewPortMouseDown(object sender, MouseButtonEventArgs e) { // first see if they have selected an item only allow selection of drillholes var helix = (HelixViewport3D) sender; Point position = e.GetPosition(helix); Visual3D obj = helix.FindNearestVisual(position); if (obj != null) { // First create a new line _measureline = new LinesVisual3D {Color = Colors.White}; _measureline.DepthOffset = 0.001; _measureLinePoint2 = new Point3D(); Point3D? findNearestPoint = helix.FindNearestPoint(position); if (findNearestPoint != null) { _measureline.Points.Add((Point3D) findNearestPoint); _measureLinePoint2 = (Point3D) findNearestPoint; _measureline.Points.Add(_measureLinePoint2); Children.Add(_measureline); RaisePropertyChanged("_measureline"); _measuring = true; MouseMove += HViewPortMouseMove; } } } private void HViewPortMouseMove(object sender, MouseEventArgs e) { if (_measuring) { var helix = (HelixViewport3D) sender; Point position = e.GetPosition(helix); Point3D? obj = helix.FindNearestPoint(position); _measureline.Points.Remove(_measureLinePoint2); if (obj != null) _measureLinePoint2 = (Point3D) obj; _measureline.Points.Add(_measureLinePoint2); RaisePropertyChanged("_measureline"); RaisePropertyChanged("Objects"); } } private void HViewPortMouseUp(object sender, MouseButtonEventArgs e) { if (_measuring) { // Objects.Remove(_measureline); _measuring = false; } }
murray_b wrote at 2012-04-23 05:55:
Ok
So I have discovered this is a bug with LinesVisual3d.
Because If I change the code to use a PipeVisual3d it works fine.
Regards
Murray
objo wrote at 2012-04-25 07:05:
Notice that the LinesVisual3D.Points property is an IList (not implementing INotifyCollectionChanged). This means the visual will not be redrawn until you change the property (replace the points collection) or change the camera (since this is a visual in screen space).
PipeVisual3D is updated every time you change the Point1 or Point2 properties.
xpix wrote at 2014-02-14 12:28:
i guess i have the same Problem. I want to use the LinesVisual3d and not the pipes. At this time, i have a one Question. How can i reset the camera without move to start position? As i right understand, to redraw the LinesVisual3d i have to move the camera a little bit. Or can i use a special event or methode to redraw the screen and the camera pos is still?
Here my short code:
public void refreshCamera(){
camera.UpDirection = new Vector3D(camera.UpDirection.X, camera.UpDirection.Y, camera.UpDirection.Z);
camera.Position = new Point3D(camera.Position.X, camera.Position.Y, camera.Position.Z);
camera.LookDirection = new Vector3D(camera.LookDirection.X - 0.001, camera.LookDirection.Y, camera.LookDirection.Z);
camera.LookAt(new Point3D(0, 0, 0), 1);
viewport.ResetCamera();
}
Please help :)objo wrote at 2014-02-19 21:03:
ItemSource in HelixViewport3D using MVVM
Polymania wrote at 2012-04-25 08:05:
Hello,
I have a problem in using the HelixViewport3D in a MVVM context. My ItemSource is an ObservableCollection of Visual3D-Elements and it works well when I change the Collection after the Viewport is created and the Binding to the Collection is done. But in my case the Collection is not empty when I create the Viewport and then the initial Elements are not drawn in the Viewport. I think the Viewport should refresh the Viewport-Elements when the ItemSource-Property changes. Would it be possible to implement this in the HelixViewport3D class?
Andreas
Polymania wrote at 2012-06-26 09:27:
Hello,
to solve this problem I added the following code in HelexViewport3D:
protected override void OnItemsSourceChanged(System.Collections.IEnumerable oldValue, System.Collections.IEnumerable newValue) { base.OnItemsSourceChanged(oldValue, newValue); if (oldValue != null) { foreach (var element in oldValue) { var visual = element as Visual3D; if (visual != null) { this.Children.Remove(visual); } } } if (newValue != null) { foreach (var element in newValue) { var visual = element as Visual3D; if (visual != null) { this.Children.Add(visual); } } } }
Would it be possible to add this to the current Version of Helix?
Thanks
Andreas
objo wrote at 2012-06-26 10:02:
Thanks for the solution! Checked in the code!
ggalan87 wrote at 2012-08-24 10:02:
I 'm posting here since it's related issue. Not sure if it would be helix-specific or WPF-specific though :)
I want to have for boxes with text (tags) on them and arrows that show their rotation (direction) in 3D space. I also want to hide/show the arrows and the text.
As in MVVMDemo of the toolkit I use a Collection for the Boxes, and also other collections to seperate the text and the arrows. In the XAML I use MultiBinding and a Converter which merges the collections so they can be aggregated to the ItemSource of the Viewport. I also have a seperate collection for the lights. I already use relay commands to check boxes to how or hide the text or the arrows.
I' m doing the job this way, but I 'm thinking of altering this approach because as it is I have to put so much code in the ViewModel to create each box and bind the arrow and the text position to it. I 'm thinking of creating a datatemplate somehow holding a ContainerUIElement3D as root element and holds a BoxVisual3D, a TextVisual3D and an ArrowVisual3D. This is not possible as I 've tested and read, so I probably have to place it in a ResourceDictionary. The other option is to place text and arrow as children of the BoxVisual3D.
Since I don't have much experience using MVVM, I would like to ask how can I have a "DataTemplate" of that ResourceDictionary similar to what I can perform id 2D:
<DataTemplate DataType="{x:Type local:ObjectViewModel}"><local:ObjectView /> </DataTemplate>
and having my SceneViewModel (it's View has the Viewport) to have a Collection of ObjectViewModels, so that it can draw my ObjectViewModel. The ViewModel would have a constructor that takes the Model.
Is there any other solution that applies to my problem?
MrSparkle wrote at 2012-11-09 10:15:
Yes, I miss Databinding in 3d, too. There seems to be no way to bind a collection of objects to the viewport's or to a Visual3D's Children property just as you would do in 2d. Is there anything we can do using the Helix Viewport?
objo wrote at 2012-11-12 21:15:
I think it should be possible to implement a new "DataTemplate3D" class similar to DataTemplate. DataTemplate cannot be used since it only allows FrameworkElement content. Then it should be possible to implement an "ItemsVisual3D" class that creates Visual3D instances from the DataTemplate3D. But I think it is a challenge to set up the bindings, since Visual3D/Model3D objects does not have data contexts...
http://stackoverflow.com/questions/7725313/how-can-i-use-databinding-for-3d-elements-like-visual3d-or-uielement3d
objo wrote at 2012-11-12 22:08:
I added an experimental example to ExampleBrowser/Examples/DataTemplate. The template factory method needs more work to be useful...
MrSparkle wrote at 2012-11-13 09:16:
objo wrote:
I think it should be possible to implement a new "DataTemplate3D" class similar to DataTemplate...
I really like this idea! And I would really appreciate if there is a solution for this problem some day. I'm currently working on an application where content is displayed in a 3d viewport and the user can directly interact with the 3d objects. At first I thought, I simply could bind my ViewModel against the viewport's content the way I built all my WPF applications. But then I realized it wouldn't work because something like the "DataTemplate3D" is missing.
It would be great to define Templates, Styles and Triggers to change the appearance of the 3d objects and make everything work like in "normal" WPF. I looked into your sample and I definitely like the idea of the DataTemplate3D and the ItemsVisual3D!
Christian
cedrelo wrote at 2013-05-14 14:57:
var prop = type.GetProperties(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance);
foreach (var p in prop)
{
if (p.CanWrite && !boundProperties.Contains(p.Name))
{
var value = p.GetValue(this.Content, null);
p.SetValue(visual, value, null);
}
}
objo wrote at 2013-06-07 11:47:
DataTemplate
, but I think the solution should be somewhere in PresentationFramework.dll :-)Customer support service by UserEcho