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](https://www.ab4d.com/images/DXEngine/DXEngine-gltf-importer-chess-sample.png)
![FlightHelmet 3D model importer by DXEngine's glTF importer](https://www.ab4d.com/images/DXEngineGallery/DXEngine-gltf-importer-FlightHelmet.png)
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.