Hi,
I started to learn some 3D in WPF today and I copied some simple examples (planes) into my XAML, and they all worked. However, when I adjusted the camera's and the plane's coordinates to meet my needs, I always see nothing.
I do not know what I am doing wrong, and I also already sketched the (really simple) 3D scene to verify my data, and it all seems correct to me.
Could anyone please check the following XAML and tell me what I am doing wrong? I only want to create a plane in the x-z-plane, i.e. some sort of "floor" with the camera looking down on it from the top.
<Viewport3D>
<Viewport3D.Camera>
<PerspectiveCamera Position="0 1 0"
LookDirection="0 -1 0"
FieldOfView="60"/>
</Viewport3D.Camera>
<Viewport3D.Children>
<ModelVisual3D>
<ModelVisual3D.Content>
<AmbientLight Color="White"/>
</ModelVisual3D.Content>
</ModelVisual3D>
<ModelVisual3D>
<ModelVisual3D.Content>
<GeometryModel3D>
<GeometryModel3D.Geometry>
<MeshGeometry3D>
<MeshGeometry3D.Positions>
<Point3D X="-1" Y="0" Z="1"/>
<Point3D X="1" Y="0" Z="1"/>
<Point3D X="1" Y="0" Z="-1"/>
<Point3D X="-1" Y="0" Z="-1"/>
</MeshGeometry3D.Positions>
<MeshGeometry3D.TriangleIndices>
0 1 2 0 2 3
</MeshGeometry3D.TriangleIndices>
<MeshGeometry3D.Normals>
<Vector3D X="0" Y="1" Z="0"/>
<Vector3D X="0" Y="1" Z="0"/>
<Vector3D X="0" Y="1" Z="0"/>
<Vector3D X="0" Y="1" Z="0"/>
<Vector3D X="0" Y="1" Z="0"/>
<Vector3D X="0" Y="1" Z="0"/>
</MeshGeometry3D.Normals>
</MeshGeometry3D>
</GeometryModel3D.Geometry>
<GeometryModel3D.Material>
<MaterialGroup>
<DiffuseMaterial>
<DiffuseMaterial.Brush>
<SolidColorBrush Color="Red" Opacity="0.75"/>
</DiffuseMaterial.Brush>
</DiffuseMaterial>
</MaterialGroup>
</GeometryModel3D.Material>
</GeometryModel3D>
</ModelVisual3D.Content>
</ModelVisual3D>
</Viewport3D.Children>
</Viewport3D>
EDIT: I just experimented with the camera's Position and LookDirection, and finally saw something when I changed the LookDirection to be not perpendicular to the plane, for example:
<PerspectiveCamera Position="0 2 0"
LookDirection="0 -2 1"
FieldOfView="60"/>
Is this normal behavior?
Many thanks!
gehho.