Ab3d.PowerToys is the ultimate helper library to create .Net applications with 3D content.
The main features of the library are:
- The easiest to use 3D API with many great code samples
- Cameras (SceneCamera, FirstPersonCamera, ThirdPersonCamera, etc.)
- Camera Controllers (MouseCameraController, CameraControlPanel)
- 3D Models and Visuals (Sphere, Box, Cylinder, etc.)
- Generate extruded or lathe 3D objects
- 3D Lines (the fastest implementation for connected, disconneded and lines with arrows)
- 3D Text
- Event Manager 3D (simplified event handling on 3D objects)
- Complete solution for WPF 3D transparency problem
- Many helper classes to ease work with WPF 3D
- Support for touch and multi-touch to rotate, move and zoom the camera
- Integrated obj file reader to read 3D models from obj files
- fully optimized to achive best possible performance
With purchasing the Ab3d.PowerToys library you also get premium e-mail support for all questions regarding WPF 3D and our libraries.
Cameras, 3D Models, Lines and Text can be defined in XAML. The
results are immediately shown in Visual Studio Designer so the
whole 3D scene can be designed in Visual Studio almost as in a 3D modeling application.
Showing 3D content was never easier!
Cameras and Camera Controllers
The library defines a few new Cameras that can be used instead of the current WPF's
cameras. The main difference between Ab3d Cameras and WPF cameras is that Ab3d Cameras
does not use Vectors to define the LookDirection, but instead use angles in degrees
to define it. This is much more natural. For example if you want to look at the
scene a little bit from the right and from above, you just define the Heading to
be 30 and Attitude to be -45. You can also define the Distance from the scene. The
most important Ab3d Cameras are: SceneCamera, FirstPersonCamera and ThirdPersonCamera.
A good overview of the new cameras can be seen in the Cameras cheat sheet
document that can be opened from a link below.
Camera Controllers are used to control the camera. The MouseCameraController
can be used to rotate and move the camera with the mouse. The rotation and movement
can be configured to any combination of mouse buttons and keyboard modifiers (shift,
control and alt). For example the following XAML sets the MouseCameraController
to rotate the camera with left mouse button and to move the camera with left mouse
button and alt key pressed:
The CameraControlPanel shows nice buttons to rotate and move the
camera and also move the camera closer or farther away. There are also a CameraPreviewPanel
and CameraAxisPanel that graphically show the current orientation
of the camera.
The Ab3d.PowerToys library also contains classes to create basic 3D models in code
or XAML. It is possible to create Plane, Circle, Box, Arrow, Pyramid, Sphere, Cone
and Cylinder 3D models. The library also supports creating objects by extruding a shape or by converting a shape to 3D object with lathe algorithm.
To make the 3D objects definitions cleaner a ModelTypeConverter is used for all
Material properties used by 3D objects. This way it is possible to set the material
with a color name or code (#FFFFAAAA) or image uri.
The library support 3D Lines with optimized update mechanism
that makes the 3D lines implementation the most advanced and with the best performance
The library also supports 3D Text that can be defined anywhere
in 3D space. The text is drawn as a series of connected 3D lines that are created
from internal font definition.
The EventManager3D class is a helper class that enables user to
simply subscribe to mouse events on 3D objects. The following mouse events are supported:
MouseEnter, MouseLeave, MouseMove, MouseDown, MouseUp, MouseClick, BeginMouseDrag, MouseDrag,
EndMouseDrag and MouseDoubleClick. This way you do not need to do the
complicated 3D hit testing any more. The EventManager3D is also better than WPF's
ModelUIElement3D because it supports more mouse events (including mouse drag in
3D), provides better event data and preserves the structure of the 3D models. This
way your code is much simpler and better organized.
WPF 3D can show transparent 3D objects. But to show them correctly, the transparent
objects need to be correctly sorted. Without this some of the objects are not visible
through the transparent objects. Ab3d.PowerToys provide complete solution to this
problem. More about that can be read in
Transparency Sorting page.
Obj files reader
Ab3d.PowerToys includes a Ab3d.ReaderObj class that can be used to read 3D models from obj files.
Obj file is very common file format to store 3D models.
It usually comes with mtl file that defines the materials used in obj file.
Because data in obj and mtl files is written in plain text, parsing the values can be quite slow and can consume a lot of memory (creating many string instances).
Therefore the ReaderObj has been greatily optimized to read obj files very fast and with very low memory usage.
To get some additional information about using Ab3d.PowerToys and see how easy is to create great business applications with 3D graphics see the following blog post.
Ab3d.PowerToys cheat sheets:
Screenshots with XAML source:
- Greatly improved performance of SphereVisual3D and BoxVisual3D with using cached MeshGeometry3D (added UseCachedMeshGeometry3D property to control mesh caching). The biggest performance improvement is when the position or size of many spheres or boxes is changed.
- Fixed updating 3D lines when Viewport3D is inside TabControl or when the Viewport3D is moved from one control to another.
- 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
- Improved support for touch and multi-touch in MouseCameraController in the .Net 4 version of Ab3d.PowerToys assembly. Before the touch was supported with special MultiTouchMouseCameraController (available in source code in a separate project). Now this support is integrated into the core MouseCameraController.
- To configure the touch support the following new properties are now available on MouseCameraController: IsTouchEnabled, IsTouchRotateEnabled, IsTouchMoveEnabled, IsTouchZoomEnabled and IsConcurrentTouchZoomEnabled. To get full control on what happened when user touches the screen users can also override the following methods: GetManipulationActions, OnManipulationDelta, OnManipulationStarted, OnManipulationCompleted (see help file for more info).
- When camera is rotated by mouse and user suddenly releases the mouse or touch, the camera rotation is preserved. This is controlled by new RotationInertiaRatio and RotationEasingFunction properties on MouseCameraController.
- StartRotation and StopRotation methods on cameras that derived from SphericalCamera now have additional parameters that can be used to specify acceleration and deceleration speed and easing function.
- Changed the UpdateContent method in HeightMapVisual3D from private to public. The method updates the 3D mesh after the HeigthData is changed.
- 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.
- Added ReaderObj and ObjFileToWpfModel3DConverter that can read 3D objects from obj files.
- Fixed performance of LinesUpdater when the camera or other property is not changed.
- Added additional override of Dumper.Dump with Model3D as paramter to write Model3D info to Visual Studio output.
- Added CalculateUpDirection to Ab3d.Utilities.CameraUtils.
- Added 3D objects:
- Added Ab3d.Utilities.Triangulator to convert a polygon that is defined by a list of 3D points into triangles that can be than used to create 3D object.
- Added Ab3d.Meshes.Mesh3DFactory to create 3D extruded objects.
- Added LatheMesh3D to Ab3d.Meshes - used to create MeshGeometry3D that represents a 3D object that is created with rotating the shape for 360 degress.
- Added ArrowMesh3D, ArrowVisual3D and ArrowUIElement3D that represent a 3D arrow object.
- Added RegisterExcludedVisual3D and RemoveExcludedVisual3D methods to EventManager3D - this exclude some 3D objects from hit testing.
- Added CustomEventsSourceElement property to EventManager3D - it can be used instead of TargetViewport3D to get the mouse events (MouseMove, MouseEnter, MouseLeave).
- Added MouseMove event to EventManager3D.
- Added FinalPointHit to all EventArgs used in EventManager3D event handlers - it gets the transformed 3D point that was hit by the mouse (if Visual3D uses Transformation, than HitPoint will be wrong, but FinalHitPoint will be transformed).
- Improved debugging with improvements in Dumper class:
- Added support to control the values format string (number of displayed decimals) when using Ab3d.Utilities.Dumper.
- Fixed Dumper.GetTransformText that returns the formatted text that describes the Transform3D object (some string.Format parameters were wrong).
- Added DumpMeshInitializationCode and GetMeshInitializationCode methods to Ab3d.Utilities.Dumper - the methods create C# text that can be used to create MeshGeometry3D.
- When no Normals or TextureCoordinates are defined the Ab3d.Utilities.Dumper will not show zero values for them.
- Other improvements and fixes:
- Added CreateMouseRay3D to BaseCamera - it can be use used to calculate the 3D ray that goes from the mouse position into the 3D scene.
- Improved Refresh method in LinesUpdater - calling this method now forces to redraw all visible lines.
- Added MaxLineArrowLength and LineArrowAngle to LinesUpdater to better control the size and shape of the arrows on 3D lines.
- Fixed LineWithTextVisual3D when it was created in code behind and the properties were set without using BeginInit and EndInit methods.
- Fixed recreating the content of 3D objects derived from Visual3D (if initially IsVisible was set to false and was then set to true the object was not shown under some circumstances).
- Added many possibilities to change the CameraAxisPanel with overriding CreateAxisVisual, SetAxisLength, SetAxisColors or EnsureAxisTextBlocks (the later also existed before)
- Improved performance of Box3D geometry mesh creation when X, Y and Z segments count is 1 (simple box with 2 triangles for one plane) - the mesh is now created 10 times faster.
- Moved initialization of RotationCursor in MouseCameaController from constructor to OnLoad event handler - this prevented calling virtual method in constructor.
- Added support for the Ab3d.DXEngine (still under construction) - objects created with Ab3d.PowerToys library will work correctly when used inside Ab3d.DXEngine (DirectX 11 rendering engine).
- Added GetCameraPosition method to BaseCamera.
- Fixed creating geometry for Visual 3D objects when no property is changed on the visual (for example if default size is used).
- Fixed showing long 3d lines that cross the near camera plane (before such lines were not correctly shown).
- Improved measuring size of CameraControlPanel - now it is possible to define only desired Width or Height and the control automatically sets the other (Height or Width).
- In MouseCameraController the StartMouseProcessing and EndMouseProcessing are now protected virtual and can be overriden (before they were private).
- Improved creation of sphere mesh - before some triangles were defined in such a way that they represented a line instead of triangle (two positions in the triangle were defined in the same position in space).
- Added possibility to create a slightly improved sphere mesh when there is no need to create texture coordinates (this can be done with spefiying generateTextureCoordinates as false in the Ab3d.Meshes.SphereMesh3D constructor).
- Added DumpMatrix3D to Dumper.
- Improved FpsMeter when custom DisplayFormatString is set.
- Fixed creating PolyLines when it is created with duplicate positions - Index out of range exception was thrown before.
- Improved support for Visual Studio 2012 designer - now cameras correctly discover Viewport3D control when TargetViewport3D is not manually set.
- Fixed a typo with renaming WireBoxVisual3 into WireBoxVisual3D (BREAKING CHANGE!).
- Improved 3D Text - now ? character is correctly displayed instead of a character that does not have its 3D shape defined.
- Fixed problem with displaying 3D Text in Visual Studio designer.
- Added HeightMapVisual3D and HeightMapMesh3D.
- Added TubeMesh3D, TubeVisual3D and TubeUIElement3D.
- Added support to very easily create 3D curves: added Ab3d.Utilities.BezierCurve and Ab3d.Utilities.BSpline classes; also added CreateBSpline3D and CreateNURBSCurve3D to Line3DFactory.
- Improved LinesUpdater performance and removed possible memory leaks.
- Added Reset method to LinesUpdater that takes Viewport3D as parameter to reset (remove all lines) from specific Viewport3D.
- Added MouseWheel event to EventManager3D.
- Fixed rotating with MouseCameraController and CameaControlPanel when the scene in vertically inverted when Attitude is between 90 and 270 degrees.
- Fixed EventManager3D where under some circumstances a new object drag can be automatically stared just after end drag event.
- Improved MaterialTypeConverter: Added support for simply defining SpecularMaterial and EmissiveMaterials. For example the "s:32;Blue" text can be used to define MaterialGroup with DiffuseMaterial and SpecularMaterial (SpecularPower = 32; SpecularBrush = White; DiffuseMaterial = Blue). The "e:Yellow" can be used to show yellow emissive material. Also improved support for defining textures path (now files from local disk and from http can be used).
- Fixed occasional NullReferenceException in SphericalCamera when layout is updated in Visual Studio designer.
- Added support for transparency sorting with new TransparencySorter
and TransparencyHelper classes.
- Simplified animating camera rotation with new StartRotation, StopRotation
methods on SphericalCamera. There is also a new IsRotating properties. The MouseCameraController
is also adjusted to suspend animated rotation while user rotates the camera with
- Added axes names to CameraAxisPanel. Also added IsAxisNameShown,
XAxisColor, YAxisColor and ZAxisColor properties to CameraAxisPanel.
- Added support for OrthographicCamera for all Ab3d.PowerToys Cameras.
Added CameraType and CameraWidth properties to BaseCamera.
- Greatly improved creating wireframe from existing 3D models - now
it is much faster and uses much less memory.
- Improved LinesUpdater - the lines that are removed from the visual tree are now
free to be cleaned by garbage collection.
- Added Reset and UnregisterLine methods to LinesUpdater to manually remove lines
from LinesUpdater. This enables better manual control of the registered lines.
- Improved measuring scene bounds in SceneCamera when transformations are used on
Visual3D objects. Before the used transformations prevented the camera to correctly
show the scene.
- Fixed selecting cameras with mouse click on camera icon in Visual Studio 2010 designer.
- Added GetCameraMatrixes to BaseCamera to get view and projection Matrix3D of the
- Improved Ab3d.Utilities.Dumper class - Added GetTransformText and GetMatrix3DText
methods and made GetMaterialText public. Also the GetModelInfoString method now
also displays the Transformation details.
- Improved commercial licensing code to prevent delay caused in RSACryptoServiceProvider
under some circumstances.
- Added Ab3d.Licensing.PowerToys.EmbeddedLicenseAssembly property to speed-up looking
for embedded license key in commercial version.
- Fixed licensing code for WPF Browser applications (partially trusted) - before licensing
did not work when both Ab3d.Reader3ds and Ab3d.PowerToys were used (defined in license.licx
- Added Offset to all cameras to move the camera around.
- Added support for moving camera with MouseCameraController and CameraControlPanel.
- Added RotateCameraConditions and MoveCameraConditions properties to MouseCameraController
to fine tune the conditions to rotate and move the camera.
- Added 3D Text support with TextVisual3D, CenteredTextVisual3D and LineWithTextVisual3D.
- Added MultiMaterialBox where each side of the box can have its own material.
- Added CreateFrom method to all Ab3d.Cameras - it can be used to create any Ab3d.Camera
from existing WPF's Camera (or camera read from 3ds file with Ab3d.Reader3ds).
- Added CameraAxisPanel - a predefined panel that shows the axis orientation for the
- Added RectangleVisual3D, WireBoxVisual3, WireCrossVisual3D, VerticalPlaneVisual3D
- Added IsVisible to all 3d models derived from Visual3D. Now all Visual3D are derived
- Added CreateWireframe method that takes Model3D to create wireframe from Model3DGroup
- Added IsClosed property to WireGridVisual3D - if true a rectangle is drawn around
wire grid to close the grid.
- Added possibility to set 3D line thickness to 0 to hide the line - the same as set
IsVisible to false.
- Added Refresh method to all UIElemet3D classes - this way it is possible to force
creation of used Model3D also if the UIElemet3D is not added to Viewport3D.
- Added EventsSourceElementName to MouseCameraController - now it is possible to specify
the custom event source also by specifying the element name.
- Added GetModelInfoString method to Ab3d.Utilities.Dumper class - it gets a string
with details about the GeometryModel3D or Model3DGroup.
- Added IsDesignTimeInfoIconShown property to Ab3d.Cameras to hide camera info icon
in design time - useful for custom controls that use Ab3d.Cameras.
- Added Ab3d.Utilities.CameraUtils with CalculateCameraAngles to get camera angles
(heading, attitude, bank) from lookDirection and upDirection.
- Added Ab3d.Utilities.MathUtils.Rotete method to rotate Vector3D or Point3D for heading
- Added Ab3d.Utilities.MathUtils with IsOne, IsZero and IsSame methods that take double
precision errors into account.
- Added Refresh method to all UIElemet3D classes - this way it is possible to force
creation of used Model3D also if the UIElemet3D is not added to Viewport3D.
- Improved the MaterialTypeConverter to support creating a DiffuseMaterial with ImageBrush
from image resource name - for example Material="/Resources/PowerToysTexture.png".
- Improved line arrows - improved displayed when camera is pointing almost in the
direction of the line.
- Improved 3D PolyLines - lines are now connected to each other.
- Fixed for using in PartiallyTrusted environment - using Hand cursor instead of custom
- Automatically Disable / Enable the MouseCameraController and CameraControlPanel
if Traget Camera's IsEnabled property is changed.
- Fixed using StartLineCap and EndLineCap on PolyLines.
- Improved DoubleClick event in EventManager3D - now the DoubleClick event does not
trigger the Click event on the second click (if the DoubleClick event is subscribed).
- Fixed normalizing normals in MeshUtils.CalculateNormals method.
- Fixed using TargetViewport3DName property on Cameras in Visual Studio Design Time
- in Design Time there is no NameScope so the FindName method does not work. To
fix this the code looks for Viewport3D manually by checking the Camera's Parents
Children. This means that the Camera must be defined under the same parent as the
Viewport3D in order that the TargetViewport3DName works in Design Time.
- Fixed using StartLineCap and EndLineCap on PolyLines.
- BREAKING CHANGE: Fixed Bank - now the positive bank values rotate the camera in
the clockwise direction (before the direction was counter-clockwise). For example
bank angle 30 means that the Camera is rotated as a head would be bended to the
To see the development history of Ab3d.PowerToys, check out the
related blog posts
Information about changes: