Skip to content

v3.2.9386

Latest

Choose a tag to compare

@abenedik abenedik released this 22 Sep 07:31
· 16 commits to main since this release
  • Significantly improved performance of hit-testing of complex meshes by using octree structures. By default, on the first hit test operation, a MeshOctree object is generated for meshes with more than 512 positions. This increases the mesh initialization time but significantly improves hit testing performance and allows super-fast hit testing of meshes with millions of positions. MeshOctree can be created manually by calling the new CreateOctree method and then assigning it to the new Octree property. It can also be created automatically when hit testing. This is controlled by the MeshPositionsCountForOctreeGeneration, OctreeMaxNodeLevel and GenerateOctreeOnMeshInitialization properties in the HitTestOptions object.
  • Added support for volume rendering (for example, CT scans, 3D smoke or clouds, etc.): added VolumeMaterial, VolumeRenderingEffect and CubeSlicer.
  • Added IsTwoSided property to VertexColorMaterial. When this is true, the front and back sides of the triangles are rendered with a single draw call.
  • Added PrimitiveIdMaterial that can be used to render each triangle of a mesh with a color that is defined by the triangle index. This can be used for super-fast triangle hit testing (checking which triangle on the mesh was hit).
  • Improved Triangulator to triangulate some polygons with holes correctly. Also added FailedToFindPolygonEars property that is set to true when the triangulation failed to correctly triangulate the positions so the user knows that the results may not be correct.
  • Added optional sourceOffset and destinationOffset parameters to VulkanDevice.CopyBuffer method.
  • Added overloads to GpuBuffer.WriteToBuffer and VulkanDevice.CreateBuffer methods that also take a data parameter as a ReadOnlySpan type and not only as a Span and an array.
  • Added SetCameraRotation method to SphericalCamera and TargetPositionCamera. It sets the camera's Heading and Attitude and raises the CameraChanged only once (when changing both Heading and Attitude properties then the CameraChanged event is called twice). When RotationCenterPosition is set, the method rotates the camera around RotationCenterPosition. Note that setting Heading and Attitude properties directly does not rotate the camera around the RotationCenterPosition.
  • Added DescriptorSetsCache that is used to cache Vulkan's DescriptorSets so they can be reused when the material data block with the same texture image and sampler is used.
  • Added new constructors to HeightMapContoursNode and HeightMapWireframeNode that can be used to set all properties that are required to generate the mesh. Before, only a few properties could be set by the constructor. Other properties must be set after that, but setting each property calls UpdateMesh method that regenerates the whole mesh. Using the new constructors significantly improves the time of height map mesh generation.
  • Added EngineCreateOptions.EnableNamingVulkanResources property. When set to true, then naming Vulkan resources can be enabled without enabling standard validation.
  • Added DescriptorSetsCache class and VulkanDevice.GetOrCreateDescriptorSetsCache method. The DescriptorSetsCache can be used to cache the DescriptorSets so that the same storage buffer and texture image with sampler use the same DescriptorSet.
  • Added VulkanDevice.DisableBackgroundUpload and EnableBackgroundUpload methods that can be used to disable background image loading.
  • Added IsDisposed to BitmapTextCreator and prevented the class usage after it is disposed.
  • Added Dispose method to TextBlockFactory.
  • Added DriverInfo property to PhysicalDeviceDetails. It provides the driver name and version of the graphics driver.
  • Added EnableBackgroundUpload property to SharpEngineSceneView. By default, it is set to true, but user can set it to false to prevent loading GpuImages and GpuBuffers on a background thread.
  • Added HitTestOptions.PreventCallingUpdateBeforeHitTesting to always prevent calling Scene's Update method.
  • Added an optional parameter isColorAlphaPremultiplied to some methods in the TextureFactory class. Also prevented changing the order of GradientStop items when sorting the items and two items have the same offset (using Linq OrderBy instead of Array.Sort).
  • Added support for 3D images by adding the Depth property to GpuImage.
  • Added VulkanDevice.IsLost property and VulkanDevice.DeviceLost event. The user can subscribe to this event and then recreate the Scene or SharpEngineSceneView to restore the rendering.
  • Added RandomSamplesRunner to Samples.Common project. It can be used to randomly change the shown sample as fast as possible (on ApplicationIdle).
  • Fixed Scene.GetAllHitObjects method that in some cases returned too few hit results.
  • Fixed Scene.GetAllHitObjects method that in some cases returned duplicate hit results that lie on the same triangle edge event when ReportAllHitTrianglesWhenEdgeIsHit was set to false.
  • Added CreateGradientColors methods with multiple overloads to TextureFactory. They can be used to create an array of colors that define the color gradient.
  • Fixed rendering SolidColorMaterial when the mesh is not using PositionNormalTextureVertex format.
  • Increased the default size of the staging buffer from 512 KB to 1 MB. This prevents the validation warning that the staging buffer should not be allocated to a dedicated memory block because it is too small.
  • When using SharpEngineSceneView for WPF, the DirectX 9 device and DirectX 11 device that are used for sharing the texture are cached. This significantly improves the performance of creating a new SharpEngineSceneView or of showing the content of SharpEngineSceneView after its Visibility was set to Visible (from Hidden or Collapsed).
  • Wait until any background queue tasks are finished before calling vkDeviceWaitIdle. This prevents the following error: "vkDeviceWaitIdle(): THREADING ERROR : object of type VkQueue is simultaneously used in current thread 52752 and thread 43220".
  • Prevented application crash that could happen when back buffer resources were disposed and quickly recreated again (for example, when SharpEngineSceneView was hidden and shown again). In this case, the new depth buffer can get the same Vulkan handle as the previous back buffer image. Because of reusing the DescriptorSet objects, the source texture image was not reset because the Handle was the same, but this could produce a memory read fault in the fragment shader.
  • Prevented possible application deadlock in an Avalonia app with Vulkan backend.
  • Prevented calling Scene.Update method before doing hit-testing and after no bigger changes are done to the 3D scene (for example, after only a camera or lights are changed).
  • Fixed setting SharpEngineSceneView.MultisampleCount and SupersamplingCount after SceneView was already initialized.
  • Change the order of data that is written to the log file. Now the thread id is written after the time and not after the LogArea.
  • Changed the default value of IsUsingSharedTextureForIntegratedIntelGpu to true (defined in SharpEngineSceneView for WPF). This usually requires creating an additional DirectX 11 texture because Intel drivers do not allow sharing a Vulkan texture with DirectX 9 (used by WPF). Because an additional texture copy is required, this may be slower than using WritableBitmap (WritableBitmap is used when IsUsingSharedTextureForIntegratedIntelGpu is false).
  • Fixed rendering PolyLineNode when IsClosed is set to true and GeometryShader is not supported by the GPU, for example, on MacOS or iOS.
  • Fixed recording the command buffers again when the RenderingStepsChanged SceneViewDirtyFlag is set (for example, in MultipleSceneViewsSample when rendering type ComboBox is set to Standard).
  • Improved stability when an exception happens during rendering. The error is logged and this does not prevent rendering the next frame.

Samples:

  • Samples for Avalonia, WPF and WinUI now have a new "Advanced settings" section in the Settings window. It can be used to change some advanced engine settings and can also add a new TEST button that can be clicked to randomly show samples as fast as possible (on ApplicationIdle).

Ab4d.SharpEngine.glTF:

  • Added support for KHR_materials_unlit extension. When it is used, then SolidColorMaterial is used instead of StandardMaterial.
  • Fixed reading data in some glTF files with Draco compression.

Breaking change:
A single camera object can no longer be assigned to multiple SceneView objects. If this is done, then an exception is thrown.
There are multiple reasons for that:

  • The camera has a SceneView property that specifies only a single SceneView to which the camera is assigned.
  • The size of the SceneView determines the aspect ratio of the camera and this is used in the calculation of the perspective matrix.
  • Creating CameraLight objects do not work when using multiple SceneViews.

If you were using the same camera object on multiple SceneView objects you can:

  • Unassign the camera from the previous SceneView and then assign it to the new SceneView.
  • Or create a new camera and assign it to the new SceneView. You can also synchronize it by subscribing to CameraChanged event and then update the values. See Advanced/OutlinesOverObjectsSample.cs for an example.