06-01-2021, 10:26 PM
You are using some custom MeshGeomtry objects so I cannot test this code, but I would say that you probably need to inverse the order of triangle indices. The order of triangle indices determines which side of the triangle is front side and which side is back side. Usually counter-clockwise side is front side.
This is described in the "Basic WPF objects tutorial" sample - the first sample in the Ab3d.PowerToys samples project.
For example in your case, the order of the following triangle indices "0, 1, 3, 1, 2, 3, ..." can be changed by swapping two items, for example swapping second and third: "0, 3, 1, 1, 3, 2, ...".
The best way to diagnose such problems is to set front material to green color and back material to red color - this way you will immediately see which triangles need to be swapped.
You can also use:
and check how the mesh is created by this method (you can also use some other class from Ab3d.Meshes namespace).
To see a few samples on how to create low level DXEngine objects, please check the "ManuallyCreatedSceneNodes.xaml.cs" sample in the "DXEngine advanced" section of the Ab3d.DXEngine sample project.
This is described in the "Basic WPF objects tutorial" sample - the first sample in the Ab3d.PowerToys samples project.
For example in your case, the order of the following triangle indices "0, 1, 3, 1, 2, 3, ..." can be changed by swapping two items, for example swapping second and third: "0, 3, 1, 1, 3, 2, ...".
The best way to diagnose such problems is to set front material to green color and back material to red color - this way you will immediately see which triangles need to be swapped.
You can also use:
Code:
var mesh = new Ab3d.Meshes.PyramidMesh3D(bottomCenterPosition, size).Geometry;and check how the mesh is created by this method (you can also use some other class from Ab3d.Meshes namespace).
To see a few samples on how to create low level DXEngine objects, please check the "ManuallyCreatedSceneNodes.xaml.cs" sample in the "DXEngine advanced" section of the Ab3d.DXEngine sample project.
Andrej Benedik

