1

This picture is a face draw with Microsoft wpf on the left and the same with sharpdx wpf on the right. The edges of the sharpdx face are less smooth. faces This is all the SharpDX code I use in VB.net without XAML. What do I miss?

Imports System.Windows
Imports System.Windows.Controls
Imports HelixToolkit.Wpf.SharpDX
Imports SharpDX

Module UnitMain

    Public MainForm As New Window
    Public FormGrid As New Grid
    Public GridPort As New Viewport3DX
    Public PortCamera As New PerspectiveCamera
    Public PortLamp As New DirectionalLight3D
    Public PortModel As New MeshGeometryModel3D
    Public ModelBuilder As New MeshBuilder

    Sub MainFormInit()

        ModelBuilder.AddQuad(New Vector3(-0.5, 0.5, 0), New Vector3(-0.5, -0.5, 0), New Vector3(0.5, -0.5, 0), New SharpDX.Vector3(0.5, 0.5, 0))
        PortModel.Geometry = ModelBuilder.ToMeshGeometry3D
        PortModel.Material = DiffuseMaterials.Yellow
        PortLamp.Color = Media.Colors.White
        PortLamp.Direction = New Media.Media3D.Vector3D(2, -1, -3)
        PortCamera.Position = New Media.Media3D.Point3D(-2, 1, 3)
        PortCamera.LookDirection = New Media.Media3D.Vector3D(2, -1, -3)
        PortCamera.FieldOfView = 40
        GridPort.Items.Add(PortModel)
        GridPort.Items.Add(PortLamp)
        GridPort.Camera = PortCamera
        GridPort.EffectsManager = New DefaultEffectsManager
        FormGrid.Children.Add(GridPort)
        MainForm.Width = 800
        MainForm.Height = 800
        MainForm.Content = FormGrid
    End Sub

    Sub Main()

        MainFormInit()
        MainForm.ShowDialog()
    End Sub
End Module
Maxence
  • 12,868
  • 5
  • 57
  • 69
  • 1
    Search for "sharpdx antialiasing". – Andrew Morton Oct 19 '19 at 14:26
  • Okee, I searched for that and find a thing as MSAA. No idea what that means... but adding GridPort.MSAA = MSAALevel.Maximum to the code gives a beautifull result Thanks! – MetPensioenEnToen Oct 19 '19 at 14:50
  • 1
    You're welcome :) MSAA = [Multisample anti-aliasing](https://en.wikipedia.org/wiki/Multisample_anti-aliasing). You might want to read a few things like that to familiarise yourself with the acronyms used. Also, it would be worth adding your own answer here with a little bit of explanation so that if someone else has the same problem then they will find useful information ;) – Andrew Morton Oct 19 '19 at 15:06

1 Answers1

2

As a retired VB6 and VBA programmer I try to switch to VB.net and discovered WPF. The hobby of me is to avoid the XAML part. This is possible and also by extend de code with the powerful Helix Toolkit. So I run to the above problem of the aliasing thing that is solved thanks to Andrew Morton. Adding to the above code

GridPort.MSAA = MSAAlevel.Maximum

Give edges of my models as good as the models that I draw first without Helix toolkit.

Great Forum!