New major version of Ab3d.PowerToys released

by abenedik 26. June 2019 11:20

A new major version of the Ab3d.PowerToys library has been released!

The new version brings many new features, significantly improves performance in some cases and also fixes a few issues.

I am sure that most of you will find your own favorite feature or improvement in this version. For me, the most important addition is a new ModelScalarVisual3D class.

The ModelScalarVisual3D is a control that provides a simple way for the user to scale a selected 3D model - it is a usual control in almost all 3D modeling applications. This way the Ab3d.PowerToys library provides all three standard transformation controls: translation (with ModelMoverVisual3D), rotation (with ModelRotatorVisual3D) and scale (with ModelScalarVisual3D). There is also a new "Ducks lake" sample that demonstrates the usage of all three:

Ducks lake sample with translate, rotate and scale transformation controls

Another very nice new feature that I really like is support for rendering 3D streamlines. 3D streamlines are 3D lines that represent a flow of water or air with different colors. Streamlines are used many times to show simulation results or show sensor data. With Ab3d.PowerToys library they can be shown with an updated TubePathMesh3D class. The class is created with a collection of 3D positions that define the tube positions. With the new version, it is now possible to also specify texture coordinates for each tube path position. This way it is possible to assign a texture with a color gradient to the TubePath and use the texture coordinates to specify which color should be shown for each tube path position.

3D streamlines samples created with textured tube lines

TubePath always shows a cylindrical tube along the specified path. But if you want to show some other shape along a path, then you can use an updated CreateExtrudedMeshGeometry method (in Ab3d.Meshes.Mesh3DFactory namespace). Previously it was possible to extrude a 2D shape into a 3D object only by providing a single 3D vector. Now you can provide a list of 3D positions and the new method will extrude the 2D shape along the provided positions.

Extrude a custom 2D shape along a 3D path

Many of you have already tried to create a custom 3D mesh with defining custom positions, triangle indices and texture coordinates. The "best friend" for this task is a piece of paper and a pencil. This way you can draw the 3D object schema to a paper and then number the positions. This makes it much easier to see the position indexes that will form the object triangles. For those users, the new version of Ab3d.PowerToys is introducing a new "best friend": MeshInspectorOverlay control. It is a control that is derived from Canvas and can show position indexes, triangle indexes and orientation of positions in each triangle. You just add the MeshInspectorOverlay control to your visual tree (it should be added after the Viewport3D control and should occupy the same space), then assign MeshGeometry3D and Camera properties and after that the mesh details will be written on top of the 3D object. 

If you are interested in MeshInspectorOverlay then I would like to remind you about the Ab3d.Utilities.Dumper class. This class defines many methods that can be used at design time in Visual Studio Immediate window to show many details about objects used in 3D scene. For example, its Dump method can show many details about a MeshGeometry3D, Model3D or Matrix3D. That method is also defined as an extension method on those classes. There is also a DumpHierarchy extension method that can be used on Model3D, Visual3D or even Viewport3D. Try them.

Most of the samples under "Objects 3D" have been updated and can now show 3D model details with using the MeshInspectorOverlay. Here is a screenshot of MeshInspectorOverlay sample that also shows many of its properties:

MeshInspectorOverlay shows position indexes, triangle indexes and orienations of triangles

There are also some other nice new features. But let me now describe some of the performance improvements.

If you are using Boolean operations, then you will be happy to learn that this part of the library has been significantly improved. Boolean operations require a generation of Constructive solid geometry (CSG) objects where polygons in one CSG object are split based on the polygons in another CSG object. This process can create an insane amount of objects. Optimizing the creation of objects in the latest version has significantly improved the performance. What is more, if you are doing multiple Boolean operations on a single 3D object, you can now preserve the internal CSG object between all the operations (before new CGS was created each time). This can provide an even bigger speed-up. But, please do not be too excited, Boolean operations are still very complex and slow operations.

Another significant performance improvement has been done to improve getting the 3D line that is the closest to the mouse position. If you are using only Ab3d.PowerToys and WPF to render 3D lines, then this is not very relevant because showing many 3D lines in such a scenario is much more limiting that getting the closest line. But when using Ab3d.DXEngine, it is possible to show hundreds of thousands of 3D lines and in such extreme scenarios, it is essential that the code that gets the closest 3D line is fully optimized. This was achieved with heavy inlining and reordering of the code in the critical path. What is more, the methods in the LineSelectorData class have been updated in such a way that now it is possible to call them in multiple threads (for example with using Parallel.For). This way you can achieve massive performance gains.

The code in LineSelectorData was also updated to correctly handle the cases when 3D lines cross the camera's near plane (line goes behind the camera). In this case, the closest line was not always correctly calculated. Because this requires special handling of the 3D line, there is also a new Line3DTo2D method on the camera class (besides the Point3DTo2D and Rect3DTo2D methods).

There are also some other fixes available. To get the full list of new features and changes see the Ab3d.PowerToys versions history.

Tags:

Ab3d.PowerToys

Import 3D models from almost any 3D file with new major update of Ab3d.PowerToys library

by abenedik 27. November 2014 23:43

I am really happy that after a long development all great new features of Ab3d.PowerToys library are now available.

The biggest new feature is that now it is possible to import 3D models into WPF or WinForms application from almost any 3D file – including Collada, fbx, blend, dxf, ase, lwg and many more (see http://assimp.sourceforge.net/main_features_formats.html).

This is possible with help of Open Source Assimp importer library and a new Ab3d.PowerToys.Assimp helper library that converts Assimp’s Scene object into WPF 3D objects.

For example the following XAML imports a Collada duck.dae file:

<assimpVisuals:AssimpModelVisual3D Source="/Resources/duck.dae" 
                            Position="0 0 0" PositionType="Center"
                            SizeX="100"//>

And the result is of course the standard Collada duck 3D model:

Collada duck model opened with Ab3d.PowerToys.Assimp

And what is more, just as Assimp importer is free to use, the new Ab3d.PowerToys.Assimp library is also free to use without need to purchase a commercial version of Ab3d.PowerToys (when not used with commercial version of Ab3d.PowerToys, Ab3d.PowerToys.Assimp is distributed under MIT license).

 

And today I have many other very good news for you.

 

Let’s continue with presenting you a whole new sample project – Ab3d.PowerToys.AssimpViewer.

This project uses Assimp library to import 3D models from file and show 3D model in the application. What makes it very interesting is that it has some advanced features like:

  • Shows objects names and hierarchies 
  • Shows detailed information about 3D objects
  • Allows object selection with mouse
  • Showing bounding box, normals and triangles for selected object.

For example the following image shows selected duck model with bounding box, triangles and normals:

AssimpViewer with shown bounding box, normals and triangles

This makes it similar to what is possible with Viewer3ds application. The main difference is that for AssimpViewer you can see the whole source code.

This application also demonstrates a new ModelDecoratorVisual3D class that makes showing selected object incredibly simple – for example:

<visuals1:ModelDecoratorVisual3D x:Name="SelectedModelDecorator" 
                                     ShowBoundingBox="False" BoundingBoxLineColor="Red" BoundingBoxLineThickness="2"
                                     ShowNormals="True" NormalsLineColor="Blue" NormalsLineThickness="1"
                                     ShowTriangles="True" TrianglesLineColor="Green" TrianglesLineThickness="1"
                                     TargetModel3D="{Binding ElementName=MyModel3D}"
                                     RootModelVisual3D="{Binding ElementName=ContentRootVisual3D}"/>

As you can see, we just set the target model (selected model), parent Visual and then decide how we want to decorate the selected model – with bounding box, with normal or with triangles. Super simple.

Another improvement from the new version of Ab3d.PowerToys library is a better and nicer CameraAxisPanel – as seen in the lower right corner the new version now shows real 3D arrows instead of 3D lines with arrows. This looks much nicer.

This sample is still under construction (version 0.8). I have big plans with it. I want to turn it into a simple 3D editor where you will be able to add multiple 3D objects from multiple files, move the models around, scale and rotate them. I know that many customers are working on some similar applications. Creating such sample application could mean a huge development time saving for many of them.

 

And now to some other new features.

Many customers are concerned about WPF 3D performance when they need to show very complex 3D models with a lot of 3D parts. One reason for performance problem can be that WPF is using DirectX 9 rendering and that it does not have an optimal rendering pipeline. But many times the reason for slow rendering is that simply too many GeometryModel3D objects are rendered.

This can cause problems because each GeometryModel3D is rendered with using its own DirectX draw call. Draw call is a low level command, that instructs graphics driver and graphics card how to draw one object. Because graphics drivers need to prepare many things before the data from draw call can be send to graphics card, draw calls are very expensive operations. This is also true for DirectX and high end 3D games – usually games tend to keep number of draw calls per frame under 3000. Higher numbers can slow down rendering regardless of the hardware.

With Ab3d.PowerToys we cannot improve the WPF 3D rendering pipeline, but with a new ModelOptimizer it is possible to significantly reduce the number of required draw calls and therefore improve rendering performance. This is done with analyzing the model and combing all models that have the same material into one model – so that only one draw call is needed instead of many.

The following image shows the ModelOptimizer sample that shows (marked with red arrow) that ModelOptimizer has reduces number of objects from 3381 to only 30. 

ModelOptimized sample

This had significant impact on performance. With optimized model the frame rate was easily at 60 FPS (on i7 3770 CPU and GeForce 560 Ti). But when the original model was shown, the FPS dropped to 14.

A drawback of using ModelOptimizer is that you loose the original object structure (but this can be solved with saving the hierarchy and individual objects data into some custom data structure before optimizing the model).

 

There have been some other improvements. 

For example showing 3D models from obj files has been simplified with adding ObjModelVisual3D that can be used in XAML. MaterialTypeConverter has also been improved so that it now Visual Studio 2013 designer can show textures on 3D models. Updating 3D lines has also been improved to allow more flexibility when the lines are updates and when not.

To simplify debugging there are now many extension methods that can be called from Visual Studio Immediate Window to show you many details of the 3D object (see “Dump and Name sample” for more info).

Now it is also very easy to set name to any Model3D object, Visual3D, MeshGeometry or Material – this can be simply done with new extension method: SetName. To get the name, you just call GetName method.

The whole list of improvements and fixes is really long. You can see it on the PowerToys web page (scroll down to versions history).

 

Finally I would like describe my future plans. I have already mentioned that I want to improve AssimpViewer sample. To do that I will add new helper objects that will make moving, rotating and scaling selected object very easy. I am also planning to add support for reading compiled 3D model files (Visual Studio 2013 can compile 3D models from fbx, dae and obj files into its own file format). This would remove the need to use Assimp importer in your projects.

And I am also working hard on a new DirectX 11 rendering engine that should eradicate rendering performance problems and will also bring improved rendering quality to WPF 3D world. I hope that I will be able to release a first open beta version in the beginning of the next year.

 

As always, the existing customers can get the latest version of Ab3d.PowerToys (and Ab3d.PowerToys.Assimp library) from their User Account pages. Others please install the new evaluation version form our Downloads page.

 

And the final great news is a reward to all of you that have read this blog post to the end – to get the reward check out our web site today!

Tags:

Ab3d.PowerToys

Improved performance and WinForms sample in new version of Ab3d.PowerToys

by abenedik 14. September 2014 22:52

I am happy to announce that a new version of Ab3d.PowerToys has been published.

The new version has the following new features:

  • Greatly improved performance of SphereVisual3D and BoxVisual3D.
  • Fixed updating 3D lines when Viewport3D is inside TabControl or when the Viewport3D is moved from one control to another (for example in Avalon dock when the docking of Viewport3D is changed)
  • Optimized LinesUpdater to minimize the number of newly created object each rendering frame.
  • Added WinForms sample that shows how easy is to show 3D graphics in WinForms with embedded WPF and Ab3d.PowerToys

The biggest new feature is performance improvement that is achieved by caching the MeshGeometry3D for the sphere and box models. Before each time the position or size of the sphere or box was changed, the whole MeshGeometry3D was regenerated. Now all the spheres (with the same segment count) and boxes share the same MeshGeometry3D. To create the sphere and box at the specified position and size, a MatrixTransform is used.

The biggest performance gain of the new rendering is get when the spheres and boxes are animated – when the position or size is changed. Because now it is not needed to recreate the whole MeshGeometry3D the animation can be much smoother – on some computers even more than 20 times faster.

Because the new model generation algorithm reuses the MeshGeometry3D, much less data is sent to graphics card and therefore the models can be rendered much faster. On some computers more than 5 times better frame rate can be achieved. 

To test the new functionality a new sample was added to the Ab3d.PowerToys samples. The following screenshot shows the sample running and showing the number of spheres, triangles and positions and the current frame rate (on Intel i7 3770 and a more than 2 years old NVidia 560 GTX Ti):

WPF 3D performance with Ab3d.PowerToys

 

Sceptics of WPF 3D can see that when WPF 3D is used property it can have quite decent performance – animating (changing size) for 3375 spheres (more than 3 million triangles and more than 17 million positions) runs at 33 frames per second.

The new sample can be also very appealing visually – the following image shows one of such interesting screenshots (animated version is even better):

WPF 3D performance with Ab3d.PowerToys

 

Delivering the best possible performance for WPF 3D graphics have always been our goal. Therefore I am planning to add some additional performance improvement to the next version – this time improving performance of complex 3D models read with Reader3ds or some other model importer.

I would also like to say a few more things about using WPF 3D inside WinForms application. 

And now to WinForms. Surprisingly a lot of .Net developers are still using WinForms. For them I have prepared two samples that shows how easy is to add 3D graphics to WinForms. It is not needed to spend half a year to learn DirectX or some other game engine. With using ElementHost control the developers can enjoy in using the easiest 3D API: WPF 3D with Ab3d.PowerToys.

The first sample that comes with the new version of Ab3d.PowerToys library show that with a little bit more than 200 lines of c# code, it is possible to create an interesting 3D scene with dynamic objects that change color on mouse actions. The following image shows a screenshot of the sample:

WPF 3D inside WinForms

 

WinForms developer will be glad to hear that that do not need to use XAML, binding or any other new concept that is introduced by WPF. 

On the other hand the second sample shows that it is also possible to define the whole 3D scene in XAML. When using WinForms designer this scenario is very well supported: after adding ElementHost to the form, it is possible to click on a small right arrow in the upper right corner and from a drop down menu select from all the WPF’s UserControls in the solution. This way it is possible to design the scene in XAML and use Visual studio designer to preview the 3D scene.

 

I would like to conclude this blog post with the following announcement: I am already working on next major released of Ab3d.PowerToys. It will contains the already mentioned functionality to optimize the 3D models for best performance. But the biggest new feature will be added support for importing 3D models from almost all 3D file formats.

Tags:

Ab3d.PowerToys

New version of Ab3d.PowerToys brings improved support for touch and better user experience when rotating the camera

by abenedik 19. June 2014 22:26

Touch and multi-touch support is becoming more and more important. The previous version of Ab3d.PowerToys had only basic touch support – it supported only those touch events that were transformed into mouse events. To get better touch support users needed to use MultiTouchMouseCameraController class that was available in a separate project.

The new version adds excellent touch and multi-touch support to the core of the Ab3d.PowerToys library. This means that without any change in your code, the users of your application that will have touch screen will be able to rotate and move the camera with touch and also use pinch to zoom in and out. New MouseCameraController has many new properties that can be used to configure the touch actions.  To get full control of touch events, you can override some methods that control the behavior of MouseCameraController. See help file for more information.

To further improve the user experience, the new version now also adds camera rotation velocity inertia. This means that if user rotates the camera and then released the mouse button (or touch), the velocity of the camera rotation is preserved and the camera’s rotation is stopped slowly. This looks much more naturally, especially when used with touch.

The new rotation easing is now also supported by StartRotation and StopRotation methods. Now it is possible to start and stop rotation with slowly accelerating / decelerating the rotation velocity.

The last new feature is related to HeightMapVisual3D. Now when the data that is set to HeightData is changed, it is possible to call the new UpdateContent method to update the 3D model of the height map.

 

I hope you and your customers will like the new features. If you have any additional requests or ideas, please do not hesitate to contact us.

Tags:

3D visualization of Kinect skeleton

by abenedik 11. April 2014 10:14

In this blog post I will show you how easy is to show Kinect skeleton as a 3D model.

Ab3d.PowerToys Kinect sample

To jump start into 3D programming we will be using WPF and Ab3d.PowerToys library. The library will help us with providing the standard 3D models that will be used to display the skeleton and cameras that can be easily controller by the user.

The image above shows us that the skeleton is created from yellow spheres that represent the joints and bi-pyramids are used to connect the joints together. To make the sample more interesting the skeleton has a Darth Wader’s head. Below the skeleton model a 3D wire grid is shown. It represents the floor.

In the lower right corner three different types of arrow buttons are shown. They can be used to control the camera – move, rotate and zoom in / out the camera. They are created by simply adding CameraControlPanel to the Window. Camera can be controlled also without using buttons. The MouseCameraController lets you rotate the camera with holding down the left mouse button, zoom in and out with mouse wheel and move the camera with holding control key and left mouse button. The MouseCameraController also provides easy way to specify different combinations of keys and mouse buttons for rotate and move actions.

Before diving into the code that shows the 3D model, let’s quickly look how we get the required 3D data from Kinect. Kinect SKD can provide real time skeleton and depth data. To make the sample work without having an actual Kinect device and an actual actor in front of the sensor, the Kinect data was saved into files with using Kinect Toolkit (an open source helper library). This way we can replay the recorded data any time we want.

For each recorded frame we get data for all recorded skeleton models. For each skeleton we get collection of joints and BoneOrientation objects. With them it is quite easy to get the actual 3D positions of the joints and the transformations (rotations and translations) applied on each of the joint. Once we have that data we can start on code that will show our 3D model.

In our sample we can show the 3D model in 4 different ways.  User can change that by selecting different value in the “Skeleton display mode” ComboBox. The following are the available options:

  • Lines,
  • Pyramids,
  • BiPyramids,
  • TransformedBiPyramids


Using 3D lines

The simplest solution to show 3D model is to show it with 3D lines. Actually, if we would be using only standard WPF 3D objects without Ab3d.PowerToys, this would be the hardest solution to implement. The problem is that WPF 3D does not have native support for 3D lines and therefore they need to be created manually by defining the triangles that would show 3D line. Luckily Ab3d.PowerToys library adds that support to WPF. With the Ab3d.PowerToys library the code to add 3D line between two joints is the following:

AddSkeletonLines(Point3D startPoint, Point3D endPoint)
{
    var lineVisual3D = new LineVisual3D()
    {
        StartPosition = startPoint,
        EndPosition = endPoint,
        LineColor = Colors.Green,
        LineThickness = _skeletonThickness * 100.0
    };

    Placeholder3D.Children.Add(lineVisual3D);
}

The following image shows how the skeleton is shown when using 3D lines:

Ab3d.PowerToys Kinect sample

Note that it is very easy to define the line thickness.

Using pyramids

Using 3D lines already gives you some 3D feeling of the model, especially because you can rotate the camera around the model and observe it from any angle.

To give the model a better 3D look, we will use 3D pyramids to connect joints.

Because we need to orient the pyramid model based on start and end position, we cannot use standard pyramid model from Ab3d.PowerToys library. Instead we need to use a low level object - DirectedPyramidMesh3D. It can create a MeshGeometry3D that represent a pyramid oriented in such a way that the pyramid’s center is defined by start point and the pyramid’s top is define by end position.

The following screenshot shows the skeleton displayed with pyramid:

Ab3d.PowerToys Kinect sample

Using bi-pyramids

Pyramids already gave us a better 3D representation that is more similar to actual 3D person model. But this can be further improved with using bi-pyramids. Bi-pyramids are objects that are created with combining two pyramids together.

We could easily create bi-pyramid with using two objects created with DirectedPyramidMesh3D. All we needed to do is to use the end position of the first directed pyramid as the start position of the second directed pyramid.

But to demonstrate some advanced features of the Ab3d.PowerToys we will create bi-pyramids with using lathe 3D objects. Lathe 3D object is an object that is defined by a 2D shape and start and end position. The 2D shape is than rotated around an axis defined by start and end position. This creates a 3D object – typical lathe objects are glasses and vases.

The following image shows a screenshot from samples that come with Ab3d.PowerToys library and show how a lathe 3D object was created (the 2D shape is shown on the right with red line):


The 2D shape used to define the lathe object is defined by LatheSections. Bi-pyramid is actually one of the simplest lathe objects possible – it requires only one section definition. This section defines how wide the bi-pyramid is.

After implementing the creation of bi-pyramids our skeleton looks like the first image in this blog.

From the list of display mode options you can see that it is also possible to show the skeleton as TransformedBiPyramids. This option shows the same skeleton as with bi-pyramids, but instead of using start and end position to define the object orientation, this time the transformation of the joint is used to rotate the bi-pyramid. This option provides a possible optimization. It can be achieved by creating the bi-pyramid model only once and then apply different transformation to it.

Similar optimization was used for showing joint spheres. Here we create only one instance of sphere GeometryModel3D and then use different transformations to position and scale the individual joint models around the skeleton.

The only thing yet to describe is how the head was created. We used a Darth Wader image and use it as a texture shown on a 3D plane. Once we have the position of the head and a head transformation, it is super easy to add Darth Wader head to the skeleton:

// Add head - show image for head
var headPosition = skeleton.Joints[JointType.Head].Position.ToPoint3D(_skeletonScale) + offset;

var headPlane = new PlaneVisual3D()
{
    CenterPosition = headPosition,
    Material = _headMaterial,
    BackMaterial = _headMaterial,
    HeightDirection = new Vector3D(0, 1, 0),
    Normal = new Vector3D(0, 0, 1),
    Size = new Size(_skeletonScale * 0.3, _skeletonScale * 0.3),
    Transform = skeleton.BoneOrientations[JointType.Head].AbsoluteRotation.ToRotateTransform3D(headPosition)
};

Placeholder3D.Children.Add(headPlane);

Adding special model for head finishes our 3D visualization of Kinect skeleton.

As you have seen, having the right tools makes the job very easy. And Ab3d.PowerToys library contains the ultimate collection of tools to add 3D content to your .Net application very easy. More about the library can be read from Ab3d.PowerToys web page.

The sample with full source code is available with Ab3d.PowerToys library. The trial version of the library can be downloaded from downloads page.

Tags:

Ab3d.PowerToys

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

Tags:

Ab3d.PowerToys

Read 3D models from obj files with new version of Ab3d.PowerToys

by abenedik 29. November 2013 13:40

Ab3d.PowerToys library continues to get great new features. The new version gets ability to read 3D models from obj files. This adds a great new value to the Ab3d.PowerToys library because now it is possible to import 3D objects directly with the library.
Obj file format is very common file format to store 3D models. The model data is written in simple text format.

The following screenshot shows a 3D ship model that was read with the new Ab3d.ReaderObj library:
ReaderObj screenshot

Because now it is possible to import 3D models only with Ab3d.PowerToys library, the question arises if we still need Ab3d.Reader3ds library to read 3ds files. The following are the main differences between obj and 3ds file format:
obj is a text file; 3ds is a binary file,

  • 3ds file can define hierarchy of 3D objects with object transformations; obj file does not support hierarchies and transformation,
  • obj file does not support animations,
  • 3ds file is not capable of storing texture file names that exceed the 8.3 format; file names in obj file can be in any length.



The main difference is that animations and object’s hierarchies are supported only by 3ds files. For example if you need to create 3D objects similar to that used in Robotarm sample where rotating one part of the robot also rotates all child objects, you will need to use 3ds files to store the hierarchies.
Anyway obj files are still very common to store simple 3D models.

I would also like to mention that the code that is used to read obj files is highly optimized to parse the values from text files very fast. Also when common methods like Split and Regex are used to parse large text files in .Net with the memory usage can be very high – many string instances can be created. The code in ReaderObj class has been optimized also in regard to memory usage to minimize the creation of many string instances.

The version also has the following new features and bug fixes:

  • Fixed performance of LinesUpdater when the camera or other property is not changed (before lines were recreated every time, now only when they need to),
  • Added additional override of Dumper.Dump with Model3D as paramter to write Model3D info to Visual Studio output or immediate window.


The new version also comes with a new very interesting arrows sample that animate the arrows in a very nice way. The following screenshot show the sample:
Arrows sample screenshot

You can also see the new sample in a new video that also shows some other samples.

Tags:

Ab3d.PowerToys