private void ShowPositionsArray(Vector3[] positionsArray, float pixelSize, Color4 pixelColor, Bounds positionBounds) { if (_isUsingPixelsVisual3D) { // The easiest way to show many pixels is to use PixelsVisual3D. var pixelsVisual3D = new PixelsVisual3D() { Positions = positionsArray, PixelColor = pixelColor.ToWpfColor(), PixelSize = pixelSize }; // It is highly recommended to manually set the PositionsBounds. // If this is not done, the bounds are calculated by the DXEngine with checking all the positions. pixelsVisual3D.PositionsBounds = positionBounds; MainViewport.Children.Add(pixelsVisual3D); // !!! IMPORTANT !!! // When PixelsVisual3D is not used any more, it needs to be disposed (we are using DisposeList to dispose all in Unloaded event handler) _disposables.Add(pixelsVisual3D); return; } // First stop in showing positions in the positionsArray as pixels is to create a SimpleMesh<Vector3>. // This will create a DirectX VertexBuffer that will be passed to the shaders. var simpleMesh = new SimpleMesh <Vector3>(vertexBufferArray: positionsArray, indexBufferArray: null, inputLayoutType: InputLayoutType.Position); simpleMesh.PrimitiveTopology = PrimitiveTopology.PointList; // We need to change the default PrimitiveTopology.TriangleList to PointList // To correctly set the Camera's Near and Far distance, we need to provide the correct bounds of each shown 3D model. if (positionBounds != null && !positionBounds.IsEmpty) { // It is highly recommended to manually set the Bounds. simpleMesh.Bounds = positionBounds; } else { // if we do not manually set the Bounds, then we need to call CalculateBounds to calculate the bounds simpleMesh.CalculateBounds(); } simpleMesh.CalculateBounds(); // We will need to dispose the SimpleMesh _disposables.Add(simpleMesh); // Create a new PixelMaterial _pixelMaterial = new PixelMaterial() { PixelColor = pixelColor, PixelSize = pixelSize }; _pixelMaterial.InitializeResources(MainDXViewportView.DXScene.DXDevice); _disposables.Add(_pixelMaterial); // Now create a new MeshObjectNode _meshObjectNode = new Ab3d.DirectX.MeshObjectNode(simpleMesh, _pixelMaterial); _disposables.Add(_meshObjectNode); // To be able to add the MeshObjectNode (or any other SceneNode) to WPF's Viewport3D, // we need to create a SceneNodeVisual3D var sceneNodeVisual3D = new SceneNodeVisual3D(_meshObjectNode); MainViewport.Children.Add(sceneNodeVisual3D); }