SharpDX fork no BackMaterial property in MeshGeometryModel3D

Mar 5, 2014 at 1:27 PM
Didn't find BackMaterial property in MeshGeometryModel3D. Back side of the polygon is black - is there any solution to apply texture to it? Tried to add additional points with inversed normals, but polygons overlap when displayed, so that color from the back side of polygon is also visible.
Mar 12, 2014 at 5:49 PM
Today I face the same issue with meshbuilder and following is the code I used to create duplicate triangles. Here mb is the meshbuilder class.
            var copytri = new int[mb.TriangleIndices.Count];

            var copynorm = new Vector3[mb.Normals.Count];
            for (int i = 0; i < copynorm.Length; i++)
                copynorm[i] = -1 * mb.Normals[i];
            mb.Append(mb.Positions.ToArray(), copytri, copynorm, mb.TextureCoordinates.ToArray());
Mar 14, 2014 at 5:23 AM
Thanks for your reply. I tried to do the same thing manually. Sometimes polygons overlaps and scene glitches when i try to scale or rotate. In WPF branch i had the same problem and it was resolved by setting NearPlaneDistance in camera. Possible, I made a mistake. Did you try your solution for large scenes (1000 or more units)?
Mar 14, 2014 at 7:07 AM
I had used that approach to render mesh surface consisiting of more than 200,000 triangles, and I haven't faced the overplap issue. However for some cases, i have to reverse the original normals prior to creating their copy, may be thats the issue your facing. Also, i had set NearPlaneDistance to 0.5 and FarPlaneDistance to 10000.
var copynorm = new Vector3[mb.Normals.Count];
for (int i = 0; i < copynorm.Length; i++)
         mb.Normals[i] *= -1;
         copynorm[i] = -1 * mb.Normals[i];
Hope that will help you with your issue.

P.S. Reversing the original normal was required when your building triangles using Right Hand Rule (WPF approach) instead of using Left Hand Rule (DirectX/SharpDX approach)