New version of Ab3d.DXEngine and Ab3d.PowerToys bring support for normal mapping and many other great new features

by abenedik 6. December 2017 23:26

I am happy to inform you that a great new update of main 3D libraries is available.

This time most work was done to improve the Ab3d.DXEngine - DirectX rendering engine.


The highlights of the new version are:

  • Added support for normal mapping (also called bump mapping).
  • Added rendering 3D lines with patterns (enables rendering of dashed and dotted 3D lines).
  • Improved texture loading with support for loading DDS files.
  • Improved Assimp importer that can now also read and play keyframe and skinned animations from many 3D file formats (including fbx and dae).


DirectX 11 normal or bump mapping with DXEngine

Normal mapping is now supported with a new MultiMapMaterial class. This material defines a list of maps or textures where for each map its usage type is defined. This way it is possible to define a material with diffuse, normal, specular and also environment map. A drawback of the current version is that shadow rendering is not yet supported where rendering objects with MultiMapMaterial .


Dashed and dotted 3D lines with Abd3.DXEngine

3D lines rendering is greatly improved in this version of Ab3d.DXEngine. There is now a new ILinePattern interface that defines LinePattern, LinePatternScale and LinePatternOffset properties. This not only allows rendering dashed and dotted lines but with changing LinePatternOffset it also provides an option to animate the dashed lines - for example, to show a way or direction. Also, this version now supports full hardware acceleration of rendering connected 3D lines (polylines). This means that you do not need to use special properties to render connected 3D lines as disconnected 3D lines anymore.


What is more, both Ab3d.DXEngine and also Ab3d.PowerToys now have a new MitterLimit property that defines when a sharp line connection is turned into beveled (cut) line connection.


Skeletal animation with Ab3d.PowerToys

3D models can be read into your application with using Assimp importer library that can read data from almost any 3D file format. But until now only static models can be imported. The only way to play animations was to use Ab3d.Reader3ds library and play animations stored with 3ds files. But the new version of Ab3d.PowerToys.Assimp library supports reading keyframe and also skinned animations. There is also a new AssimpAnimationController that can play both keyframe and skinned animations. This way it is possible to read animations from almost any 3D file format that support storing animation data.


Optimized point cloud DirectX rendering with Ab3d.DXEngine

A lot of work was also dedicated to providing an efficient way of rendering many millions of pixels - the so-called point clouds. The new OptimizedPointMesh class can optimize rendering of huge point clouds in two ways. First, it can determine which parts of point cloud are visible to the camera. Second, on the visible parts it can check the following positions and if they would be rendered so close together that the distance on the screen would be less then one pixel, they are rendered only once as only one pixel. Those two optimizations can in most of the cases provide huge performance improvements (but still, investing in a high-end graphics card is the most efficient way to deliver substantial performance gains).


When 3D models with very detailed textures (for example 4096 x 4096) are loaded, the texture initialization can take quite a lot of time and memory. Most of the time and memory is used to create mipmaps of the texture. Those are required to get efficient color sampling on the graphics card. To improve this, modern 3D games use DDS texture formats. This file format is optimized for the graphic card and also alredy include mipmaps.


The new version of Ab3d.DXEngine provide a few easy ways to load DDS textures instead of standard png or other files. This can significantly improve load time.


There are also many other improvements and fixes. The following is the full list of changes:

Ab3d.DXEngine v2.3:

  • Implemented rendering materials with diffuse, normal (bump) and specular texture. Note: does not work yet with shadow rendering.
  • Added MultiMapMaterial that can be used to render material with diffuse, normal, specular and environment reflection texture.
  • Added DXAttributeType.MeshTangentArray that can be set to the MeshGeometry3D with SetDXAttribute extension method and allows attaching tangent array to MeshGeometry3D
  • Added Ab3d.DirectX.Utilities.MeshUtils.CalculateTangentVectors method (can be used calculate tangents on the CPU for objects that are rendered with normal / bump map)
  • Added support for rendering 3D lines with custom pattern. This allows rendering dashed and dotted lines (only for disconnected 3D lines; not for poly-lines):
  • Added ILinePattern interface with properties that define line pattern: LinePattern, LinePatternScale and LinePatternOffset.
  • Implemented ILinePattern with LineMaterial object.
  • Added LinePattern, LinePatternScale and LinePatternOffset to DXAttributeType. This way it is possible to specify line pattern parameters on LineVisual3D objects with using SetDXAttribute extension method.
  • Added support for rendering connected 3D lines (PolyLineVisual3D, etc.) with full hardware acceleration. Note that lines with arrows are not rendered with full hardware acceleration.
  • Changed default value of DXScene.RenderConnectedLinesAsDisconnectedLinesThicknessLimit from 3 to 0 - so connected lines that are thinner than 3 are not rendered as disconnected lines by default.
  • Added IPolyLine interface with IsPolyLine and MiterLimit properties.
  • Updated LineMaterial to implement IPolyLine interface.
  • Improved time and memory consumption when reading textures.
  • Added Ab3d.DirectX.TextureLoader.LoadShaderResourceView method that can be used to load textures from standard image files (png, jpg, tiff, gif, bmp) and from DDS files.
  • Added Ab3d.DirectX.TextureLoader.CreateShaderResourceView method that can create ShaderResourceView from texture stored in byte array (for cases when bitmap is read from a stream).
  • Added static bool LoadDdsIfAvailable field to WpfMaterial. When LoadDdsIfAvailable us true, then the texture loader will check if there is a DDS file with the same name but dds file extension. In this case the DDS file will be loaded. Using dds files can greatly improve required load time and memory usage.
  • Added static CreateTexture2D method to WpfMaterial that creates a ShaderResourceView from the specified WPF BitmapSource.
  • Created OptimizedPointMesh class that can be used to show point cloud and can dynamically reduce the number of rendered positions to improve rendering performance.
  • Make CalculateCameraPlanes on DXScene public. The method calcualates zNear and zFar values for the specified camera.
  • Added ParentNodeChanged and ResourcesInitialized events to SceneNode.
  • Added ForegroundRenderingQueue to DXScene. This is a new rendering queue that is rendered after GeometryRenderingQueue but before TransparentRenderingQueue.
  • Set default values of ReadZBuffer and WriteZBuffer properties on PixelMaterial to true.
  • Removed ScreenSpaceLineNode constructors that takes both isPolyLine and LineMaterial as parameters - IsPolyLine values is now provided only by LineMaterial parameter (when it implements the IPolyLine interface).
  • Added CustomRenderableNode and CustomRenderablePrimitive. Those two SceneNode classes simplify using custom rendering logic to render 3D objects with providing a callback method that is called to render the 3D object (used can call Draw calls on DirectX device in the callback method).
  • Added DXAttribute OnSceneNodeCreatedAction. Its value can be set to a callback method defined by an Action<SceneNode>. The callback method is called after a SceneNode is created from the WPF object.
  • Added DXAttribute OnDXResourcesInitializedAction. Its value can be set to a callback method defined by an Action<object>. The callback method is called after the specified DXEngine's resource is initialized and DirectX resource objects are created.
  • Fixed problems when color from PixelEffect is used to render 3D lines instead of the color defined in the LineColor property (and vice-versa).
  • Added dpiX and dpiY parameters to DXView.RenderToBitmap method (they default to 96 but can be changed by the user).

Breaking changes:

  • Renamed Ab3d.DirectX.ContexStatesManager class to Ab3d.DirectX.ContextStatesManager to fix spelling of the class.

Apart from samples that demonstrate new functionality the following samples are also added or improved:

  • Added BackgroundObjectsCreation sample that shows how it is possible to initialize 3D objects on the background thread so that when they are shown the UI thread is not blocked for a longer time.
  • Added Frustum culling sample. The sample shows how to determine which 3D objects are visible in the camera view. 
  • Improved WinForms sample to show how to use DXViewportView in WinForms with SharpDX.RenderForm. Using DXViewportView in WinForms application allows easy conversion of samples from Ab3d.DXEngine and Ab3d.PowerToys to WinForms application.


Ab3d.PowerToys v8.1

  • Added MiterLimit property to PolyLineVisual3D, MultiPolyLineVisual3D, RectangleVisual3D and LineArcVisual3D (all lines derived from BasePolyLineVisual3D). The MiterLimit value specifies when the mitered line joint is changed into beveled line joint.
  • Added support to read 3D lines from obj files with ReaderObj. Before lines can be read, the ReaderObj.ParentModelVisual3D property must be set. Lines color is get from material's diffuse color (or ReaderObj.DefaultMaterial). Line thickness is always set to 1.
  • Improved XInputCameraController when to continuously move up or down when the DPad buttons are pressed and when MoveVerticallyWithDPadButtons is true  (before user needed to release the button and press again)
  • Added support for ModelUIElement3D objects when calling ModelUtils.GetBounds and ModelIterator.IterateGeometryModel3DObjects methods
  • Added CurrentFrameNumber property to AnimationController
  • Changed type used for FrameNumber in animation classes from int to double.
  • Fixed Ab3d.Utilities.Dumper.GetMatrix3DText to correctly use the specified indentText and newlineText
  • Added static FormatMatricesHorizontally method to Ab3d.Utilities.Dumper class
  • Fixed Camera.GetMousePositionOnPlane method when using OrthographicCamera and when camera's Offset is not zero (Offset is changed when camera is moved).
  • Added a new constructor to Ab3d.Utilities.Plane class that takes a position on a plane and plane's normal.
  • Added GetClosestPointOnPlane method to Ab3d.Utilities.Plane class
  • Added GetPerspectiveScreenSize, GetOrthographicScreenSize, GetPerspectiveWorldSize and GetOrthographicWorldSize to Ab3d.Utilities.CameraUtils
  • Added GetWorldSize and GetScreenSize to BaseCamera
  • Added static bool ImmediatelyLoadTextureFiles field to MaterialTypeConverter to control how the BitmapImages are created (can prevent locking the read file because file is in use). See comments for the field for more info.
  • Line3DFactory.CreatePolyLine3D method was renamed into Line3DFactory.CreateMultiPolyLine3D for those overrides that takes a List of Point3DCollection objects
  • Added protected OnMouseMove, OnMouseButtonUp, OnMouseButtonDown and OnMouseWheel to MouseCameraController. This make it possible to use MouseCameraController in WinForms application (with SharpDX.RenderForm).
  • Improved performance of calling AlignWithCamera on TextBlockVisual3D

Breaking changes:

  • Changed Ab3d.Utilities.Plane class to use a more standard a*x + b*y + c*z + d = 0 equation instead of a*x + b*y + c*z = d. If you are creating Plane object with a, b, c and d parameters, then you will need to flip the sign of the d parameter.


  • Added support to read bones and skeleton information.
  • Added support to play keyframe and skeletal animation (use Ab3d.Assimp.AssimpAnimationController that is defined in Assimp folder in main Ab3d.PowerToys samples project).
  • Set name of the created WPF materials from names defined in the file. The material's name can be read with material.GetName extension method (defined in Ab3d namespace).
  • Added GetAssimpMeshForGeometryModel3D, GetWpfMaterialForAssimpMaterial and GetAssimpMaterialForWpfMaterial to AssimpWpfConverter.

Tags: , , , ,

Ab3d.PowerToys | DXEngine