title: Why does TextureCoordinates work as expected for a Viewport2DVisual3D, but not for a GeometryModel3D?
body: <p>I have a model that I created in 3ds Max. The model is a simple rectangle. Its texture has overlapping texture coordinates--the model should display the right half of the image file twice, side-by-side. I exported this model as an <code>.obj</code>, and converted it to XAML using Microsoft Expression Blend.</p>
  
  <p>I took the <code>MeshGeometry3D</code> from blend, and added it to a <code>Viewport3D</code> using two methods:</p>
  
  <ol>
  <li>Use a <code>Viewport2DVisual3D</code> with a <code>Label</code> as its <code>Visual</code>. Set the <code>Label</code>'s background to the texture image. Using this method, everything works as expected.</li>
  <li>Use a <code>ModelVisual3D</code> with a <code>GeometryModel3D</code> as its <code>Content</code>. Set the <code>GeometryModel3D</code>'s material to a <code>DiffuseMaterial</code> that uses the image as its brush. Using this method, the <code>TextureCoordinates</code> of the <code>MeshGeometry3D</code> appear to be interpreted differently.</li>
  </ol>
  
  <p>The full code is provided below. The code-behind is empty except for <code>InitializeComponent()</code>:</p>
  
  <pre><code>&lt;Window x:Class="TestTextureCoordinates.MainWindow"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      Title="MainWindow" Height="350" Width="525"&gt;
  &lt;Grid&gt;
      &lt;Grid.Resources&gt;
          &lt;MeshGeometry3D x:Key="geometry"
                          Normals="0,0,1 0,0,1 0,0,1 0,0,1 0,0,1 0,0,1 0,0,1 0,0,1"
                          Positions="113.8997,102.4171,0 148.9045,102.4171,0 148.9045,148.41161,0 113.8997,148.41161,0 184.5722,102.4171,0 184.5722,148.41161,0 148.9045,148.41161,0 148.9045,102.4171,0"
                          TextureCoordinates="0.50639999,0.9995 1.0065,0.9995 1.0065,0.00050002337 0.50639999,0.00050002337 1.0022,0.9995 1.0022,0.00050002337 0.5,0.00050002337 0.5,0.9995"
                          TriangleIndices="0 1 2 0 2 3 4 5 6 4 6 7"/&gt;
          &lt;ImageBrush x:Key="brush" ImageSource="img/test.jpg" /&gt;
      &lt;/Grid.Resources&gt;
  
      &lt;Viewport3D&gt;
          &lt;Viewport3D.Camera&gt;
              &lt;PerspectiveCamera Position="195,125,210" LookDirection="0,0,-1" /&gt;
          &lt;/Viewport3D.Camera&gt;
  
          &lt;ModelVisual3D&gt;
              &lt;ModelVisual3D.Content&gt;
                  &lt;AmbientLight Color="White" /&gt;
              &lt;/ModelVisual3D.Content&gt;
          &lt;/ModelVisual3D&gt;
  
          &lt;!-- The first model, using a Viewport2DVisual3D. This works as intended. --&gt;
          &lt;Viewport2DVisual3D Geometry="{StaticResource geometry}"&gt;
              &lt;Viewport2DVisual3D.Visual&gt;
                  &lt;Label Background="{StaticResource brush}" /&gt;
              &lt;/Viewport2DVisual3D.Visual&gt;
              &lt;Viewport2DVisual3D.Material&gt;
                  &lt;DiffuseMaterial Viewport2DVisual3D.IsVisualHostMaterial="True" /&gt;
              &lt;/Viewport2DVisual3D.Material&gt;
          &lt;/Viewport2DVisual3D&gt;
  
          &lt;!-- The second model, using a ModelVisual3D and GeometryModel3D. The TextureCoordinates do not work as intended. --&gt;
          &lt;ModelVisual3D&gt;
              &lt;!-- We apply a transform to offset this model from the first model. --&gt;
              &lt;ModelVisual3D.Transform&gt;
                  &lt;TranslateTransform3D OffsetX="90" /&gt;
              &lt;/ModelVisual3D.Transform&gt;
              &lt;ModelVisual3D.Content&gt;
                  &lt;GeometryModel3D Geometry="{StaticResource geometry}"&gt;
                      &lt;GeometryModel3D.Material&gt;
                          &lt;DiffuseMaterial Brush="{StaticResource brush}" /&gt;
                      &lt;/GeometryModel3D.Material&gt;
                  &lt;/GeometryModel3D&gt;
              &lt;/ModelVisual3D.Content&gt;
          &lt;/ModelVisual3D&gt;
      &lt;/Viewport3D&gt;
  &lt;/Grid&gt;
  </code></pre>
  
  <p></p>
  
  <p>Here is <code>test.jpg</code>:</p>
  
  <p><img src="https://i.stack.imgur.com/2n77q.jpg" alt="enter image description here"></p>
  
  <p>Here is the final result. On the left is the <code>Viewport2DVisual3D</code>, which looks the same as it does in 3ds Max. On the right is the <code>ModelVisual3D</code>, which appears to be interpreting the <code>TextureCoordinates</code> differently.</p>
  
  <p><img src="https://i.stack.imgur.com/aSjtz.png" alt="enter image description here"></p>
  
  <p>What's going on here? Due to other requirements of the software I am working on, I cannot use a <code>Viewport2DVisual3D</code>. How can I make a <code>GeometryModel3D</code> interpret the <code>TextureCoordinates</code> correctly?</p>