Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

ImageBrush & 3D

Closed Thread
 
Thread Tools Display Modes
Old 10-21-2006   #1 (permalink)
John
Guest


 

ImageBrush & 3D

I can't get my viewport3d to display the content of my image brush the image
brush does work on the rectangle but not in my 3D viewport. Here is the
XAML what am I doing wrong?

<Viewport3D Margin="0,34,24,33" x:Name="Viewport3D"
HorizontalAlignment="Right" Width="288">
<Viewport3D.Camera>
<PerspectiveCamera x:Name="OrthographicCamera" FieldOfView="45"
Position="0,0.5,3" LookDirection="0,0,-1" UpDirection="0,1,0"
NearPlaneDistance="0.125" FarPlaneDistance="Infinity">
<PerspectiveCamera.Transform>
<Transform3DGroup>
<TranslateTransform3D OffsetZ="0" OffsetY="0" OffsetX="0"/>
<ScaleTransform3D ScaleX="1" ScaleY="1" ScaleZ="1"/>
<RotateTransform3D d:EulerAngles="0,0,0"/>
<TranslateTransform3D OffsetZ="0" OffsetY="0" OffsetX="0"/>
<TranslateTransform3D OffsetZ="0" OffsetY="0" OffsetX="0"/>
</Transform3DGroup>
</PerspectiveCamera.Transform>
</PerspectiveCamera>
</Viewport3D.Camera>


<ModelVisual3D>
<ModelVisual3D.Content>
<GeometryModel3D>
<GeometryModel3D.Geometry>
<MeshGeometry3D Positions="0 0 0, 0 1 0, 1 0 0, 1 1
0"
TriangleIndices="0 2 3, 0 3 1" />
</GeometryModel3D.Geometry>

<GeometryModel3D.Material>
<DiffuseMaterial>
<DiffuseMaterial.Brush>
<ImageBrush ImageSource="Images\pic_011.tif" Stretch="Fill"/>
</DiffuseMaterial.Brush>
</DiffuseMaterial>
</GeometryModel3D.Material>

<GeometryModel3D.BackMaterial>
<DiffuseMaterial Brush="Blue" />
</GeometryModel3D.BackMaterial>

</GeometryModel3D>
</ModelVisual3D.Content>
</ModelVisual3D>

<ModelVisual3D>
<ModelVisual3D.Content>
<AmbientLight Color="Yellow" />
</ModelVisual3D.Content>
</ModelVisual3D>


</Viewport3D>

<Rectangle Stroke="#FF000000" HorizontalAlignment="Left"
VerticalAlignment="Stretch" Margin="17,20,0,19" Width="283" Height="Auto"
x:Name="Rectangle">
<Rectangle.Fill>
<ImageBrush ImageSource="Images\pic_011.tif" Stretch="None" />

</Rectangle.Fill>

</Rectangle>

Old 10-24-2006   #2 (permalink)
Adam Smith [MS]
Guest


 

Re: ImageBrush & 3D

To use any Material other than a SolidColorBrush you will need to provide
texture coordinates for each of your vertices. These allow us to map out
the topology of the 2d surface of your mesh when we apply the material. In
your example below, you might want TextureCoordinates="0,1 0,0 1,1 1,0".

-Adam Smith [MS]

"John" <lorenzen_j@hotmail.com> wrote in message
news:2156E3F9-8BF8-4689-92E8-760070955366@microsoft.com...
>I can't get my viewport3d to display the content of my image brush the
>image brush does work on the rectangle but not in my 3D viewport. Here is
>the XAML what am I doing wrong?
>
> <Viewport3D Margin="0,34,24,33" x:Name="Viewport3D"
> HorizontalAlignment="Right" Width="288">
> <Viewport3D.Camera>
> <PerspectiveCamera x:Name="OrthographicCamera" FieldOfView="45"
> Position="0,0.5,3" LookDirection="0,0,-1" UpDirection="0,1,0"
> NearPlaneDistance="0.125" FarPlaneDistance="Infinity">
> <PerspectiveCamera.Transform>
> <Transform3DGroup>
> <TranslateTransform3D OffsetZ="0" OffsetY="0" OffsetX="0"/>
> <ScaleTransform3D ScaleX="1" ScaleY="1" ScaleZ="1"/>
> <RotateTransform3D d:EulerAngles="0,0,0"/>
> <TranslateTransform3D OffsetZ="0" OffsetY="0" OffsetX="0"/>
> <TranslateTransform3D OffsetZ="0" OffsetY="0" OffsetX="0"/>
> </Transform3DGroup>
> </PerspectiveCamera.Transform>
> </PerspectiveCamera>
> </Viewport3D.Camera>
>
>
> <ModelVisual3D>
> <ModelVisual3D.Content>
> <GeometryModel3D>
> <GeometryModel3D.Geometry>
> <MeshGeometry3D Positions="0 0 0, 0 1 0, 1 0 0, 1 1
> 0"
> TriangleIndices="0 2 3, 0 3 1" />
> </GeometryModel3D.Geometry>
>
> <GeometryModel3D.Material>
> <DiffuseMaterial>
> <DiffuseMaterial.Brush>
> <ImageBrush ImageSource="Images\pic_011.tif" Stretch="Fill"/>
> </DiffuseMaterial.Brush>
> </DiffuseMaterial>
> </GeometryModel3D.Material>
>
> <GeometryModel3D.BackMaterial>
> <DiffuseMaterial Brush="Blue" />
> </GeometryModel3D.BackMaterial>
>
> </GeometryModel3D>
> </ModelVisual3D.Content>
> </ModelVisual3D>
>
> <ModelVisual3D>
> <ModelVisual3D.Content>
> <AmbientLight Color="Yellow" />
> </ModelVisual3D.Content>
> </ModelVisual3D>
>
>
> </Viewport3D>
>
> <Rectangle Stroke="#FF000000" HorizontalAlignment="Left"
> VerticalAlignment="Stretch" Margin="17,20,0,19" Width="283" Height="Auto"
> x:Name="Rectangle">
> <Rectangle.Fill>
> <ImageBrush ImageSource="Images\pic_011.tif" Stretch="None" />
>
> </Rectangle.Fill>
>
> </Rectangle>



Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Binding an ImageBrush Problem star-italia .NET General 5 06-13-2008 02:36 AM
Creating an BitmapImage from an ImageBrush? scott.browse@gmail.com Avalon 0 08-13-2007 05:46 PM
ImageBrush Bugs? HolaMan Avalon 3 04-17-2006 11:26 AM
ImageBrush Tiling Kevin Hoffman Avalon 2 03-03-2006 10:26 PM
ImageBrush TileMode not working? Corrado Cavalli [MVP] Avalon 3 01-10-2006 03:52 PM








Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50