New bug fix Ab3d.DXEngine published

by abenedik 12. July 2024 17:56

I would like to inform you that a new version of Ab3d.DXEngine has been published.

This is only a bug fix release that fixes the problems that were found after the last release. What is more, a new Ab3d.DXEngine.glTF library was also published (see below).

Here is a list of fixes:

  • Fixed changing IsVisible property on InstancedTextNode.
  • Improved hit-testing by preventing the creation of new objects on each hit test.
  • Prevented exception when the IsVisible of DXViewportView is set to true (from false) but the size of DXViewportView is empty (0, 0).
  • Corrected calculating Bounds (BoundingBox) for ScreenSpaceLineNode and ScreenSpaceLineMesh when IsPolyLine is true. Before the bounds were too big because the 2 generated adjacency positions that were required by the shader were also counted into the BoundingBox.
  • Updated Bounds in ScreenSpaceLineMesh when calling RecreateMesh.
  • Added new overload to RecreateMesh method in ScreenSpaceLineMesh. The new overload also takes BoundingBox as a parameter. It can be used when BoundingBox is already known - this prevents calculating new BoundingBox from new positions.
  • Fixed regenerating screen-space positions in some cases when the count of line positions is changed.

As promised in previous blog posts, a new fully managed glTF importer for Ab3d.DXEngine was published. If you are showing 3D models in your application, then you will now be able to use the new glTFImporter instead of Assimp importer. This will remove the dependency on the native Assimp library. If you are currently using some other file format (for example, .fbx or .dae), then you may consider converting that to a glTF file. There are many offline and online glTF converters that can be used for that task.

First, note that the new importer can read only the second version of glTF files (version 2). This new version is also used by most of the 3D modeling tools. glTF files come with two possible file extensions: .gltf and .glb. The  .gltf file extension represents a text json file with basic information of the 3D objects. Usually .gltf file also comes with a .bin file that stores the vertex and index buffers and embedded textures. It is also possible to embed the buffers and textures as base64 encoded text into the .gltf file. The other possible file extension (.glb) represents a binary version of the file. It has a smaller size and is the fastest to read. It also contains all the buffers and textures.

glTF 2 files store materials by using PhysicallyBased properties that use base color, metalness and roughness as base material properties. Ab3d.DXEngine also supports showing PhysicallyBasedMaterials. But for technical and business 3D objects the material usually use diffuse and specular colors (StandardMaterial in Ab3d.DXEngine or DiffuseMaterial in WPF 3D). Because of this, the importer in the Ab3d.DXEngine.glTF library has two special properties that can be used to define when the StandardMaterial with diffuse color is created from the PhysicallyBased properties:

ConvertSimplePhysicallyBasedMaterialsToStandardMaterials - when this property is true (by default) then  simple glTF's PhysicallyBasedMaterials that have MetallicFactor set to 0 and do not have MetallicRoughness texture are converted into StandardMaterial objects.

ConvertAllPhysicallyBasedMaterialsToStandardMaterials - when this property is true (false by default) then all glTF's PhysicallyBasedMaterials are converted into StandardMaterial objects.

And here are a few screenshots from the sample models that can be downloaded from glTF sample assets (https://github.com/KhronosGroup/glTF-Sample-Assets):

ABeautifulGame 3D model importer by DXEngine's glTF importer

FlightHelmet 3D model importer by DXEngine's glTF importer

In the future, I plan to remove some of the library's dependencies by embedding the glTF objects model into the library. I will also add an exporter that will be able to export an existing 3D scene to glTF file.

Tags: , , ,

DXEngine

Major new vesion of Ab4d.SharpEngine published

by abenedik 5. July 2024 12:48

I am really excited that I can present you a new Ab4d.ShareEngine version 2.0!

The version 1.0 was already very capable and could show 3D graphics on platforms from tiny Rasberry PI to mobile devices and high end PCs. But if you know the Ab3d.PowerToys and Ab3d.DXEngine libraries then you missed some of the features. Now, with version 2.0, many of those highly requested features are available.

Here is a list of some of the major new features:

  • Added support for rendering pixels and point-clouds. There is also a sample that can import point-cloud data from .ply and .xyz files.
  • Added ModelMover, ModelScalar and ModelRotator that can be used to move, scale and rotate selected 3D objects.
  • Added InputEventsManager that can be used on SceneNodes to subscribe to Clicked, Entered, Exited, Dragged and other mouse and pointer events.
  • Added MultiMaterialModelNode that can render a single mesh with multiple materials.
  • Added support for slicing SceneNodes with a 3D plane.
  • Significantly improved performance of generating edge lines and selecting 3D lines.
  • Added support for triangulation and extrusion of shapes with holes.
  • Added new sample that shows how to create a custom effect by using your own shaders.
  • Added full support for Windows Forms with new Ab4d.SharpEngine.WinForms library that provides SharpEngineSceneView control for Windows Forms.
  • Added fully managed glTF file importer and exporter that can be used on all platforms and does not require any native library (that is required by Assimp importer).
  • Added support for using Vulkan backend in Avalonia. This way the whole application (UI controls and 3D scene) is rendered by Vulkan. This requires Avalonia v11.1.0 (currently in pre-release version).

If you are following the development of Ab4d.SharpEngine, then you may be surprised by the new version number. I always said that the next version would be version 1.1, but now version 2.0 has been released. The reason for that is that there are also some breaking changes. In the previous version many classes, enum values and parameter names used the "mouse" word. But with the new cross-platform environment the "mouse" is no longer the correct word and has been replaced by "pointer" by many frameworks (Avalonia, WinUI). This has also been done in SharpEngine, for example: MouseCameraController => PointerCameraController, MouseButtons => PointerButtons, MouseAndKeyboardConditions => PointerAndKeyboardConditions, etc. In most cases the old class or enum values still exist but were marked as obsolete with a message about how to change its name. I know that such changes are not nice for users, but they must be done to modernize the API.

Here are some of the screenshots of the new version:

Point-cloud importer that can import data from .ply and .xyz files

ModelMover, ModelScalar and ModelRotator

Sliced 3D model

Triangulated and extruded 2D shape with holes

glTF importer

WinForms samples with 3D graphics by Ab4d.SharpEngine

 

Images are nice, but it's even better to see the new features in action. To do that, get the latest version of the samples from GitHub

Note that the Samples project is not updated only on each release but new samples may be added between releases. So, it is best to subscribe to changes or check the commit history of the Samples from time to time.

Most of the new features should be easy to understand and use. So let me describe in more detail only two of them.

3D models are usually created by a 3D modeling application and then saved in many possible file formats. When we wanted to show such 3D model in our application, the Ab4d.SharpEngine library provided two options. The first was to save the file in the .obj file format and the import it by using ReaderObj that is part of the core Ab4d.SharpEngine library. The problem was that obj file is missing many features (for example, object hierarchy and transformations) and is only text based, so files can be large and take longer to read. The other option was to save the 3D model to some of the common file formats like .fbx, .gltf, .dae, etc and then use Assimp importer to import the models. This works well for many file formats, but this requires the use of a third-party native Assimp importer. When you are developing a cross-platform application, this is a problem. The samples come with native builds for Windows and Linux. It is also possible to compile the Assimp library for macOS, Android an iOS, but this requires some special skills and you need to distribute all the native libraries with your application. A much better way would be to have a fully managed importer where only one dll can be used on all platforms.

Because of this, a new Ab4d.SharpEngine.glTF library was developed. It provides a fully managed cross-platform glTF 2 file importer and exporter. The glTF 2 file format is a modern file format developed by the Khronos group and can store meshes, hierarchies, materials, transformations and animations in a text or binary format. Many online and offline converters can convert to glTF from many other file formats. The new library can also export the SharpEngine's SceneNodes to glTF file (not all SceneNode types are supported yet). Please note that glTF 2 file saves materials as Physically-Based-Rendering (PBR) materials. This requires some transformations of the StandardMaterials to PBR materials and back. In the next version of Ab4d.SharpEngine I plan to add support for rendering PBR materials.

Another new feature that I would like to talk about is the support for creating fully Vulkan based applications by using the new version of Avalonia (v11.1.0-rc2 at the time of writing). Vulkan API is a cross-platform API that is used to communicate with the graphics card. It is used by the Ab4d.SharpEngine to render the 3D scene. But until now, there were no UI framework that would use Vulkan. Some of the frameworks use only DirectX (WPF, WinUI) or a combination of DirectX and OpenGL based on the current platforms (Avalonia, MAUI). In many cases this requires copying rendered 3D scene to some other format before it can be shared by the UI (but the rended texture can still stay in the GPU memory). In some cases, sharing is not possible and this requires copying the rendered image to the main CPU memory, creating a bitmap (WritableBitmap) and sending that back to the GPU by the UI platform. But with the new Avalonia, we can finally create an application that is 100% rendered by Vulkan. This provides very fast UI rendering and great integration with Ab4d.SharpEngine. Currently, this is possible only on Windows but in the future other platforms will be supported as well. You can test that by starting the new Ab4d.SharpEngine.Samples.AvaloniaUI.VulkanBackend solution.

Note that currently there are two versions of Ab4d.SharpEngine.AvaloniaUI libraries available. One has version 2.0.8951. This one is using the Avalonia version 11.0.11 (the last official version). Then there is another Ab4d.SharpEngine.AvaloniaUI library that has version 2.0.8953-rc1 (pre-release). It requires Avalonia version 11.1.0-rc2 (also pre-release). Those two pre-release versions are required to use Vulkan as a backend. When an official Avalonia version 11.1.0 is released, I will also provide a new version of Ab4d.SharpEngine.AvaloniaUI that will not be marked as pre-release.

To see the list of all changed in v2.0 check out the SharpEngine history web page.

Let's finish with a quick view into the future. 

Next week, I plan to publish a new bug fix release for Ab3d.DXEngine. In the past few months some bugs were fixed and it is now time to release that. I will also be adding new samples for Ab4d.SharpEngine and updating some of the existing samples. Before the end of the year I expect to release another new version of Ab4d.SharpEngine, Ab3d.PowerToys and Ab3d.DXEngine.

The plans for Ab4d.SharpEngine include work on the core of the engine with support for background resource creation (top priority) and multi-threaded rendering (hopefully). There will also be support for post-processing and improved pixel rendering options. I would also like to add support for Uno platform, PhysicallyBasedRendering effect and rendering 3D lines with arrows.

For both Ab4d.SharpEngine and Ab3d.DXEngine I would also like to provide support for importing STEP and IGES file formats that are commonly used by CAD applications.

There are lots of plans. But I am sure that many of you have some additional ideas and requirements. In this case please contact us.

And finally, I wish you a nice and relaxed summer and shiny 3D graphics in your applications.

Tags:

SharpEngine

Great new features in new Ab3d.PowerToys and Ab3d.DXEngine

by abenedik 12. April 2024 11:22

Even though a new Ab4d.SharpEngine, a cross-platform rendering engine, was released a few months ago, work on the Ab3d.PowerToys and Ab3d.DXEngine has not stopped. The proof of that is the just published version that brings many great new features and improvements. Here is a list of the most important:

  • Added many new options to render pixels and point-clouds.
  • Added hardware support to render millions of textures as billboards.
  • Added support for Screen Space Ambient Occlusion (SSAO).
  • Significantly improved performance of line selection and generating edge lines.
  • Added sample that shows how to render objects with glow.

The previous version of Ab3d.DXEngine already provided great support for rendering pixels and point-clouds. It was possible to render millions of pixels with various sizes and colors. There was an OptimizedPointMesh class that could optimize the rendering of large point-clouds. On top of that, the new version adds the following new options:

  • The pixel size can be defined in screen or world size. Before, pixel size was defined only in screen size, but now you can also define the size in 3D world size so when using perspective camera the pixels that are farther away from the camera are smaller.
  • Pixels can be rendered as rectangles or as circles. Before, only rectangular pixels were possible. Now circular pixels can be rendered and this looks nicer for some point-clouds.
  • It is possible to specify a texture that will be rendered on each pixel. This can be used to render millions of billboards that are always facing the camera.
  • It is possible to fix the up vector of each pixel so the pixels do not fully face the camera. For example, this can be useful when rendering trees that are always growing vertically and should not face the camera when the camera is looking straight down.
  • The Ab3d.DXEngine samples project comes with new PlyPointCloudReader and PlyPointCloudWriter classes (available with full source code). They can be used to read and write point-clouds from and to ply files.

Here are a few screenshots:

Importing point-cloud with more than 12 million pixels from a ply file.

(Point-cloud with 12 million points)

Cropping point-cloud and exportin it to a ply file.

(New point-cloud importer sample supports exporting a cropped point-cloud)

Rendering may 3D textures as billboards (the screenshot shows 15.000 tree textures, but modern GPU can also easily handle many more textures).

(Rendering may 3D textures as billboards. The screenshot shows 15.000 tree textures, but modern GPU can also easily handle much more textures).

 

Another big new feature is support for Screen Space Ambient Occlusion (SSAO). If you look around you, you can see all the places around the room. All receive at least some light even if the lights or windows do not directly illuminate them. This light is called an ambient light. To correctly render that light, we need to use ray tracing. But in real-time computer graphics, we can usually specify an ambient light with just one value. This will illuminate all the objects in the scene with the same amount of light. But if you look around you, you will notice that, especially at the corners, the amount of ambient light is much lower, and a shadow is visible. Those shadows can be approximated by using the Screen Space Ambient Occlusion. This reduces the amount of the applied ambient light in places that have some objects around them.

See the difference in the following two screenshots (one with and one without SSAO):

Screen Space Ambient Occlusion (SSAO) that can dynamically shadow ambient light
SSAO disabled

Note that to see SSAO shadows, you need to use a lot of ambient light and should not use camera's lights (set camera.ShowCameraLight to ShowCameraLightType.Never). If you are using camera's light, it can illuminate the areas dimmed by the SSAO effect. So, using fixed directional or point lights and strong ambient light is recommended to see SSAO shadows.

 

The next major change in the new version is not a new feature but a significant improvement of the existing functionality that many of you are using. The new version of Ab3d.PowerToys greatly improves the performance of line selection and generating edge lines.

Showing edge lines can significantly improve the clarity of the shown 3D model. But with the previous version, if you had complex 3D models, calculating edge lines was very slow. The new version significantly speeds up this process. For example, the next graph shows the time in ms that was needed to generate edge lines for a complex P51 oil rig model (3.7 mio triangles; 1000 individual models, some have more than 100,000 positions; CPU: AMD Ryzen 9 5900X):

Graph that shows performance improvement of new edge lines generation

The previous version required 13 seconds in .Net Framework 4.8 (11 seconds in .Net 8). In the new version, this is almost 50 times faster: 350 ms in .Net Framework 4.8 (280 ms in .Net 8).

So, when using the previous version the user needed to wait for quite a while until the edge lines were generated, but now this is hardly noticeable.

What is more, if you know that your mesh is nicely defined or does not have duplicate positions, you can speed up this process even further. Duplicate positions are very common because they are required to create sharp edges by defining different normals for each position (for example, BoxVisual3D defined 24 positions and not only 6). But if you know that you have a smooth mesh without duplicate positions, you can set the ProcessDuplicatePositions property to false to skip the step of finding and collapsing duplicate positions. Also, if you know that the mesh has nicely defined triangles where each triangle edge is fully covered by any adjacent triangle edge (except on the outer mesh borders), then you can set the ProcessPartiallyCoveredEdges property to false. This skips code to process complex meshes (for example, such complex meshes can be produced by Boolean operations). If users of your application can import any 3D model, then you should have all the settings enabled, but if you have fixed 3D models, then you can experiment by turning off some settings and get even better performance. What is more, the updated "Edge lines creation" sample in Ab3d.PowerToys samples has code that shows how to easily write and read the calculated edge lines to and from a file.

 

Another very commonly used feature was line selection. The line selection in Ab3d.PowerToys allows selecting lines when the mouse is close to the line (the user can specify the max selection distance). When you were showing a lot of lines or lines have lots of line segments, then the line selection could eat a lot of CPU cycles. Before, 2D screen coordinates were calculated for all line segments. Then the 2D distance from the mouse to each line segment was calculated. The line with the closest distance was the result of the line selection. The new version significantly improves the performance of line selection for lines that have more than 30 segments. In this case, only 2D screen bounding box of the line is calculated and if the mouse position is in the bounding box or close to it, then the 2D screen positions for all line segments are calculated. This can skip a lot of calculations because only lines that are close to the mouse are fully processed. Note that to use the new faster code path, you need to set the new CheckBoundingBox property to true. This is needed to preserve the behavior of the GetClosestDistance method. Before, this method always returned a valid distance value, but now, when CheckBoundingBox is true and when the mouse position is not close to the bounding box, then double.MaxValue is returned.

What is more, if you are using ScreenSpaceLineNodes instead of lines derived from Visual3D objects (this significantly improves the initialization time but is harder to work with), then you can use the new DXLineSelectorData that is the same as LineSelectorData but works with Vector3 structs instead of Point3D structs. This will give you even better performance because of reduced memory usage (using float values instead of double values).

The following screenshot shows a new sample that shows 5000 lines each with 5000 line segments and still achieving super-fast line selection time:

Super fast line selection where lines can be selected by specifying the distance to the lines (moving mouse close to the line).

 

The next new feature did not need any change in the Ab3d.DXEngine library but it just needed a special rendering setup. It is implemented in a new "Glowing objects" sample that can be found in the Advanced section of the Ab3d.DXEngine sample project. As its name suggests, it shows how to render glowing effect to objects with an emissive material. I know that this is not an essential feature, but I am sure that some of you will be able to use it to achieve some very nice visual effects.

Rendering glowing objects.

 

As always, there were many other new features, fixes and improvements. You can check them by starting the updated sample projects (Ab3d.PowerToys or Ab3d.DXEngine) and checking for samples with NEW or UP icons. You can get the list of all changed in Ab3d.PowerToys change log and Ab3d.DXEngine change log

 

When speaking about fixes, I would like to mention one nasty bug that occurred when many 3D lines were rendered (using multi-threader rendering), and after the size of the window was changed, then in some cases the lines could be rendered with invalid line thickness. If this also happens in your application, then please upgrade to the latest version. If this is not possible, then disable multi-threader rendering for 3D line or the whole scene (contact support for more info).

 

Lastly, I would like to mention that the new version comes with a new native Assimp importer that can import 3D models from many 3D file formats. The previous official version of Assimp importer v5.3.1 was released more than half a year ago (2023-09-25). The new version was released just a few days ago (2024-04-07) and comes with many improvements (https://github.com/assimp/assimp/releases). You can build the new version by yourself or get prebuilt dlls from the libs folder in the Ab3d.PowerToys or Ab3d.DXEngine samples.

 

Here, I would also like to announce that in the coming weeks, I will be releasing a fully managed glTF importer and exporter. This will allow you to import 3D models with full details without using a native Assimp library. Currently, if you do not want to use Assimp importer, you could use ReaderObj (part of Ab3d.PowerToys library) to read obj files or use Ab3d.Reader3ds library to read 3ds files. However, both obj and 3ds file formats have their limitations. Obj files do not support hierarchy and animations, are text only, and have limited materials. 3ds files support only 8.3 file names for textures. So, those two file formats could be used only in a limited number of cases.

On the other hand, the glTF 2 file format is a modern file format that was developed by Khronos group and can store meshes, hierarchies, materials, transformations and animations in a text or binary format. Suppose you distribute 3D models with your application and are currently using Assimp importer to load the models from various files. In that case, you will be able to convert the files into glTF (using Assimp importer and exporter or by using some other third-party or online glTF converter) and then distribute your models as glTF files. This way, you will not need to distribute native Assimp's dlls with your application anymore.

 

As seen here, the new version can significantly improve the performance of your application and the new features can make it even more visually appealing.

Now, the primary development focus will switch back to the new Ab4d.SharpEngine. I am really happy with the adaptation of the new engine. It seems that the first version already had enough features for many of your projects. Some new features have already been developed, but many are still to be implemented. I am planning to publish a new version in June 2024. So, if you have any feedback or a new feature request for the new version, now is the best time to provide that.

Tags: , , ,

Ab3d.PowerToys | DXEngine

New Ab3d.PowerToys and Ab3d.DXEngine version published

by abenedik 14. December 2023 16:06

New maintenance release for Ab3d.PowerToys and Ab3d.DXEngine has been published.

The new version does not come with any bigger new features and only brings a few fixes and improvements. Because of this, only the build version was increased, but the major and minor versions remained the same.

This version also comes with a new build for .Net 8.0. .Net 8.0 that was released a few days ago. At that point, I would like to thank the .Net team, which is doing a great job with each new .Net release. For example, the last version again came with many new performance improvements - see the article about that: Performance Improvements in .NET 8. This means that without any changes in the code, your code will run faster just by using the latest version of .Net.

I did a quick performance test by running the DXEngine multi-threading sample in .Net framework 4.8 and then in .Net 8.0. I used only single-threaded rendering with disabled commands caching and by showing 160.000 3D boxes and 3D lines. This means that for each frame the engine needed to set shader states and issue 160.000 draw calls. The results were astonishing. When running in .Net framework 4.8, the code required around 47 ms to render one frame. But when using .Net 8.0, only around 33 ms was needed for the same job. This is a 30% performance improvement. 

Ab3d.DXEngine performance in .Net 8.0

The new version also comes with an updated Assimp importer. There is a new native Assimp library (v5.3.1) and a new managed Ab3d.PowerToys.Assimp library. Using a newer native library provides a more accurate importer and can read more files correctly. On top of that the Ab3d.PowerToys.Assimp was also improved. This version adds support for reading files with non-ASCII file names. Also, now it is possible to read diffuse textures with emissive materials. And in case you were using hardcoded object names, then I need to inform you that the new version also comes with a breaking change because the new version may set the object names differently. The latest version tries to use names so that they are as close to the original name as possible. In case when an object group also defines its own meshes, the previous version set the name of the Model3DGroup by adding the "__Group" suffix. The new version set the Model3DGroup's name to the original name without any suffix. To prevent using duplicate names, it adds a mesh name as a suffix to the GeometryModel3D's name that is added as a child of the Model3DGroup. If you want to preserve the previous naming, then set the PreserveGroupNames property to false. Note, then in WPF, an object's name must start with a letter or underscore and can contain only letters, digits, or underscores. Because of this, the object names may still be different from the original names in the file. For example, "12-material#10" would become "_12_material_10".

The updated Assimp importer files can found in the libs folder on GitHub.

To see the list of other fixes and changes, see the change log web pages: Ab3d.PowerToys history and Ab3d.DXEngine history.

As mentioned last week, when the new SharpEngine was released, I am planning to release a new major version of Ab3d.PowerToys and Ab3d.DXEngine at the end of Q1 2024 . The following are planned new features:

  • Add support for Screen Space Ambient Occlusion (SSAO) - this can significantly improve the visual quality.
  • Add new options to render pixels and point clouds (world-size pixels in addition to screen-size; render circular pixels or pixels with custom textures).
  • Add support for rendering 3D lines and line segments to an object ID bitmap (can be used for faster line hit testing; especially for MultiLineVisual3D).
  • Add options to copy only part of the object ID bitmap from GPU memory to CPU memory - this would make using ID bitmaps for hit objects much faster.
  • Trying to improve the performance of calculating edge lines by using oct-tree.

For 2024, I would also like to introduce a new product that would allow importing 3D models from STEP and IGES file formats that are commonly used by CAD applications. Later, there would also be improved support for geometric and surface modeling that is based on mathematical surfaces and not triangles.

If you have any additional requests or wishes, please contact us. Otherwise, stay tuned.

Tags: , , , ,

Ab3d.PowerToys

Ab4d.SharpEngine v1.0 published

by abenedik 8. December 2023 11:30

Ab4d.SharpEngine logo

Ab4d.SharpEngine v1.0 has been published!

The new cross-platform 3D rendering engine is ready for apps that work on Windows, Linux, macOS, Android and iOS. The engine uses Vulkan, which is a next generation graphics API that provides high-efficiency, cross-platform access to modern GPUs. The engine is also built by using the latest .Net technologies like Numerics and harware intrinsics. The combination of Vulkan and highly optimized .Net code provides super fast rendering. Based on long-time experience with Ab3d.PowerToys and Ab3d.DXEngine I have designed the API for the new engine to be very easy to use. Especially users of the Ab3d.PowerToys and Ab3d.DXEngine libraries should feel right at home.

The new engine can work on almost all devices that support .Net runtime. It can run on high end PCs and tiny Rasberry PI computers (with full hardware accelerated graphics). By using a software rendering LLVM pipe, the engine can also run on systems without a graphics card (for example, a web server, virtual machine or tiny embedded device). This provides many new very interesting options, for example, showing 3D graphics on a display that controls a CNC machine and runs on a Rasberry PI or some other embedded device. See here and here for more info.

The Ab4d.SharpEngine can be integrated into almost any UI framework. The following UI frameworks are currently supported: WPF, WinUI 3, Avalonia, MAUI, SDL / Glfw, LinuxFramebuffer. Better support for WinForms is coming soon. In all other UI framework it is also possible to render to an offscreen texture and than show that as a bitmap. Another proof that the engine is meant for any 3D developer is also that the engine supports any 3D coordinate system (y-up or z-up; left or right-handed; see the second screenshot below). What is more, the engine's main assembly, Ab4d.SharpEnine, does not have any third-party dependencies. To be able to provide great cross-platform capabilities, the engine even have a build-in png reader and writer, so you do not need to use platform specific bitmap libraries.

The first version of Ab4d.SharpEngine still lacks some of the features from Ab3d.PowerToys and Ab3d.DXEngine. But it should already have all the tools to create great apps with 3D graphics. Here are some of the screenshots:

3D model from fbx file with shown edge lines
Custom 3D coordinate system with Ab3d.SharpEngine
Ab4d.SharpEngine in an Avalonia UI application on macOS (Input events sample)
Ab4d.SharpEngine in an Avalonia application on Ubuntu Linux (3D lines sample)
Ab4d.SharpEngine in a generic SDL / Glfw application on Rasberry PI 4

The easiest way to start exploring the new engine is by checking the samples project that is hosted on GitHub: https://github.com/ab4d/Ab4d.SharpEngine.Samples. Note that some of the existing samples will be improved in the following days and many new samples are planned to be added.

The Ab4d.SharpEngine is distributed only by NuGet packages and cannot be installed by using a commercial version installer (as it was possible with other products). To use the engine it needs to be activated by calling the SetLicense method. The samples come with a special license that can be used only by the samples. To use the engine in your applications, you will need to get a trial license from ab4d.com/trial (no email is required) or purchase a commercial license and then activate the commercial license.

The purchase options provide the standard "Single developer", "Team developer", "Site developer" and "Corporate developer" options that define how many developers are allowed to use the library. The standard license allows developing applications for Windows, Linux and macOS - it is called a "Desktop developer" license. To develop apps for mobile devices (Android and iOS) an additional "Mobile developer" license is required. With a standard commercial license you are allowed to use the Ab4d.SharpEngin to create applications for uses that do not have the Ab4d.SharpEngine license. But if you want to create a commercial library that uses Ab4d.SharpEngine, then a new "SDK license" is required. Contact us for more information.

To celebrate the launch, there is a 20% discount for all Ab4d.SharpEngine licenses. The discount is valid until January 7th, 2024.

I know that some of the Ab3d.PowerToys and Ab3d.DXEngine users did not look at the development of a new engine with a lot of gratitude. That development meant that less time was dedicated to the existing engines. I admit that lately not a lot of work has been done for other libraries. But this will change now. Next week, a new maintenance version of Ab3d.PowerToys and Ab3d.DXEngine will be published. That version will have some fixes and smaller improvements already implemented in the last few months.

What is more, for Q1 2024 I plan to release a new major version of the Ab3d.PowerToys and Ab3d.DXEngine. The following are planned new features:

  • Add support for Screen Space Ambient Occlusion (SSAO) that will significantly improve the visual quality.
  • Add new options to render pixels and point clouds (world-size pixels in addition to screen-size; render circular pixels or pixels with custom textures).
  • Add support for rendering 3D lines and line segments to an object ID bitmap (can be used for faster line hit testing).
  • Add options to copy only part of the object ID bitmap from GPU memory to CPU memory - this would make checking for hit objects much faster.
  • Trying to improve the performance of calculating edge lines by using oct-tree.

For 2024, I would also like to introduce a new product that would allow importing 3D models from STEP and IGES file formats that are commonly used by CAD applications. Later, there would also be improved support for geometric and surface modeling that is based on mathematical surfaces and not triangles.

So, it looks like 2024 will be another very busy year.

Please try the new Ab4d.SharpEngine. I really hope you will like it and that it will help you build awesome apps and bring 3D graphics "where no 3D graphics has gone before" (adapted from).

Tags: , ,

SharpEngine

Major versions for Ab3d.PowerToys and Ab3d.DXEngine published

by abenedik 5. July 2023 20:27

I am happy to inform you that new major versions of Ab3d.PowerToys and Ab3d.DXEngine have been published.

The new release brings many great new features and one bigger breaking change.

The breaking change is the removal of the ViewCubeCameraController:

ViewCubeCameraController

A customer recently informed me that the ViewCube is patented by Autodesk. It seems that the patent is active only in the USA. See here: https://patents.google.com/patent/US7782319

Therefore I have decided to remove that control from the library. Instead of ViewCubeCameraController the new version of the Ab3d.PowerToys library now provides the CameraNavigationCircles control. See the screenshot of the new sample that demonstrates the CameraNavigationCircles:

CameraNavigationCircles Sample

 

And an animation showing that control in action:

CameraNavigationCircles animation

As you can see, the new control provides many customization options and can be used in many different ways. What is more, it can replace both ViewCubeCameraController and also CameraAxisPanel.

However, if you are already using the ViewCubeCameraController and would like to continue using it, then please first carefully study the patent, and consult with a layer. If you still want to use the ViewCubeCameraController, then please contact me and I will send you the source code for that control so you will be able to integrate it into your project.

 

Another major new feature of this release is improved support for line caps (line endings). Previous versions supported only arrow line caps. The new version adds support for additional arrow types, boxes, diamonds and circles. See the screenshot from the new sample that demonstrates that:

3D lines with different line caps

What is more, the Ab3d.DXEngine finally gets full hardware acceleration of all 3D lines, including lines with line caps. Before, lines with line caps were generated on the CPU (on each camera change the MeshGeometry3D of the line was regenerated and this was very slow). The new version solves that and moves the generation of the lines to the geometry shader. This means rendering millions of 3D lines with different line caps is now possible.

The new Ab3d.DXEngine also improves line initialization time, so if you define many 3D lines, the engine will show them faster. Also, the order in which lines and other 3D objects are rendered is defined by an improved sorting mechanism, so there should be fewer DirectX state changes when rendering, resulting in slightly faster rendering.

The new release also comes with a new build of native Assimp library that can be used to import 3D models from almost any 3D file format. Unfortunately, it seems that the version number of that library has been stuck at v5.2.5 for almost a year, regardless of hundreds of commits. To still be able to see what version is used, a new GitCommitHash property was added. It returns the Git commit hash of the version. For example, the Assimp library that comes with this release has GitCommitHash set to 0dcfe2f - from 2023-07-03. 

The new Ab3d.PowerToys.Assimp library now also supports reading lights and camera data from the imported file.

 

There are also many other improvements and fixes. Even though a lot of time was spent on the new Ab4d.SharpEngine, the list of changes is still very long - see the change logs for Ab3d.PowerToys and Ab3d.DXEngine.

Tags: , , , ,

Ab3d.PowerToys | DXEngine

Ab4d.SharpEngine beta 2 comes with many new samples

by abenedik 18. April 2023 09:30

The second official beta version of the new cross-platform 3D rendering engine has been published. You can get the new samples from: https://github.com/ab4d/Ab4d.SharpEngine.Samples (on GitHub also click on the Watch button to be informed of future changes).

The new version comes with many new samples that demonstrate a lot of functionality of the new engine. There are samples that demonstate cameras, mouse camera controller, materials, lights, different 3D objects and lines, model importers and animation. The following screenshot shows the samples running in a WinUI 3.0 application:

Ab4d.SharpEngine Vulkan samples in WinUI 3.0 application

You can see that the samples are organized in a similar way as the samples for Ab3d.PowerToys and Ab3d.DXEngine.

Because the engine can run on multiple platforms and UI frameworks, most samples are now defined in a common samples project (Ab4d.SharpEngine.Samples.Common). That project uses a generic UI provider that can create UI elements like Labels, CheckBoxes, ComboBoxes, Sliders, Buttons and other elements that are required for the sample. Then the project for the specific platform references that common project and provides rendering of the UI. This way the same sample code can be used for WPF, WinUI and Avalonia. The Avalonia sample works on Windows and without any change in code the same sample also runs on Linux and macOS (see screenshot with Rider IDE in the back):

Ab4d.SharpEngine Vulkan samples in Avalonia application running on Linux

Ab4d.SharpEngine Vulkan samples in Avalonia application running on macOS

There are also two special samples for Android. They show only a single 3D scene. Their purpose is to demonstrate two different ways on how to initialize the engine in Android. From there on, the code to create and manipulate the 3D scene is the same as for desktop operating systems. The following screenshot shows the engine running in Android:

Ab4d.SharpEngine sample in Android application

The current version does not support iOS yet. The problem there is that AOT (ahead-of-time) compilation that is required for iOS does not support function pointers (https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-9.0/function-pointers) that are used by the engine to communicate with Vulkan. It is interesting that for Android or desktop it is possible to use AOT compilation and there function pointers work without problems. If you have any recommendations on how to use function pointers on iOS, I would be glad to hear that. Otherwise, it seems that a special build of SharpEngine will be required for iOS. That build would use a different and less efficient way to call Vulkan functions (using standard delegates and UnmanagedFunctionPointer attribute). This needs some additional research so the support for iOS has been moved to the next version.

The major goal of this beta version was to provide new samples that demonstrate how to use the engine. But there were also many improvements behind the scene.

The most important is updated code for sharing the rendered 3D scene with WinUI and Avalonia. In this case the 3D scene that is rendered by Vulkan stays in the GPU memory and is shared by the WinUI or Avalonia. The code for WinUI now uses SwapChainPanel instead of SurfaceImageSource. This is faster and better supported - SurfaceImageSource had problems on older computers or computers with integrated Intel GPU. In Avalonia the previous code for sharing texture created OpenGL vertex and pixel shaders and rendered the shared Vulkan texture to an OpenGL context. This was very complex and did not work well on all platforms. The developers of the Avalonia UI were also aware that this was not done well, so we worked together to define a new interface that can be used for sharing an external texture with Avalonia (after some private discussions with the developers the following was issued: External GPU memory interop (OpenGL, Vulkan, DirectX). The new version of the engine uses that new interface. This works very well so that shared texture can be used on computers where the previous approach did not work. What is more, Avalonia currently uses OpenGL to render its user interface, but there already exists a build of Avalonia that uses Vulkan to render the interface. This will be publicly available in one of the future versions. This means that it will be even easier and faster to share the 3D scene created with Ab4d.SharpEngine because whole application could use the same Vulkan device.

If you have not tested the beta 1 version, I would like to encourage you to try the new beta version. If you know how to create a 3D scene by using Ab3d.PowerToys, then it should be easy to work with the new library because the general concepts are the same. There are some differences in object names, but when working with the new engine, you will quickly see that the new API is much more polished than when using the Ab3d.PowerToys and Ab3d.DXEngine. The problem with those two libraries was that they were based on WPF 3D object model. That object model was extended by Ab3d.PowerToys and later by Ab3d.DXEngine objects. Because of this in those two libraries there exists multiple ways to define 3D objects: based on GeometryModel3D, Visual3D and on SceneNodes from DXEngine. Now, the 3D objects are all derived from SceneNode. All object grouping is done by GroupNode (instead of Model3DGroup, ModelVisual3D, ContentVisual3D, SceneNode). Also, when using Ab4d.DXEngine you need to use some tricks (using SetDXAttribute method) to define advanced properties on WPF materials. Now all material properties are directly accessible.

As promised before, the work on Ab3d.PowerToys and Ab3d.DXEngine will not stop. There are already many improvements and fixes in the current development version. Now I will focus on providing some additional new features and then prepare a new release. So if you have any recommendations, it is now a great time to provide that.

Tags: , ,

SharpEngine