New version of Ab3d.PowerToys with better wireframe support and many other improvements

by abenedik 2. April 2014 21:19

I am very happy to announce that a new version of Ab3d.PowerToys is available.

The biggest new feature of the new version is a new WireframeVisual3D class. It can be used to show a 3D model with wireframe rendering. You just need to set a 3D model to OriginalModel property (or set the model as content in XAML) and then decide how you want to show the model and set the WireframeType property accordingly – you can show the model as wireframe only, as wireframe with solid model (can be also used to create wireframe with hidden lines) or as solid model only. What is more, the wireframe color can be fixed (for example all lines black) or the color of the lines can be determined by the color of the model’s material. The same choice can be made for solid model – it can be shown with original color or with fixed color.

The following two screenshots show two sample usages (screenshots from new samples that come with the library):

<visuals:WireframeVisual3D WireframeType="WireframeWithSingleColorSolidModel"
 LineThickness="2" UseModelColor="True" SolidModelColor="Black" > 
     <GeometryModel3D> …

WireframeVisual3D sample 1


<visuals:WireframeVisual3D WireframeType="WireframeWithOriginalSolidModel"  LineThickness="2" LineColor="Black" UseModelColor="False" >      <GeometryModel3D> …

WireframeVisual3D sample 1


What is more, the code in the new DXEngine (DirectX rendering engine that is being developed by AB4D) is specially optimized to render the wireframe and solid model in the most efficient way.

The new Ab3d.PowerToys also uses an improved algorithm for triangulation. Triangulation is used to create a 3D model (define triangles) from a 2D polygon. The code in the previous version used another version of algorithm that had some problems with some of the polygons. The new code is much better and should handle all possible polygons. But it does not support polygons with holes.

There is also a new DirectedPyramidMesh3D object that can be used to create a pyramid that is facing its peat to the specified direction.

And as always there are also some other improvements and bug fixes. The following is a list of all the changes:

  • Added WireframeVisual3D to simplify showing models with wireframe.
  • Improved triangulator - before in some cases a wrongly triangulated object was returned or an "Improperly formed polygon" error was thrown.
  • Added DirectedPyramidMesh3D to create a pyramid object that is oriented in a specified direction.
  • Added Ab3d.Utilities.ModelUtils class that contains ChangeMaterial (change material on all child Model3D objects) and CopyModel (copy child Model3D objects) methods.
  • Improved 3D Lathe creator - now it is allowed to specify only one segment when start and end positions are closed.
  • Added GetPerpendicularVectors to MathUtil - calculate two vectors that are perpendicular to the input vector.
  • Fixed calling PreviewCameraChanged and CameraChanged events when CameraWidth is changed in Orthographic camera.
  • Fixed Point3DTo2D and Rect3DTo2D if size of Viewport3D is changed or if CameraWidth in Orthographic camera is changed.
  • Added Dump extension methods that can dump (write to Debug console) various WPF 3D objects (Matrix3D, Model3D, Geometry3D, Transform3D, Material, Rect3D). This is very useful to get detaled information in Visual Studio Immediate Window - Window – for example you can write "Ab3d.Utilities.Dumper.Dump(myModel3D)".
  • Added GetWorldToViewportMatrix method to BaseCamera.
  • Fixed Creating wireframe with WireframeFactory when model groups have transformations.
  • Cleaned the code to remove compiler warings when compiling source code.
  • Added overrides to CreateWireframe with additional removedDuplicates parameter - when the parameter is true this can significanlty increase time to create wireframe model, but creates less lines because duplicate lines are removed (this was used in the previous version). Not it is possible to set removedDuplicates to false to greatly reduce the initial creation time but end up with having more 3D lines. This can be user when rendering the lines with DXEngine were rendering lines is super-fast compared to WPF 3D where it is very slow.
  • Added Microsoft Kinect 3D player sample.


The list of changes in the Ab3d.PowerToys library ends here. But this is not everything that is new is the new version. There is also a brand new sample project. It was developed with help of a customer that wanted to show the 3D skeleton that was captured with Microsoft Kinect with a 3D model where the user can rotate the camera around the model.

The sample showed again that when having the right tools (Ab3d.PowerToys in this case), it is very easy to create an application that show 3D models and allow user to rotate and move the camera around. You can check the sample with downloading the latest version of the library (note: you will need to install Microsoft Kinect SDK). I will write a separate blog post with more details about that sample in the following days. For now here is a screenshot of the sample:

WireframeVisual3D sample 1