AddPolygon wrong number of normals

Jan 30, 2012 at 4:07 AM


I am trying to display a mesh created from a polygon.

But when I run the toMesh I am getting the message "Wrong number of normals" And I am not sure what that message is referring to.


List<Point3D> vrt = new List<Point3D>();
                // Create a list of Points
                for (int i = 0; i < set.Count(); i++)
                     new Point3D


                var surface = new MeshBuilder();
                var mesh = surface.ToMesh();

Any help will be greatly appreciated. I am very new to WPF 3D and am finding the learning curve quite steep.

Thanks a lot


Jan 30, 2012 at 7:41 AM

hi Murray, 

I see this can be a bit confusing, it should be improved..

The parameterless MeshBuilder constructor will create a mesh with both normals and texture coordinates. The AddPolygon will currently only add vertices, not normals and texture coordinates.

I think changing the constructor to

new MeshBuilder(false,false)

should work.

I think there are two possible improvements here

a. Let AddPolygon calculate normals and texture coordinates if this is requested

b. Remove the parameterless constructor of MeshBuilder - so you _have to_ specify if normals/texture coordinates should be generated 

Jan 31, 2012 at 8:07 AM

Thanks for the quick reply Objo

That fixed the error I was getting.

Great work!

Jan 31, 2012 at 8:34 AM


When the meshbuilder now creates the mesh I can only see it from one side.

How do I get the meshbuilder to generate a mesh that I can rotate around and see from both sides?



Jan 31, 2012 at 9:01 AM

Remember to set the BackMaterial, it can be the same as the (front) Material.