Ab3d.DXEngine

DirectX 11 rendering engine for Desktop .Net applications

Ab3d.DXEngine is a super fast 3D rendering engine that uses DirectX 11 and SharpDX and can be used in .Net Desktop applications.

The engine is written in managed C# and in HLSL (for DirectX shaders). DXEngine is very easy to use. You can use WPF 3D objects to define the 3D scene, cameras and lights.

What is more, you can use the Ab3d.PowerToys library and that gives you great tools and utilities for WPF 3D graphics and allows you to easily create CAD like or other business applications that require 3D graphics.

The rendered 3D scene can be fully composed with existing WPF objects that can be added on top of 3D scene of below the scene. The engine can be also used in WinForms applications.

Car engine model shown with DXEngine (DirectX 11 rendering engine for .Net and WPF)

 

Main Ab3d.DXEngine features:
  • DirectX 11 based rendering engine with full hardware rendering support.
  • The most versatile 3D engine - the same application can run on systems from high end graphics card (full hardware acceleration) to computers without graphics card (DirectX 11 software rendering). The same application can also run on an old computers with operating systems that do not support DirectX 11 (using WPF 3D rendering).
  • Fully managed code that works with AnyCpu (x86 or x64) build targets.
  • Super-fast and much more accurate per pixel lighting than in WPF 3D (WPF uses per-vertex rendering).
  • Highly customizable: use custom shaders, rendering techniques, mesh data, etc.
  • Render millions of hardware accelerated 3D lines (with custom thickness and color).
  • Render reflections with environment and reflection maps
  • Support for virtual reality with split-screen and anglyph rendering.
  • Many post processing effects.
  • Full Oculus Rift support is provided with Ab3d.OculusWrap library and DXEngine providers.
  • Use new engine with just a few changes of the existing WPF 3D code. The engine fully supports Ab3d.PowerToys and Abd3.Reader3ds libraries.

Ab3d.DXEngine is not another game engine (like Unity) that forces you to use its game editor, its architecture and requires many hacks and tricks to be used in a standard .Net application. The Ab3d.DXEngine is a new rendering engine that is built from ground up with the purpose to be used in standard Desktop .Net applications.

 

Samples screenshots:

 

Try for free now

 

Versions history

Version 2.0

Major new features:
  • Added variance shadow rendering that can render nice soft shadows for one SpotLight or one DirectionalLight.
  • Greatly improved working with frozen WPF objects. Before, DXEngine's objects created from frozen WPF objects (for example MeshGeometry3D or Material) were not reused when they were used by multiple Model3D objects. The new version caches the DXEngine's objects created from frozen WPF objects so they can be used by multiple DXEngine’s SceneNodes.
  • Changed references to SharpDX libraries to use later versions of the library. The .Net 4.5 build of DXEngine now uses the latest version of SharpDX - version 3.1 (before 2.6.3 version was used); the .Net 4.0 build of DXEngine now uses SharpDX version 2.6.3 that support feature level 11.1 (before 11.0 was the last version that was supported by SharpDX). The 2.6.3 is the latest version that is supported on .Net 4.0.
  • Added DXEngineSnoop diagnostics utility and full source code of Ab3d.DirectX.Client.Diagnostics project
  • Various performance and stability improvements.
Other new features and changes:
  • Improved performance when DXViewportView is resized.
  • Improved "Complete rendering step" performance for scenes with many SceneNodes - especially for scenes with many BoxVisual3D or similar objects from Ab3d.PowerToys library.
  • Added ReadZBuffer to DXAttributeType enum so you can call SetDXAttribute on any WPF 3D line Visual3D or WireframeVisual3D object. This allows rendering 3D lines with disabled Z-buffer reading (rendering 3D lines that are visible thorough other 3D objects).
  • Added ReadZBuffer property to WpfWireframeVisual3DNode
  • Improved performance of updating instance data for object instancing: Added new override of Update method that takes startIndex, count and updateBounds parameters to InstancedMeshGeometryVisual3D and InstancedModelGroupVisual3D - this can improve performance by updating data for only a few instances and can skip updating bounding box (use only when the instanced objects do not exceed the bounds of the whole scene)
  • Added UseDynamicInstanceBuffer property to InstancedMeshGeometryVisual3D, InstancedModelGroupVisual3D, InstancedMeshGeometry3DNode and InstancedModel3DGroupNode - this allows using dynamic instance buffer (instead of immutable) that gives better performance for cases when the instance data are changed very often (for example once per frame).
  • Added AfterUpdated event to DXScene - the event is triggered after the SceneNode objects have been updated and before the decision is made to render the next frame or not (subscriber can change the).
  • When using RenderToBitmap and the DXViewportView is not shown on the screen, it is not needed to manually call Update method before each RenderToBitmap call.
  • Prevented memory leak in RenderToBitmap and DXScene.CreateCustomRenderingContext methods.
  • Added DisposeWithDXDevice method to DXDevice - it adds the specified disposable object to the list of objects that will be disposed when this DXDevice will be disposed.
  • Added BeforeDeviceDisposed event to DXDevice - occurs just before the DirectX device will be disposed and after all other resources have been already disposed.
  • Added ClearWpfObjects and AutomaticallyClearWpfObjectsAfterInitialization to WpfOptimizedModel3DGroupNode - this allows freeing the memory with data taken by MeshGeometry3D objects (other references to WPF objects also needs to be removed)
  • Added ArrayStride to SimpleMesh to allow creating SimpleMesh from base types like float and byte (and not only from PositionNormalTexture and other structs).
  • Improved handling of exceptions that happen during resizing - in case of sharing DirectX 11 rendered scene with WPF's DirectX 9 and if the error happens with resizing the DirectX 9 texture, DXEngine falls back to copying DirectX 11 rendered scene to main memory and using WritableBitmap to show it in WPF.
  • Added ChildNodesChanged event to SceneNode
  • Because of a new DXDevice based caching, the following static methods now require a new parentDXDevice parameter: Ab3d.DirectX.DXWireframeHelper.SetLineMaterial, Ab3d.DirectX.DXWireframeHelper.ClearLineMaterial, Ab3d.DirectX.Materials.WpfMaterial.SetUsedDXMaterial
  • Added calling Loaded and Unloaded routed events on Viewport3D when it is used inside DXViewportView (because Viewport3D is not part of WPF logical tree, the Loaded and Unloaded events would never be raised; to make those two events work as in WPF 3D rendering, the DXViewportView raises it manually)
  • Added DXDiagnostics.ReportLiveDeviceObjectsOnDispose property to allow showing a report of live objects in Visual Studio Output window when the DXDevice is disposed.
  • Changed default value of preferedMultisampling paremeter for RenderToBitmap method to -1. This value means that the multisampling count from DXScene will be used.
  • Fixed using RenderToBitmap when AnaglyphVirtualRealityProvider was used and when preferedMultisampling parameter in RenderToBitmap was different than DXScene's MultisampleCount.
New features and changes for advanced users:
  • Added SceneNodeVisual3D that can show DXEngine's SceneNodes and can be added to WPF's Viewport3D Children. This allows creating SceneNodes without WPF Model3D or Visual3D objects.
  • Added a new overload of RegisterBackBufferMapping method in the RenderingContext class. The new overload takes only a delegate and does not require to create a staging buffer and to pass it as a parameter. This allows very easy capture of next rendered frame - the next rendered frame is passes as a mapped staging buffer to the specified delegate.
  • Added RenderingStepsGroup that can be used to group a few rendering steps together (by default the PreparePostProcessing and RenderPostProcessing rendering steps are grouped into a new RenderPostProcessingGroup rendering step)
  • Added static GetLastRenderingStep, GetFirstRenderingStep and IsRenderingStepConnected methods to RenderingStepBase.
  • Added ForEach to RenderingStepsList.
  • Added ImmediateContext to DXDevice to simplify accessing ImmediateContext (before it was possible to get it from Device but this could lead to an undisposed reference).
  • Added CustomRenderingQueue to DXAttributeType enum to easily set the CustomRenderingQueue to any WPF 3D object.
  • Added CustomRenderingQueue property to SceneNode.
  • Changed DXDevice.StandardBufferFormat and DXDevice.StandardDepthStencilFormat fields from const to static so that it is possible to change the default back buffer format (B8G8R8A8_UNorm - required by WPF) and default depth stencil format (D32_Float).
  • Added new override of DXScene.CreateCustomRenderingContext method that also takes custom format and can be used to create rendering context with some other back buffer format.
  • Added a new CustomRenderingContext class that is derived from RenderingContext and also allows changing some additional context data line FinalBackBuffer and FrameNumber.
  • Added CreateCustomRenderingContext method to DXScene that takes existing back buffer, its render target view and depthStencilView to create RenderingContext that can be later used in RenderScene method.
  • Added new overload of CreateCustomRenderingContext that also takes virtualRealityProvider as parameter.
  • All overloads of the CreateCustomRenderingContext method in DXScene now return CustomRenderingContext class instead of its base class (RenderingContext).
  • Changed constructor of RenderingContext to take SwapChain as parameter - SwapChain can now be set only from constructor because the protected SetFinalBackBufferAndSwapChain method was replaced by a SetFinalBackBuffer method.
  • Added UnregisterAllBackBufferMappings to RenderingContext to unregister all registered delegates (this simplifies the unregister process; before the only way to unregister was to use UnregisterBackBufferMapping that required the delegate as parameter and this prevented defining delegate as an anonymous methods)
  • Removed MaterialEffect property from WpfGeometryModel3DNode - if you were using it, then create a new material and override the Effect on it instead.
  • Changed SceneNode class with converting the following pubic methods from virtual to non-virtual: AddChild, InsertChild, RemoveChild, RemoveChildAt, ReplaceChild, ClearChildNodes (to prevent virtual call in constructor; to get notified about the change of ChildNodes you can now use the new ChildNodesChanged event instead of overriding the Add or other methods)
  • TextureCache.GetTextureFromFile method does not load texture file any more in case the file was not loaded and cached before (reason: ShaderResourceView.FromFile is deprecated for Windows 8 and not used in SharpDX v3+ any more - https://msdn.microsoft.com/en-us/library/windows/desktop/ff476283(v=vs.85).aspx)
  • Removed DXCubeMap constructor that takes ddsFileName as parameter. If you were using dds file for cube map, create the ShaderResourceView from dds by yourself and set the created ShaderResourceView in the call to SetDXAttribute with DXAttributeType.Material_EnvironmentMap (reason: ShaderResourceView.FromFile is deprecated for Windows 8 and not used in SharpDX v3+ any more)
  • Moved IsD3DPerformanceEventGroupingEnabled property from DXScene to DXDiagnostics.
  • Added overload of Add method on Bounds class that also takes Vector3 object and adds the specified position to the current bounds.
  • Added CalculateBounds to SimpleMesh and automatic bounds calculations when the vertext buffer is created from PositionNormalTexture or PositionNormal structs.
  • Improved classes derived from MeshBase (GeometryMesh, DXMeshGeometry3D, DXMultiMeshGeometry3D, ScreenSpaceLineMesh and SimpleMesh) to correctly set their Bounds and to have similar public method to recreate mesh.
Fixes:
  • Prevented camera problems when one DXDevice was used for multiple DXScenes.
  • Fixed showing WireframeVisual3D when its Transform is set.
  • Added support for semi-transparent SolidModelColor in WireframeVisual3D.
  • Fixed rendering 3D lines in RenderToBitmap method when the parent DXViewportView is not shown.
  • Fixed setting Viewport3D property on DXViewportView to null.
  • Fixed problems with not showing the content of DXSceneView that could occur sometimes when DirectXImage presentation type was used and the DXSceneView was recreated (previously the content was updated after resize of DXViewportView)
  • Fixed not showing 3D image that occur sometimes for computers with multiple graphics cards (usually laptops with dedicated graphics card) when DirectXOverlay PresentationType was used on Windows 10.
  • Fixed not updating 3D image when DXView was loaded without a valid size (for example after a breakpoint in VS)
  • Improved caching Textures and prevented using a lot of memory for textures cache that could occur because of too little cache cleanups.
  • Fixed rendering textures with ImageBrush Opacity set to values lower than 1 for scenes with 3 or less directional lights.
  • Fixed setting DXViewportView.UseViewport3DCamera property in code.
  • Fixed calculating camera positon from MatrixCamera. Also added SetCameraPosition method to prevent calling invert on view matrix when GetCameraPosition is called.
New samples:
  • Added showing diagnostics window from main DXEngine samples project
  • Added Shadow rendering sample
  • Added BackgroundRenderingSample
  • Added ReadZBuffer sample
  • Added "Multiple scene views" sample - how to use the same DXDevice to share resources with multiple DXViewportViews
  • Added sample on how to manually create SceneNodes
  • Added sample on how to use custom fog shader that is created with Shader factory sample project.
  • Improved PolyLines sample and Performance test
  • Added sample of global exception handler that gets detailed system information when DXEngine or SharpDX exception happens
  • Added WinForms sample project that shows 3 different ways on how to use DXEngine in WinForms application.

Version 1.4

  • Support for virtual reality with split-screen and anglyph rendering.
  • Added UltraQualityHardwareRendering to GraphicsProfile that uses supersampling instead of multisampling.
  • Added support for RemoteDesktop for DirectXImage PresentationType - this works only in .Net 45 build of Ab3d.DXEngine and for .Net 4.5 or later target framework.
  • Simplified setting line depth bias with SetDXAttribute(DXAttributeType.LineDepthBias, depthBias) method - this can prevent z-fighting when rendering 3D lines on top of solid objects.
  • Added Ab3d.DirectX.DXDiagnostics.CaptureNextFrame and IsCaptureFrameSupported methods to programmatically captures the next rendered frame with Visual Studio Graphics Debugging (this also allows capturing frames for DirectXImage PresentationType).
  • Added support for Visibility property on objects derived from UIElement3D .
  • Added IsMaterialSortingEnabled property to DXScene to control if sorting objects by their materials is enabled. Enabling sorting improves performance because objects with the same materials are rendered one after another (this reduces the required DirectX state changes), but when you want to have determined order of rendering you can disable the sorting.
  • Improved automatically updating WireframeVisual3D when LineThickenss or LineColor is changed.
  • Improved hardware rendering of 3D lines - depth problems could occur when long lines are crossing the near plane (one end of the line is behind the line).
  • Added Clone method to GraphicsProfile to simplify creating your custom graphic profiles that are based on default graphics profiles.
  • Added ExecutePixelShaderPerSample to DXScene and to GraphicsProfile - this allows turning multisampling into supersampling for better shader quality (used by new UltraQualityHardwareRendering).
  • Prevented throwing exception when ImageBrush uses a texture with relative Uri.
  • Fixed using EmissiveMaterial properties on materials that do not have DiffuseMaterial (under some circumstances).
  • Fixed using Opacity or alpha value for EmissiveMaterial.
  • Changed some properties and methods in RenderingContext class and in some RenderingSteps - if you are an advanced DXEngine user and use custom rendering steps, you can contact us to get a full list of changes.

Version 1.3

  • Greatly improved performance of WireframeVisual3D when the 3D objects showing with WireframeVisual3D are animated with changing transformations.
  • Prevented black edges that sometimes appeared when showing textures.
  • Fixed rendering transparent objects that were not visible sometimes because of incorrect object order.
  • Fixed rendering specular highlight for directional light shader.
  • Fixed getting camera's view and projection matrices for left handed coordinate system (when IsRightHandedCoordinateSystem is false).

Version 1.2

  • Added support for rendering reflections with using EnvironmentalMaps.
  • Added support for ReflectionMaps.
  • Added support for rendering more than 16 lights (+ ambient light) with using multi-pass rendering.
  • Added support for Transform on InstancedMeshGeometryVisual3D.
  • Added InstancedModelGroupVisual3D that can render many instances of all 3D models defined in the Model3DGroup.
  • Added GetHitInstanceIndex method to InstanceData to get an index of hit instance.
  • Fixed showing transparent objects in some cases.
  • Added TextureBlendState to IDiffuseTextureMaterial interface.
  • Fixed rendering textures from files that use different DPI settings.
  • Added extension methods that simplify adding additional DXEngine attributes to the existing WPF's objects (SetDXAttribute, GetDXAttributeCollection, GetDXAttribute, IsDXAttributeSet, ClearDXAttribute, GetDXAttributeOrDefault). This is currently used to specify the EnvironmentalMap and ReflectionMap.
  • Prevented memory leak when 3D model that was shown inside WireframeVisual3D was changed (further performance improvements in this case will follow).
  • Prevented rendering strange 3D lines that sometimes occur when the 3D lines were completely behind the camera.
  • Fixed rendering transparent 3D lines.
  • Fixed rendering transparent objects with emissive materials.
  • Some other smaller bug fixes and improvements.
  • BREAKING CHANGE: Renamed InstancedGeometryVisual3D into InstancedMeshGeometryVisual3D - the reason is that this Visual3D uses only one MeshGeometry3D to render. This is more exact description of what the Visual3D does - the Geometry is too broad term.

Version 1.1

  • Fixed using Binding on objects inside DXViewportView.
  • Fixed rendering 3D lines with hardware accelerating geometry shader (instead of Ab3d.PowerToys's LinesUpdater).
  • Improved support for transformations on TileBrush (used on ImageBrush, VisualBrush and DrawingBrush).
  • Added IsWpfHitTestVisible to InstancedGeometryVisual3D - this allows WPF hit testing of instanced geometry (though this increased initialization time because WPF's GeometryModel3D objects needs to be created).
  • Improved InstancedGeometryVisual3D so that it is not needed any more to call Update method when the InstancesData is set for the first time. Also fixed problems when the objects were not shown if Update was called before the InstancedGeometryVisual3D was added to Visual tree.
  • Improved performance with moving some matrix calculations to vertex shader.
  • Added support for rendering WPF's UIElement3D objects. NOTE: WpfUIElement3DNode can only show 3D models but does not support the input events on the UIElement3D (MouseEnter, MouseMove, etc.). Those events cannot be supported because Viewport3D control is not visible and does not provide the events to the UIElement3D.
  • Greatly improved Update method call performance when many Visual3D objects from Ab3d.PowerToys are used (for example BoxVisual3D objects).
  • Added IsCheckingChildrenForChanges field to WpfModelVisual3DNode that can be used to skip checking ModelVisual3D's Childen collection and improve Update performance.
  • Added IsCheckingChildrenForChangesDefaultValue static field to WpfModelVisual3DNode - used to set the default value of the IsCheckingChildrenForChanges field.
  • Fixed problems where wrong image was shown when multiple DrawingImage brushes or VisualBrshes were used.
  • Prevented throwing exception when unsupported type of Visual3D (for example UIElement3D) or Model3D was used in the scene.
  • Added Refresh method to Ab3d.DirectX.Material and its derived classes. This allows user to manually update the materials properties and its resources (textures are regenerated).
  • Fixed hit testing on some Viewport3D objects (usually when the Viewport3D was removed from visual tree and then added to DXViewportView).
  • Fixed using IsAutomaticallyUpdatingDXScene when the DXScene was created after the IsAutomaticallyUpdatingDXScene property was set.