Note that there are some explanatory texts on larger screens.

plurals
  1. POProblems with 3D WPF
    primarykey
    data
    text
    <p>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.</p> <p>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.</p> <p>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.</p> <pre><code>&lt;Viewport3D&gt; &lt;Viewport3D.Camera&gt; &lt;PerspectiveCamera Position="0 1 0" LookDirection="0 -1 0" FieldOfView="60"/&gt; &lt;/Viewport3D.Camera&gt; &lt;Viewport3D.Children&gt; &lt;ModelVisual3D&gt; &lt;ModelVisual3D.Content&gt; &lt;AmbientLight Color="White"/&gt; &lt;/ModelVisual3D.Content&gt; &lt;/ModelVisual3D&gt; &lt;ModelVisual3D&gt; &lt;ModelVisual3D.Content&gt; &lt;GeometryModel3D&gt; &lt;GeometryModel3D.Geometry&gt; &lt;MeshGeometry3D&gt; &lt;MeshGeometry3D.Positions&gt; &lt;Point3D X="-1" Y="0" Z="1"/&gt; &lt;Point3D X="1" Y="0" Z="1"/&gt; &lt;Point3D X="1" Y="0" Z="-1"/&gt; &lt;Point3D X="-1" Y="0" Z="-1"/&gt; &lt;/MeshGeometry3D.Positions&gt; &lt;MeshGeometry3D.TriangleIndices&gt; 0 1 2 0 2 3 &lt;/MeshGeometry3D.TriangleIndices&gt; &lt;MeshGeometry3D.Normals&gt; &lt;Vector3D X="0" Y="1" Z="0"/&gt; &lt;Vector3D X="0" Y="1" Z="0"/&gt; &lt;Vector3D X="0" Y="1" Z="0"/&gt; &lt;Vector3D X="0" Y="1" Z="0"/&gt; &lt;Vector3D X="0" Y="1" Z="0"/&gt; &lt;Vector3D X="0" Y="1" Z="0"/&gt; &lt;/MeshGeometry3D.Normals&gt; &lt;/MeshGeometry3D&gt; &lt;/GeometryModel3D.Geometry&gt; &lt;GeometryModel3D.Material&gt; &lt;MaterialGroup&gt; &lt;DiffuseMaterial&gt; &lt;DiffuseMaterial.Brush&gt; &lt;SolidColorBrush Color="Red" Opacity="0.75"/&gt; &lt;/DiffuseMaterial.Brush&gt; &lt;/DiffuseMaterial&gt; &lt;/MaterialGroup&gt; &lt;/GeometryModel3D.Material&gt; &lt;/GeometryModel3D&gt; &lt;/ModelVisual3D.Content&gt; &lt;/ModelVisual3D&gt; &lt;/Viewport3D.Children&gt; &lt;/Viewport3D&gt; </code></pre> <p><strong>EDIT:</strong> I just experimented with the camera's Position and LookDirection, and finally saw something when I changed the LookDirection to be <strong>not perpendicular</strong> to the plane, for example:</p> <pre><code>&lt;PerspectiveCamera Position="0 2 0" LookDirection="0 -2 1" FieldOfView="60"/&gt; </code></pre> <p>Is this normal behavior?</p> <p>Many thanks!</p> <p>gehho.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload