For bugs and new features, use the issue tracker located at GitHub.
Also try the chat room!

ObjReader/MeshBuilder Issues
przem321 wrote at 2012-01-12 17:24:
Hi Mr. Objo,
well, first of all - congratulations, this lib a is very good effort. Eventually this makes WPF3D usable for more advanced projects.
I am working on meshes and I have just switched to your lib for my new project. Thus, I play around with the ObjReader and MeshBuilder a little. Yesterday I provided you the minor fixes to the Opacity value to the ObjReader. Today I encountered further problems with importing general polygonal objects. After an investigation, I finally conclude that a couple of problems is caused by the null-default values of the MeshBuilder properties (MeshBuilder.cs, line: 198):
public Vector3DCollection Normals { get { return this.normals ?? (this.normals = new Vector3DCollection()); } }
This causes that your sanity checks in the Append(...) method may fail. In particular you check (MeshBuilder.cs, line 1818):
if (this.normals != null && normalsToAppend == null) { throw new InvalidOperationException(SourceMeshNormalsShouldNotBeNull); }
The problem is, that if one has called the Normals property prior to this check (for what ever reason, maybe just to check if it is null) the filed normal is not null and the sanity check throws an exception here. This is not what we want I guess. Of course this also applies to other fields like positions and texcoords, though there will be hardly a mesh with a null-valued position array.
My suggested solution is to remove the null-default values from the properties - in fact I don't see a purpose for that here? I mean like that (MeshBuilder.cs, line: 198):
public Vector3DCollection Normals { get { return this.normals;// ?? (this.normals = new Vector3DCollection()); } }
This works fine with all types of meshes I have tested. But I might have caused some side-effects I am not aware of. Thus you should check it - if there is a specific reason why you set the default-values with the ?? operator than my solution might be wrong. Otherwise, I suggest to throw away the ??-defaults and to check normals, and texcoords for null in order to determine if the mesh uses them or not. This makes it all more controllable I guess, but its up to you. I will send you the MeshBuilder.cs as well as some further minor fixes in the ObjReader.cs per bug-report.
Cheers
Przem
PS. I have also created half-edge based mesh data structures, so once my stuff is running properly, maybe you will be interested in replacing the (very) limited Mesh3D class.
objo wrote at 2012-01-12 21:02:
hi Przem, you are right - the getter should simply return the this.normals field. Thank you for reviewing the code! I'll apply the patch tomorrow.
A half-edge or winged-edge mesh representation would be very interesting!! Great if you could submit an implementation and a tiny example how to use it!
przem321 wrote at 2012-01-13 17:47:
Thanks for reply.
I have some further questions/suggestions. My first is the reason you are using the Collection<T> class for collection the Groups in the ObjReader (line 53). Wouldn't it be better to expose a IList<T> interface and allocate a List<T> internally, since the latter one is better optimized for speed than Collection<T>? Well, this is a minor issue, since ObjReader is not real-time critical.
The second issue is that members exposed by IModelReader are not very useful. While, true, it is fine to read a file and obtain a ready Model3DGroup, this does nos cover all the cases where you would like to edit the model. Furthermore, the rule of thumb is to expose as general as possible types, which than can still be typed more strongly. In the case of your lib the MeshBuilder class seems to me to be the most general one. Thus I would suggest the IModelReader to deliver MeshBuilder or IList<MeshBuilder> results, which than can be very easily converted to whatever the user wishes.
Third, I have a remark regarding the MeshBuilder: while this class is very good, I am afraid that it gets a little bit overcrowded. For example, I don't think that it is a proper place to implement SDS - this is a case for Mesh3D or some own class. I also think that all the factoring methods should be implemented as static methods such that they deliver distinct MeshBuilder which than can be appended to each other. Static methods make it easier to keep independence and also maintenance. Maybe it makes sense to extract some interface of the MeshBuilder? To sum up: I really like this class and I think this is the best for geometry exchange.
Finally, I would suggest to use as general types as possible. For example the ScreenSpaceVisual3D class expects its points as a Points3DCollection, but internally it uses the collection just as a container. Therefore there is no need to use a Points3DCollection (which is only good for renderable MeshGeomerty3D objects), I would suggest to use IList<Point3D>, such that one can provide any IList of 3d points, in cases one holds the points in other containers. Otherwise one has to copy the points to a Point3DCollection which is not used anyway.
Well, these I just some thoughts. I must say that I am not a code-guru, I am more into maths and geometry, and I only code in order to get my geometry projects running (unfortunately, MATLAB is too limited for interactive 3d modeling). And I have to say again that this framework is a great effort and it is fun using it!
Cheers
Przem
objo wrote at 2012-01-13 20:17:
#1: Agree on this. I also changed in other classes that used Collection<T>. I remember having read this reply: http://stackoverflow.com/questions/271710/collectiont-versus-listt-what-should-you-use-on-your-interfaces, but I need to understand when to use Collections and Lists better..
#2: What if the imported model contains a hierarchy of meshes and transforms? And materials. Then I think the hierarchic Model3D structure is needed. The import classes could be more general (even platform independent), but it has not been the goal for the library (so far..) (I have simply used the WPF 3D classes where possible)
#3: Agree on this, the builder should only contain the simple mesh operations (no questionable/experimental algorithms...) I like to use the MeshBuilder to combine several objects using the same material into the same geometry (for performance), then I guess allocating a mesh for each object and finally appending all these meshes will cost more (should profile this). I think the MeshBuilder should work like the System.Text.StringBuilder, i.e. not as static factory methods. Good performance for large/composite meshes is the goal here.
#4: Agree, I am changing this!
Thanks for great comments!
przem321 wrote at 2012-01-13 20:42:
Thant for reply.
#1: According to http://blogs.msdn.com/b/codeanalysis/archive/2006/04/27/585476.aspx one should use the Collection<T> if one wants to override some methods. This is usually not the case when one just wants to store the elements.
#2: Well, on a one hand you are right. I thought a IList<MeshBuilder> might be an option. But this does not contain materials, etc. Maybe this is fine like it is. Or maybe one should use the Wavefront structure (Group,Material, etc.) in order to keep the object (for all types of inputs) after loading and than, on demand one might create the Model3DGroup. The problem I have with the current solution is that sometimes one does not want to obtain a Model3DGroup after loading. With the current solution in such a case one needs to convert the Model3DGroup back to whatever one needs. Or just to use the ObjReader directly without the IModelReader interface in order to get access to the Groups and Materials. Since the OBJ format is a well established exchange-format, why not to keep its structure internally as a "raw" model representation? Well, this is just a suggestion. But let me think a little on it, maybe I will come up with a better one is few days.
#3: I just thought each Primitive would be appended like the current Append(...) function. But you are right this would cause unnecessary overhead. Its fine like it is.
objo wrote at 2012-01-13 21:03:
#2: Yes, implementing the domain model of the Wavefront structure would be a good idea. Then create the WPF3D model on request.
Another issue with the obj reader is the handling of smoothing groups. It is currently flat shading everything.
przem321 wrote at 2012-01-26 19:15:
Hi,
just wanted to report a bug: in the current version of the ObjReader.cs, line 378, Polygone3D will not accept a List<Point3D> in the constructor. The project will not compile. I fixed it locally, but just wanted to let you know.
objo wrote at 2012-01-26 19:41:
are you sure your Polygon3D.cs file is updated? There should be a constructor Polygon3D(IList<Point3D> pts) there.
bcblanka wrote at 2012-02-01 12:30:
Hi,
First of all great work on the Helix toolkit; we are using it in a 3D modelling application and we would have been far behind on development without this toolkit. I was recently working with importing 3D models from OBJ files (ObjReader) and I saw that the material applied on a 3D surface isn't always visible. These are my findings:
In the ObjReader.cs, GetMaterial() method where you are creating the brush for the 3D object, the opacity is set to: "Opacity = 1.0 - this.Dissolved" for both color or image brushes. This is what I read about OBJ materias:
"d factor
Specifies the dissolve for the current material.
factor - is the amount this material dissolves into the background. A factor of 1.0 is fully opaque. This is the default when a new material is created. A factor of 0.0 is fully dissolved (completely transparent). " http://www.fileformat.info/format/material/
So when an object has a dissolve factor of 1 (fully opaque) the GetMaterial() method will create a completely transparent material for it.
My fix for this issue was setting a default value of 1 for the Dissolved property, and setting the" Opacity = this.Dissolved" for the brush. It seems to be working, but I am not too familiar with obj files so this might be wrong or breaking other functionalities of obj reader.
Thanks for the great toolkit!
Blanka
objo wrote at 2012-02-01 18:53:
thanks for the bug report - this was the original implementation, but it was changed in #74137. I am reverting back to the original implementation now: Opacity = dissolve value. Also setting default value to 1.0. przem321, do you agree?
przem321 wrote at 2012-02-02 19:06:
Well, in my case this is exactly the opposite. I have used models converted in Deep Exploration and all models where invisible with Opacity = Dissolved. By inverting it as mentioned above, the models were fine. But according to the specification referenced above Dissolved should refer to Opacity, thus is seems that bcblanka is right.
I will try to figure out what is the actual problem with my models and post it here than.
bcblanka wrote at 2012-02-03 07:26:
Hi,
The code: "Opacity = 1.0 - this.Dissolved" worked fine when the dissolve factor was not specified in the *.mtl file. Maybe that is the case for your models, przem321. However, if a dissolve value is specified in the *.mtl file, for example 1 for opaque, the opacity will be 0 (Opacity = 1.0 - this.Dissolved; Opacity = 1-1).
objo wrote at 2012-02-03 08:41:
I changed the default value for Dissolved to 1.0
przem321 wrote at 2012-02-03 15:46:
bcblanka wrote:
The code: "Opacity = 1.0 - this.Dissolved" worked fine when the dissolve factor was not specified in the *.mtl file. Maybe that is the case for your models,
This is clear. The problem was that the code: "Opacity = Dissolved" didn't worked, but it did other way, this is the reason I've changed it. It appeared that Dissolved applies to the model's transparency, but I haven't checked the spec though.
Now, I guess there must be some other reason, like that the models are skewed up. I'll try to check this in a free moment. Thanks for clarification.

Touch events
JohnSourcer wrote at 2012-12-06 14:25:
Thanks for a fantastic framework. It's changed my approach to 3D on WPF. I'm not clear on how to handled touch events. Do we need to wire them up ourselves? I see manipulation events firing if I add them to the user control containing a HelixViewport3D. Mouse manipulations work 100%.
Currently, I'm doing:
<h:HelixViewport3D RotationSensitivity="0.3" InfiniteSpin="True" x:Name="HelixViewport3D" Height="1100" IsManipulationEnabled="True" ManipulationStarted="GlobeManipulationStarted"... protected void GlobeManipulationStarted(object sender, ManipulationStartedEventArgs e) { base.OnManipulationStarted(e); //handle manipulations e.Handled = true; }...
Is this the correct approach?
balameeta wrote at 2013-03-27 17:42:
Use this code for multi-touch manipulation of the scene to work:
viewPortName.CameraController.TouchMode = TouchMode.Rotating;
Amun
Pick a PipeVisual3D object
rinaldin wrote at 2013-09-27 11:05:
I need to delect a PipeVisual3D object in the viewport, and I followed the example "UIelement", adding a sphere and a PipeVisual3D object. Unfortunately I cannot pick the PipeVisual3D object. Why it doesn't work?
The code I used is below:
' selezione
Dim container = New ContainerUIElement3D()
Dim element = New ModelUIElement3D()
Dim geometry = New GeometryModel3D()
Dim meshBuilder = New MeshBuilder()
meshBuilder.AddSphere(New Point3D(0, 0, 0), 2, 100, 50)
'meshBuilder.AddQuad(pt, pt1, pt1, pt)
geometry.Geometry = meshBuilder.ToMesh()
geometry.Material = Materials.Green
element.Model = geometry
element.Transform = New TranslateTransform3D(5, 0, 0)
' genera linee in modelspace
Dim ts2 As New PipeVisual3D
Dim pt1 As New Point3D(10, 10, 10)
Dim pt2 As New Point3D(20, 10, 10)
ts2.Point1 = pt1
ts2.Point2 = pt2
ts2.Material = Materials.Green
ts2.Diameter = 0.1
AddHandler element.MouseDown, AddressOf Me.ContainerElementMouseDown
container.Children.Add(element)
' add lines and points to the container
container.Children.Add(lines)
container.Children.Add(pts)
container.Children.Add(ts2)
'container.Children.Add(New AmbientLight(Colors.White))
HelixViewport3D1.Children.Add(container)
I used the ContainerElementMouseDown sub that I found in the example, but as I said it works only for the sphere: Private Sub ContainerElementMouseDown(ByVal sender As Object, ByVal e As MouseButtonEventArgs)
If e.LeftButton = MouseButtonState.Pressed Then
Dim element = TryCast(sender, ModelUIElement3D)
Dim model = TryCast(element.Model, GeometryModel3D)
If model.Material Is Materials.Green Then
model.Material = Materials.Yellow
ElseIf model.Material Is Materials.Yellow Then
model.Material = Materials.Green
End If
'model.Material = If(model.Material Is Materials.Green, Materials.Gray, Materials.Green)
e.Handled = True
End If
End Sub
I supposed that I cannot use the LinesVisual3D because they are in the in the screen space; I though I have to use something that is in the model space. Is it right?
Thanks,
Giovanni
objo wrote at 2013-09-29 09:27:
rinaldin wrote at 2013-09-29 12:32:
As far I've understood, PipeVisual3D has the capability for receiving mouse events. I found how to add a Pipe in ModelUIElement3D.
But how can I use the mouse events to pick (e.g. select) a Pipe instead of another? Is there a property ti do so?
Giovanni
rinaldin wrote at 2013-09-29 17:05:
Furthermore, is it another command that allows picking objects by drawing an imaginary box that intersecates one or more elements? Such as Autocad...
Thanks,
Giovanni
rinaldin wrote at 2013-10-01 15:02:
a5r wrote at 2013-10-01 17:35:
If you change it like this it will trigger the event:
PipeVisual3D pipe = new PipeVisual3D();
pipe.Point1 = new Point3D(10, 10, 10);
pipe.Point2 = new Point3D(20, 10, 10);
pipe.Material = Materials.Green;
pipe.Diameter = 0.1;
var element2 = new ModelUIElement3D();
element2.Model = pipe.Model;
element2.MouseDown += this.ContainerElementMouseDown;
container.Children.Add(element2);
rinaldin wrote at 2013-10-03 21:50:
Dim pipe As New PipeVisual3D()
pipe.Point1 = New Point3D(10, 10, 10)
pipe.Point2 = New Point3D(20, 10, 10)
pipe.Material = Materials.Green
pipe.Diameter = 0.1
Dim element2 = New ModelUIElement3D()
element2.Model = pipe.Model
AddHandler element2.MouseDown, AddressOf Me.ContainerElementMouseDown
container.Children.Add(element2)
anyway, now I just need to have the box selection instead of single click-on-object selection. Any idea?AQSRanck wrote at 2014-06-28 17:18:
I also work in VB and while this response is for an old post I have a few ideas that may be applicable to your needs.
objo sent the following reply to my post "How to draw a funnel"
See the usage of MeshBuilder.AddSurfaceOfRevolution in the example Source\Examples\WPF\ExampleBrowser\Examples\BuildingDemo\SiloVisual3D.cs, I think a similar approach can be used to model a funnel.
After a lot of experimenting I was finally able to open the BuildingDemo project albeit in C#. I noticed (for the first time) that when you click on a silo/tank in the viewport, a property page appeared on the right side of the screen, and, more interestingly, if you clicked on a chimney a different property page appeared. But the cool thing is that a change in the property actually changes the visual! There are two chimneys in the illustration, but only one visual redraws with the new parameters! So there is a lot in this demo that may be useful to you.
I have converted the parts I needed to VB and have more complex visual mouse click selections already working in my own project.
In fact, I have a property page live modification of an object working in a VB project with exactly two lines of code and no code behind in the view. To accomplish this you need 3 things:
- You need to be using Caliburn Micro (It is absolutely the best for MVVM applications) If you don't have it you can get it
here.
- You need to grab the PropertyGrid at
this web site
- Selecting an item and dispaying its propertys in an interactive propertygrid has a lot to do with your projects organization. I was successful because I used the same design concepts that are illustrated in the SiloVisual3D.vb class
Bob Ranck

using Caliburn MVVM
AQSRanck wrote at 2014-03-17 15:09:
In one of the older sample projects, there is a little Red house with a gable roof. I'd like to do this in the Mvvm Project.
All I really need is an example of the code for the view model to add the rectangular box representing the house and then the code to add the triangular roof. It would help if the two objects had different colors. Add more detail if you wish, but this will be a great help in getting me started.
Thanks
AQSRanck wrote at 2014-03-18 14:31:
(Objects is an Observable Collection which is bound to the ItemsSource of the HelixViewport3D) and this works just fine.
public void AddFigure()
{
Objects.Clear();
if (Objects.Count == 0) {
Objects.Add(new SunLight());
}
BoxVisual3D housebox1 = new BoxVisual3D();
housebox1.Width = 35;
housebox1.Length = 25;
housebox1.Height = 8;
housebox1.Fill = Brushes.DarkGray;
housebox1.Center = new Point3D(0, 0, -8);
Objects.Add(housebox1);
}
Obviously, Helix does not have a "RoofVisual3D" so the question is how do you build this triangular solid element to add to the Objects collection? All I am trying to understand is how to construct the code to build a custom triangular solid element
element to add to the collection.AQSRanck wrote at 2014-03-21 03:28:
ExtrudedVisual3D Gable = new ExtrudedVisual3D();
PointCollection sect = new PointCollection();
sect.Add(new Point(0, 15));
sect.Add(new Point(17.5, 4));
sect.Add(new Point(-17.5, 4));
Gable.Section = sect;
Gable.Path.Add(new Point3D(-12.5, 0, 0));
Gable.Path.Add(new Point3D(12.5, 0, 0));
Gable.SectionXAxis = new Point3D(0, 1, 0);
Gable.Fill = Brushes.SaddleBrown;
Gable.IsPathClosed = true;
Gable.IsSectionClosed = true;
Objects.Add(Gable);
However, this is obviously not the right solution. The triangle is open on both ends and you can see right through it. At first, I thought of adding end caps to the extrusion but my sense is that I really need a geometry mesh. Also, as I move from a simple
Gable to a more complex Hip Roof, the ExtrudedVisual is clearly wrong. So if someone could help with a geometry mesh, I would be grateful. Here are the points for a simple Hip roof. An earlier post in this forum shows how to add a 2D mesh, but I still don't
have a clue for the syntax for a 3D mesh in Helix. A Hip Roof has four slopes, If I don't use Helix toolkit, I can divide the roof up into 6 Triangles and determine indices, and calculate normal. What I need help with is: How do I use Helix tools to achieve
the same results? All I need is the code that would precede the line below.Objects.Add(Roof1);
The first four points are the perimeter - - - and the final two points represent the two points in the middle of a hip roof.
Pt0=(0,0,0)
Pt1=(0,35,0)
Pt2=(35,25,0)
Pt3=(0,25,0)
Pt4=(5,12.5,5)
Pt5=(5,22.5,5)
Thank you

SharpDX - high GPU usage
glgweeke wrote at 2014-06-11 12:41:
why is the GPU usage so high, when I start the ImageViewDemo or other examples with SharpDX.
I use the processexplorer detect this.
(IDLE > 20%, Rotating > 50 %)
A "normal" DirectX-Application (no SharpDx) uses on my System < 5% GPU.
Is this usual for applications using SharpDX?

No opacity after importing 3ds file
mmmmmm wrote at 2012-11-04 17:24:
Hi,
have some problems after importing transparent 3ds files, transparent objects didn't show transparency. Didn't found an entry for opacity within the studio importer. Are there some sub defines for edit_material something like MAT_OPACITY missing?
Would be thankful for response
mm
mmmmmm wrote at 2012-11-06 08:37:
Hi,
solve it as a first step, but there is still a problem with the correct opacity value (double), hope I can solve it later:
// add to enum ChunkID // below sub defines of EDIT_MATERIAL MAT_TRANSPARENCY = 0xA050, //add to function ReadMaterial case ChunkID.MAT_TRANSPARENCY: bytes = this.ReadData(reader, size - 6); if (BitConverter.IsLittleEndian) bytes = ReverseBytes(bytes); opacity = BitConverter.ToDouble(bytes, 0); break; //change in function ReadMaterial (add opacity to brushes) if (texture != null) { string ext = Path.GetExtension(texture); if (ext != null) { ext = ext.ToLower(); } // TGA not supported - convert textures to .png! if (ext == ".tga") { texture = Path.ChangeExtension(texture, ".png"); } var actualTexturePath = this.TexturePath ?? string.Empty; string path = Path.Combine(actualTexturePath, texture); if (File.Exists(path)) { var img = new BitmapImage(new Uri(path, UriKind.Relative)); var textureBrush = new ImageBrush(img) { Opacity = opacity, ViewportUnits = BrushMappingMode.Absolute, TileMode = TileMode.Tile }; mg.Children.Add(new DiffuseMaterial(textureBrush)); } else { Debug.WriteLine(string.Format("Texture not found: {0}", Path.GetFullPath(path))); mg.Children.Add(new DiffuseMaterial(new SolidColorBrush(diffuse) { Opacity = opacity })); } } else { mg.Children.Add(new DiffuseMaterial(new SolidColorBrush(diffuse) { Opacity = opacity })); } mg.Children.Add(new SpecularMaterial(new SolidColorBrush(specular) { Opacity = opacity }, specularPower) ); // add function private static byte[] ReverseBytes(byte[] inArray) { int highCtr = inArray.Length - 1; for (int ctr = 0; ctr < inArray.Length / 2; ctr++) { byte temp = inArray[ctr]; inArray[ctr] = inArray[highCtr]; inArray[highCtr] = temp; highCtr -= 1; } return inArray; }
objo wrote at 2012-11-06 19:28:
thanks for sharing the code! Do you have a small example file we can use to test? Can you create a fork with your changes?
mmmmmm wrote at 2012-11-07 07:48:
Hi objo,
thanks for responding. Yes, we (Gregor (glgweeke) and me) want to make a branch end of month with some addings: we want to check in the last release of the VRML reader, the visibility problem and a box extension to multi material box. I will add a transparency sample for 3ds.
Best regards
Manfred
Von: objo [email removed]
Gesendet: Dienstag, 6. November 2012 20:29
An: mm@mm-ing.de
Betreff: Re: No opacity after importing 3ds file [helixToolkit:401840]
From: objo
thanks for sharing the code! Do you have a small example file we can use to test? Can you create a fork with your changes?
musicxpg wrote at 2013-02-25 14:33:
I tried the newest version, the same problem occurs.
Can anybody tell me which file should be modified to introduce mmmmmm's contribution? Thank you!
mmmmmm wrote at 2013-02-25 15:48:
Values were taken from Blender, but Meshlap seems to have better values. If you have some time, please search in Meshlap for opacity part and copy it into the StudioReader.

How to bind How to bind that Visual3DCollection to an ObservableCollection?
BogusException wrote at 2014-08-25 04:37:
Q: How to bind that Visual3DCollection to an ObservableCollection?
How can I use an ObservableCollection as my collection of <Object>.Children ?
I mean, instead of always using someCube.Children.Add(<someObject>), why can't I, or how can I, simply bind (like everything else in WPF) a collection to the Visual3DCollection (or whatever other mechanism exists), and manipulate the ObservableCollection?
We do this with other WPF objects, and since I'm having a hell of a time with my app crashing constantly, I'm hoping there is a way to simplify all of this...
Your thoughts?
(the issue worsded a different way below)
Using Helix toolkit, but might apply to generic WPF. How can I use an observablecollection to manage objects as children of a WPF object?An object like Helixtoolkit.wpf.cubevisual3d can have:
theCube.children.add()
The visual3d object, and it's children, do not have an ItemsSource() property to bind to like datagrids do. Even if the updating of the visual3d object (the one with the children) has to be done manually (not via ObsColl itemchanged, etc. events), managing all the children in a collection seems easiest.
Since i only know how to use ObsColl's like this, is there an equivelent, or viable workaround, for a Visual3d/model3d object (whether or not Helix, but helix is very convenient)?
everytimer wrote at 2014-08-25 20:58:
But I think that binding collections is not allowed at this moment in Helix...
objo wrote at 2014-08-25 22:04:
Children
property is readonly: http://msdn.microsoft.com/en-us/library/system.windows.media.media3d.modelvisual3d.children(v=vs.110).aspx
But you can probably do this with an attached dependency property or derive a class and create an
ItemsSource
property where you synchronize the changes to the collection with the
Children
collection... See also the
Source\Examples\WPF\ExampleBrowser\Examples\DataTemplate
for some ideas on templating 3D content!BogusException wrote at 2014-08-25 22:35:
If the Children property is read-only, then why can I do:
SomeObject.Children.Add(someOtherObject) ?
Isn't Children a collection?
objo wrote at 2014-08-25 23:20:
Children
to your observable collection as we do with
ItemsSource
on other WPF elements (based on ItemsControl). ps. Posting the question on stack overflow may be worth a try for general questions like this! :-)
BogusException wrote at 2014-08-26 02:19:
Got no takers (none) on SO. What is acceptable, though, is to maintain a collection, then completely replace the existing one via code (versus elaborate events, as is typical in OCs..
What I mean is, I can easily create & maintain my collection of objects in code (I am stuck for 2 weeks now at this stage, so this is not pointless theory discussion), and then as my code sees fit (after a significant change, timer, etc. the code would REPLACE the existing Children() collection.
It isn't binding, I don't think (since binding isn't apparently possible-which is an even stranger situation/restriction), but more like in one frame it displays CollectionA, and the next frame it shows CollectionB. Right now, even writing on the UI thread, I am crashing my app after about 4 seconds of running. And by crashing, I mean the app leaves no log trace of what it does, and goes back to app.run with that idiotic "incorrect number of parameters', which nobody knows anything about or understands.
I need to add a few to hundreds of children to an object, and manage them (they fade over time, then go away after they are transparent. I know WPF doesn't like collections being changed by non-UI threads, but I can't see any of that happening. I'm desperate at this point, which is why I am at the point we're at now.
I will be testing how this works out, but until then if anyone has any input, it would be great.
I can't continue (been stuck ~17 days now) until I get past this, and I don't want to get rid of Helix and do it 'bare bones'. My app is a simple WPF project, I should be able to do this with high level tools.
BogusException wrote at 2014-08-26 02:31:
SomeSphere as SphereVisual3D has children:
SomeSphere.Children.Add()
SomeSphere.Content being System.Windows.Media.Media3D.Model3D:
SomeSphere.Content.*, which includes .Traverse() and .Transform()...
Any of this give anyone any ideas?
:)

Helixtoolkit BoxVisual3D
Irfan_Maulana wrote at 2014-01-07 14:37:
I have tried to create some cubes with height=21cube width = 21 cube and length 21 cube, but the result is not quite good
because when I navigate the cubes, the motion of the cubes is so lag, (the code is shown below).
public MainWindow()
{
InitializeComponent();
// Upper
for (double i = -10; i <= 12; i = i + 1.1)
{
for (double j = -10; j <= 12; j = j + 1.1)
{
BoxVisual3D box = new BoxVisual3D() { Center = new Point3D() { X = i, Y = j, Z = 12 }, Fill = Brushes.DarkKhaki };
view3DHelix.Children.Add(box);
}
}
//Bottom
for (double i = -10; i <= 12; i = i + 1.1)
{
for (double j = -10; j <= 12; j = j + 1.1)
{
BoxVisual3D box = new BoxVisual3D() { Center = new Point3D() { X = i, Y = j, Z = -10 }, Fill = Brushes.DarkKhaki };
view3DHelix.Children.Add(box);
}
}
//Right
for (double i = -10; i <= 12; i = i + 1.1)
{
for (double k = -8.9; k <= 12; k = k + 1.1)
{
BoxVisual3D box = new BoxVisual3D() { Center = new Point3D() { X = i, Y = 12, Z = k }, Fill = Brushes.DarkKhaki };
view3DHelix.Children.Add(box);
}
}
//Left
for (double i = -10; i <= 12; i = i + 1.1)
{
for (double k = -8.9; k <= 10.9; k = k + 1.1)
{
BoxVisual3D box = new BoxVisual3D() { Center = new Point3D() { X = i, Y = -10, Z = k }, Fill = Brushes.DarkKhaki };
view3DHelix.Children.Add(box);
}
}
//Front
for (double j = -8.9; j <= 10.9; j = j + 1.1)
{
for (double k = -8.9; k <= 12; k = k + 1.1)
{
BoxVisual3D box = new BoxVisual3D() { Center = new Point3D() { X = 12, Y = j, Z = k }, Fill = Brushes.DarkKhaki };
view3DHelix.Children.Add(box);
}
}
//Behind
for (double j = -8.9; j <= 10.9; j = j + 1.1)
{
for (double k = -8.9; k <= 12; k = k + 1.1)
{
BoxVisual3D box = new BoxVisual3D() { Center = new Point3D() { X = -10, Y = j, Z = k }, Fill = Brushes.DarkKhaki };
view3DHelix.Children.Add(box);
}
}
}
anyone have any idea for a better result?objo wrote at 2014-01-07 22:51:
GeometryModel3D
. Use the HelixToolkit.Wpf.MeshBuilder
to create a
MeshGeometry3D
of the cubes. You can then group all the models in a
Model3DGroup
and add it to a ModelVisual3D
. I also recommend reading
http://msdn.microsoft.com/en-us/library/bb613553(v=vs.110).aspx
http://blogs.msdn.com/b/johngossman/archive/2005/10/13/480748.aspx
AnotherBor wrote at 2014-01-10 07:51:
What if I add cubes (by add rectangular mesh or other method) to one MeshBuilder, add a linear gradient brush based material to the model and assign texture coordinates to every single cube in a way to apply the color I need?
It all would then count as one mesh, but "separate" cubes could have different colors.
I wonder if that would work?
objo wrote at 2014-01-10 09:03:
AnotherBor wrote at 2014-01-10 09:15:
Then we would have calls like
MeshBuilder.AddTube( {point1, point2}, width, segments, cap, uniformTextureCoordForTheWholeTubeMesh)
, what do you think?objo wrote at 2014-01-10 09:38:
AnotherBor wrote at 2014-01-10 09:54:

SharpDX fork no BackMaterial property in MeshGeometryModel3D
Lolipedobear wrote at 2014-03-05 14:27:
geoarsal wrote at 2014-03-12 18:49:
var copytri = new int[mb.TriangleIndices.Count];
mb.TriangleIndices.CopyTo(copytri);
Array.Reverse(copytri);
var copynorm = new Vector3[mb.Normals.Count];
for (int i = 0; i < copynorm.Length; i++)
copynorm[i] = -1 * mb.Normals[i];
mb.Append(mb.Positions.ToArray(), copytri, copynorm, mb.TextureCoordinates.ToArray());
Lolipedobear wrote at 2014-03-14 06:23:
geoarsal wrote at 2014-03-14 08:07:
var copynorm = new Vector3[mb.Normals.Count];
for (int i = 0; i < copynorm.Length; i++)
{
mb.Normals[i] *= -1;
copynorm[i] = -1 * mb.Normals[i];
}
Hope that will help you with your issue. P.S. Reversing the original normal was required when your building triangles using Right Hand Rule (WPF approach) instead of using Left Hand Rule (DirectX/SharpDX approach)
Customer support service by UserEcho