/ / C # 3D wpf mallas negras - c #, wpf, 3d, geometría

C # 3D wpf mallas negras - c #, wpf, 3d, geometría

C # 3D wpf visual studio 2010

Tengo una escena que consiste en un círculo formado por un número de triángulos que he agregado mallas a bakside y frente.

El trinagle aparece en mi vista, pero los lados son negros, tanto por dentro como por fuera. Agrego la materia lin de esta manera

Material material = new DiffuseMaterial(new SolidColorBrush(Colors.Blue));

pero si cambio el material a

Material material = new EmissiveMaterial(new SolidColorBrush(Colors.Red));

Los lados comienzan a brillar en este color.

Tengo tres fuentes de luz

< AmbientLight Color="White" / >

< DirectionalLight  x:Name="myDirectLight1" Color="White"/ >

< PointLight  x:Name="myPointLight1" Color="White" Position="0,0,0"/>

Donde yo también hago

myCamera.LookDirection = -(Vector3D)myCamera.Position; //always look to (0,0,0)
myDirectLight1.Direction = myCamera.LookDirection; //light comes from the camera

Pero los lados siguen siendo negros (a menos que cambie el material a EmissiveMaterial) ???

¿Las luces tienen algún tipo de rango predeterminado no configurado en infinito?

El círculo es grande, alrededor de 2000 unidades de diámetro,

Saludos

Adicional

    private Model3DGroup CreateTriangleModel(Point3D p0, Point3D p1, Point3D p2, Material material, Material material2)
{
MeshGeometry3D mesh = null;
GeometryModel3D model = null;
Model3DGroup group = new Model3DGroup();

//
// Front side of jagged part
//
mesh = new MeshGeometry3D();

mesh.Positions.Add(p0);
mesh.Positions.Add(p1);
mesh.Positions.Add(p2);

mesh.TriangleIndices.Add(0);
mesh.TriangleIndices.Add(1);
mesh.TriangleIndices.Add(2);

Vector3D normal = CalculateNormal(p0, p1, p2);

mesh.Normals.Add(normal);
mesh.Normals.Add(normal);
mesh.Normals.Add(normal);
//
// Front side of the surface below the jagged edge
//
Point3D p3 = new Point3D(p1.X, p1.Y, bh);
Point3D p4 = new Point3D(p2.X, p2.Y, bh);

mesh.Positions.Add(p3);
mesh.Positions.Add(p4);

mesh.TriangleIndices.Add(1);
mesh.TriangleIndices.Add(3);
mesh.TriangleIndices.Add(4);

normal = CalculateNormal(p1, p3, p4);
mesh.Normals.Add(normal);
mesh.Normals.Add(normal);
mesh.Normals.Add(normal);

mesh.TriangleIndices.Add(1);
mesh.TriangleIndices.Add(4);
mesh.TriangleIndices.Add(2);

normal = CalculateNormal(p1, p4, p2);
mesh.Normals.Add(normal);
mesh.Normals.Add(normal);
mesh.Normals.Add(normal);

model = new GeometryModel3D(mesh, material);

group.Children.Add(model);


//
// Back side of jagged part
//
mesh = new MeshGeometry3D();

mesh.Positions.Add(p0);
mesh.Positions.Add(p1);
mesh.Positions.Add(p2);

mesh.TriangleIndices.Add(0);
mesh.TriangleIndices.Add(2);
mesh.TriangleIndices.Add(1);

normal = CalculateNormal(p0, p1, p2);

mesh.Normals.Add(normal);
mesh.Normals.Add(normal);
mesh.Normals.Add(normal);
//
// Back side of the surface below the jagged edge
//
p3 = new Point3D(p1.X, p1.Y, bh);
p4 = new Point3D(p2.X, p2.Y, bh);

mesh.Positions.Add(p3);
mesh.Positions.Add(p4);

mesh.TriangleIndices.Add(1);
mesh.TriangleIndices.Add(4);
mesh.TriangleIndices.Add(3);

normal = CalculateNormal(p1, p4, p3);
mesh.Normals.Add(normal);
mesh.Normals.Add(normal);
mesh.Normals.Add(normal);

mesh.TriangleIndices.Add(1);
mesh.TriangleIndices.Add(2);
mesh.TriangleIndices.Add(4);

normal = CalculateNormal(p1, p2, p4);
mesh.Normals.Add(normal);
mesh.Normals.Add(normal);
mesh.Normals.Add(normal);

model = new GeometryModel3D(mesh, material2);
group.Children.Add(model);


return group;
}

private Vector3D CalculateNormal(Point3D p0, Point3D p1, Point3D p2)
{
Vector3D v0 = new Vector3D(
p1.X - p0.X, p1.Y - p0.Y, p1.Z - p0.Z);
Vector3D v1 = new Vector3D(
p2.X - p1.X, p2.Y - p1.Y, p2.Z - p1.Z);
return Vector3D.CrossProduct(v0, v1);
}

Respuestas

0 para la respuesta № 1

El error fue que mis fuentes de luz fueron definidasen el código XAML pero eliminé de forma accedida ellos en el código fuente que resultó en el extraño resultado donde los objetos eran "visibles" pero todo en negro, independientemente del material