none
Viewport2DVisual3D

    Question

  •  

    Hey gang.

     

    I am new to 3D in general and WPF/WPF3D as well. I am looking to make some interfaces that have slight 3D integration with them.

     

    I have read about the Viewport2DVisual3D additions in 3.5 and I am interested in how this will work with models I export from Lightwave. The only example I can seem to find is:

     

    <Viewport2DVisual3D x:Name="vp2d_multiple_children" Geometry="{StaticResource mesh}">

                <Viewport2DVisual3D.Material>

                            <DiffuseMaterial Viewport2DVisual3D.IsVisualHostMaterial="True" Brush="White"/>

                </Viewport2DVisual3D.Material>

                <TextBox />

      </Viewport2DVisual3D>

    However this TextBox seems to be outside of the material correct? So if I have a mesh with several surfaces how do I put 2D elements onto one of those surfaces using Viewport2DVisual3D or is that possible?

     

    Also question #2. How can I have my designer design the XAML in Blend etc and simply map this onto the 3D surface without having to contruct all the UI he designed via code instead. I rather take what he has designed (perhaps a seperate XAML file?) and import it somehow?

     

    I love the Blend & VS work flow but for things like this and 3D I am pretty confused.

     

    Any help would be greatly appreciated.

     

    Thanks and take care.

    Thursday, December 20, 2007 6:54 PM

Answers

  • I've created a sample based on the code posted by Charles Petzold in another thread:

    Code Block
    <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <
    Page.Resources>
    <
    MeshGeometry3D x:Key="plane1" Normals="0,-1,0 0,-1,0 0,-1,0 0,-1,0" Positions="-0.5,0,0.5 0.5,0,-0.5 0.5,0,0.5 -0.5,0,-0.5" TextureCoordinates="0,1 1,0 1,1 0,0" TriangleIndices="0 1 2 1 0 3"/>
    <
    MeshGeometry3D x:Key="plane2" Normals="0,0,1 0,0,1 0,0,1 0,0,1" Positions="-0.5,0,0.5 0.5,0,0.5 0.5,1,0.5 -0.5,1,0.5" TextureCoordinates="0,1 1,1 1,0 0,0" TriangleIndices="0 1 2 2 3 0"/>
    <
    MeshGeometry3D x:Key="plane3" Normals="0,0,-1 0,0,-1 0,0,-1 0,0,-1" Positions="-0.5,0,-0.5 0.5,1,-0.5 0.5,0,-0.5 -0.5,1,-0.5" TextureCoordinates="0,1 1,0 1,1 0,0" TriangleIndices="0 1 2 1 0 3"/>
    <
    MeshGeometry3D x:Key="plane4" Normals="1,0,0 1,0,0 1,0,0 1,0,0" Positions="0.5,0,0.5 0.5,0,-0.5 0.5,1,-0.5 0.5,1,0.5" TextureCoordinates="0,1 1,1 1,0 0,0" TriangleIndices="0 1 2 2 3 0"/>
    <
    MeshGeometry3D x:Key="plane5" Normals="-1,0,0 -1,0,0 -1,0,0 -1,0,0" Positions="-0.5,0,0.5 -0.5,1,-0.5 -0.5,0,-0.5 -0.5,1,0.5" TextureCoordinates="0,1 1,0 1,1 0,0" TriangleIndices="0 1 2 1 0 3"/>
    <
    MeshGeometry3D x:Key="plane6" Normals="0,1,0 0,1,0 0,1,0 0,1,0" Positions="-0.5,1,0.5 0.5,1,0.5 0.5,1,-0.5 -0.5,1,-0.5" TextureCoordinates="0,1 1,1 1,0 0,0" TriangleIndices="0 1 2 2 3 0"/>
    </
    Page.Resources>
    <
    DockPanel>
    <
    ScrollBar Name="horz" DockPanel.Dock="Bottom" Orientation="Horizontal"
    Minimum="-180" Maximum="180"
    LargeChange="10" SmallChange="1" />

    <
    ScrollBar Name="vert" DockPanel.Dock="Right" Orientation="Vertical"
    Minimum="-180" Maximum="180"
    LargeChange="10" SmallChange="1" />

    <
    Viewport3D>
    <
    ModelVisual3D>
    <
    Viewport2DVisual3D Geometry="{StaticResource plane1}" x:Name="plane1">
    <
    Viewport2DVisual3D.Material>
    <
    DiffuseMaterial Viewport2DVisual3D.IsVisualHostMaterial="True" Brush="White"/>
    </
    Viewport2DVisual3D.Material>
    <
    Viewport2DVisual3D.Visual>
    <
    Border Background="Green" BorderBrush="Black" BorderThickness="1">
    <
    Button Width="200" Height="30" Content="This is plane1"/>
    </
    Border>
    </
    Viewport2DVisual3D.Visual>
    </
    Viewport2DVisual3D>

    <
    Viewport2DVisual3D Geometry="{StaticResource plane2}" x:Name="plane2">
    <
    Viewport2DVisual3D.Material>
    <
    DiffuseMaterial Viewport2DVisual3D.IsVisualHostMaterial="True" Brush="White"/>
    </
    Viewport2DVisual3D.Material>
    <
    Viewport2DVisual3D.Visual>
    <
    Border Background="Yellow" BorderBrush="Black" BorderThickness="1">
    <
    Button Width="200" Height="30" Content="This is plane2"/>
    </
    Border>
    </
    Viewport2DVisual3D.Visual>
    </
    Viewport2DVisual3D>

    <
    Viewport2DVisual3D Geometry="{StaticResource plane3}" x:Name="plane3">
    <
    Viewport2DVisual3D.Material>
    <
    DiffuseMaterial Viewport2DVisual3D.IsVisualHostMaterial="True" Brush="White"/>
    </
    Viewport2DVisual3D.Material>
    <
    Viewport2DVisual3D.Visual>
    <
    Border Background="Blue" BorderBrush="Black" BorderThickness="1">
    <
    Button Width="200" Height="30" Content="This is plane3"/>
    </
    Border>
    </
    Viewport2DVisual3D.Visual>
    </
    Viewport2DVisual3D>

    <
    Viewport2DVisual3D Geometry="{StaticResource plane4}" x:Name="plane4">
    <
    Viewport2DVisual3D.Material>
    <
    DiffuseMaterial Viewport2DVisual3D.IsVisualHostMaterial="True" Brush="White"/>
    </
    Viewport2DVisual3D.Material>
    <
    Viewport2DVisual3D.Visual>
    <
    Border Background="Red" BorderBrush="Black" BorderThickness="1">
    <
    Button Width="200" Height="30" Content="This is plane4"/>
    </
    Border>
    </
    Viewport2DVisual3D.Visual>
    </
    Viewport2DVisual3D>

    <
    Viewport2DVisual3D Geometry="{StaticResource plane5}" x:Name="plane5">
    <
    Viewport2DVisual3D.Material>
    <
    DiffuseMaterial Viewport2DVisual3D.IsVisualHostMaterial="True" Brush="White"/>
    </
    Viewport2DVisual3D.Material>
    <
    Viewport2DVisual3D.Visual>
    <
    Border Background="Purple" BorderBrush="Black" BorderThickness="1">
    <
    Button Width="200" Height="30" Content="This is plane5"/>
    </
    Border>
    </
    Viewport2DVisual3D.Visual>
    </
    Viewport2DVisual3D>

    <
    Viewport2DVisual3D Geometry="{StaticResource plane6}" x:Name="plane6">
    <
    Viewport2DVisual3D.Material>
    <
    DiffuseMaterial Viewport2DVisual3D.IsVisualHostMaterial="True" Brush="White"/>
    </
    Viewport2DVisual3D.Material>
    <
    Viewport2DVisual3D.Visual>
    <
    Border Background="Magenta" BorderBrush="Black" BorderThickness="1">
    <
    Button Width="200" Height="30" Content="This is plane6"/>
    </
    Border>
    </
    Viewport2DVisual3D.Visual>
    </
    Viewport2DVisual3D>
    <
    ModelVisual3D.Transform>
    <
    Transform3DGroup>
    <
    RotateTransform3D>
    <
    RotateTransform3D.Rotation>
    <
    AxisAngleRotation3D Axis="0 1 0"
    Angle="{Binding ElementName=horz,
    Path=Value}" />
    </RotateTransform3D.Rotation>
    </
    RotateTransform3D>
    <
    RotateTransform3D>
    <
    RotateTransform3D.Rotation>
    <
    AxisAngleRotation3D Axis="1 0 0"
    Angle="{Binding ElementName=vert,
    Path=Value}" />
    </RotateTransform3D.Rotation>
    </
    RotateTransform3D>
    </
    Transform3DGroup>
    </
    ModelVisual3D.Transform>
    </
    ModelVisual3D>

    <!-- Light source. -->
    <ModelVisual3D>
    <
    ModelVisual3D.Content>
    <
    AmbientLight Color="White" />
    </
    ModelVisual3D.Content>
    </
    ModelVisual3D>

    <!-- Camera. -->
    <Viewport3D.Camera>
    <
    PerspectiveCamera Position="-2 2 4"
    LookDirection="2 -2 -4"
    UpDirection="0 1 0"
    FieldOfView="30"/>
    </
    Viewport3D.Camera>
    </
    Viewport3D>
    </
    DockPanel>
    </
    Page
    >

    Hope this helps
    Monday, December 24, 2007 7:34 AM

All replies

  • It's outside of the Material from the standpoint that it's actually in the Visual tree, yes. When you set IsVisualHostMaterial to true on a Material, we ignore its Brush and swap in a VisualBrush containing the Visuals.

     

    I don't know anything about Blend's Viewport2DVisual3D support. The easiest thing I can think of off the top of my head is have the designer design the UI in 2D somewhere and give the root element a name. Then you can bind Viewport2DVisual3D.Visual to that name. A completely separate XAML file works too.

     

    Could you be more specific about your "several surfaces" scenario? Are you talking about using a MaterialGroup? If so, just set the IsVisualHostMaterial to true on the one Material you want to determine the lighting of the Visual.

     

    Thursday, December 20, 2007 10:15 PM
  •  

    Sure. I played around with 3DTools implementation of the similiar feature set they created for WPF included in .NET 3.0 which allowed you to map visuals to actual surfaces.

     

    Which means if I have a mesh I created in a 3D modeller application, I could attach 2D UI elements to a specific surface on the mesh.

     

    Not to be ranting but I am finding WPF getting more and more complicated in inuitive ways in comparison to older .NET technologies. The API seems to just be getting less and less clear and concise when you are trying to learn these things. Older API was much simpler and very clear by the naming of things etc. Anyways just wanted to explain how learning WPF is definately more difficult than learning Winforms. I can understand this however in many times I am thinking to myself this seems way more complicated than it needs to be.

     

    Anyways this aside lets continue.

     

    I have a mesh I created in a modeller. It is a CUBE which I applied a seperate surface to each of the 6 sides and the XAML looks as so:

     

    Code Block

    <Model3DGroup x:Name="object">

    <Model3DGroup x:Name="object1">

    <GeometryModel3D x:Name="object1_part0">

    <GeometryModel3D.Geometry>

    <MeshGeometry3D Positions="-3,1,-1 3,1,-1 3,-1,-1 -3,-1,-1" TriangleIndices="0,1,2 0,2,3" Normals="0,0,-1 0,0,-1 0,0,-1 0,0,-1" TextureCoordinates="" />

    </GeometryModel3D.Geometry>

    <GeometryModel3D.Material>

    <MaterialGroup>

    <DiffuseMaterial>

    <DiffuseMaterial.Brush>

    <SolidColorBrush x:Name="Bottom_Diffuse_object1_part0" Color="#008000" Opacity="1" />

    </DiffuseMaterial.Brush>

    </DiffuseMaterial>

    </MaterialGroup>

    </GeometryModel3D.Material>

    </GeometryModel3D>

    <GeometryModel3D x:Name="object1_part1">

    <GeometryModel3D.Geometry>

    <MeshGeometry3D Positions="3,-1,-1 3,-1,1 -3,-1,1 -3,-1,-1" TriangleIndices="0,1,2 0,2,3" Normals="0,-1,0 0,-1,0 0,-1,0 0,-1,0" TextureCoordinates="" />

    </GeometryModel3D.Geometry>

    <GeometryModel3D.Material>

    <MaterialGroup>

    <DiffuseMaterial>

    <DiffuseMaterial.Brush>

    <SolidColorBrush x:Name="Front_Diffuse_object1_part1" Color="#0000FF" Opacity="1" />

    </DiffuseMaterial.Brush>

    </DiffuseMaterial>

    </MaterialGroup>

    </GeometryModel3D.Material>

    </GeometryModel3D>

    <GeometryModel3D x:Name="object1_part2">

    <GeometryModel3D.Geometry>

    <MeshGeometry3D Positions="3,1,-1 3,-1,1 3,-1,-1 3,1,1" TriangleIndices="0,1,2 0,3,1" Normals="1,0,0 1,0,0 1,0,0 1,0,0" TextureCoordinates="" />

    </GeometryModel3D.Geometry>

    <GeometryModel3D.Material>

    <MaterialGroup>

    <DiffuseMaterial>

    <DiffuseMaterial.Brush>

    <SolidColorBrush x:Name="Right_Diffuse_object1_part2" Color="#FF0000" Opacity="1" />

    </DiffuseMaterial.Brush>

    </DiffuseMaterial>

    </MaterialGroup>

    </GeometryModel3D.Material>

    </GeometryModel3D>

    <GeometryModel3D x:Name="object1_part3">

    <GeometryModel3D.Geometry>

    <MeshGeometry3D Positions="-3,1,1 3,1,-1 -3,1,-1 3,1,1" TriangleIndices="0,1,2 0,3,1" Normals="0,1,0 0,1,0 0,1,0 0,1,0" TextureCoordinates="" />

    </GeometryModel3D.Geometry>

    <GeometryModel3D.Material>

    <MaterialGroup>

    <DiffuseMaterial>

    <DiffuseMaterial.Brush>

    <SolidColorBrush x:Name="Back_Diffuse_object1_part3" Color="#0000FF" Opacity="1" />

    </DiffuseMaterial.Brush>

    </DiffuseMaterial>

    </MaterialGroup>

    </GeometryModel3D.Material>

    </GeometryModel3D>

    <GeometryModel3D x:Name="object1_part4">

    <GeometryModel3D.Geometry>

    <MeshGeometry3D Positions="-3,-1,1 -3,1,-1 -3,-1,-1 -3,1,1" TriangleIndices="0,1,2 0,3,1" Normals="-1,0,0 -1,0,0 -1,0,0 -1,0,0" TextureCoordinates="" />

    </GeometryModel3D.Geometry>

    <GeometryModel3D.Material>

    <MaterialGroup>

    <DiffuseMaterial>

    <DiffuseMaterial.Brush>

    <SolidColorBrush x:Name="Left_Diffuse_object1_part4" Color="#FF0000" Opacity="1" />

    </DiffuseMaterial.Brush>

    </DiffuseMaterial>

    </MaterialGroup>

    </GeometryModel3D.Material>

    </GeometryModel3D>

    <GeometryModel3D x:Name="object1_part5">

    <GeometryModel3D.Geometry>

    <MeshGeometry3D Positions="3,-1,1 -3,1,1 -3,-1,1 3,1,1" TriangleIndices="0,1,2 0,3,1" Normals="0,0,1 0,0,1 0,0,1 0,0,1" TextureCoordinates="" />

    </GeometryModel3D.Geometry>

    <GeometryModel3D.Material>

    <MaterialGroup>

    <DiffuseMaterial>

    <DiffuseMaterial.Brush>

    <SolidColorBrush x:Name="Top_Diffuse_object1_part5" Color="#008000" Opacity="1" />

    </DiffuseMaterial.Brush>

    </DiffuseMaterial>

    </MaterialGroup>

    </GeometryModel3D.Material>

    </GeometryModel3D>

    </Model3DGroup>

    </Model3DGroup>

    </Model3DGroup>

     

     

    So how can I use Viewport2DVisual3D to place a grid, or container on one of these surfaces? From all the examples I see it looks like you have to seperate the MeshGeometry from the ModelGroup3D which isn't very appealing to reusability.

     

    I imagine perhaps I am just missing something. 3DTools implementation was very simple and clear. This is not. I am confused.

     

    Any help would be greatly appreciated!

     

    Thanks and take care.

     

    Monday, December 24, 2007 2:07 AM
  • I've created a sample based on the code posted by Charles Petzold in another thread:

    Code Block
    <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <
    Page.Resources>
    <
    MeshGeometry3D x:Key="plane1" Normals="0,-1,0 0,-1,0 0,-1,0 0,-1,0" Positions="-0.5,0,0.5 0.5,0,-0.5 0.5,0,0.5 -0.5,0,-0.5" TextureCoordinates="0,1 1,0 1,1 0,0" TriangleIndices="0 1 2 1 0 3"/>
    <
    MeshGeometry3D x:Key="plane2" Normals="0,0,1 0,0,1 0,0,1 0,0,1" Positions="-0.5,0,0.5 0.5,0,0.5 0.5,1,0.5 -0.5,1,0.5" TextureCoordinates="0,1 1,1 1,0 0,0" TriangleIndices="0 1 2 2 3 0"/>
    <
    MeshGeometry3D x:Key="plane3" Normals="0,0,-1 0,0,-1 0,0,-1 0,0,-1" Positions="-0.5,0,-0.5 0.5,1,-0.5 0.5,0,-0.5 -0.5,1,-0.5" TextureCoordinates="0,1 1,0 1,1 0,0" TriangleIndices="0 1 2 1 0 3"/>
    <
    MeshGeometry3D x:Key="plane4" Normals="1,0,0 1,0,0 1,0,0 1,0,0" Positions="0.5,0,0.5 0.5,0,-0.5 0.5,1,-0.5 0.5,1,0.5" TextureCoordinates="0,1 1,1 1,0 0,0" TriangleIndices="0 1 2 2 3 0"/>
    <
    MeshGeometry3D x:Key="plane5" Normals="-1,0,0 -1,0,0 -1,0,0 -1,0,0" Positions="-0.5,0,0.5 -0.5,1,-0.5 -0.5,0,-0.5 -0.5,1,0.5" TextureCoordinates="0,1 1,0 1,1 0,0" TriangleIndices="0 1 2 1 0 3"/>
    <
    MeshGeometry3D x:Key="plane6" Normals="0,1,0 0,1,0 0,1,0 0,1,0" Positions="-0.5,1,0.5 0.5,1,0.5 0.5,1,-0.5 -0.5,1,-0.5" TextureCoordinates="0,1 1,1 1,0 0,0" TriangleIndices="0 1 2 2 3 0"/>
    </
    Page.Resources>
    <
    DockPanel>
    <
    ScrollBar Name="horz" DockPanel.Dock="Bottom" Orientation="Horizontal"
    Minimum="-180" Maximum="180"
    LargeChange="10" SmallChange="1" />

    <
    ScrollBar Name="vert" DockPanel.Dock="Right" Orientation="Vertical"
    Minimum="-180" Maximum="180"
    LargeChange="10" SmallChange="1" />

    <
    Viewport3D>
    <
    ModelVisual3D>
    <
    Viewport2DVisual3D Geometry="{StaticResource plane1}" x:Name="plane1">
    <
    Viewport2DVisual3D.Material>
    <
    DiffuseMaterial Viewport2DVisual3D.IsVisualHostMaterial="True" Brush="White"/>
    </
    Viewport2DVisual3D.Material>
    <
    Viewport2DVisual3D.Visual>
    <
    Border Background="Green" BorderBrush="Black" BorderThickness="1">
    <
    Button Width="200" Height="30" Content="This is plane1"/>
    </
    Border>
    </
    Viewport2DVisual3D.Visual>
    </
    Viewport2DVisual3D>

    <
    Viewport2DVisual3D Geometry="{StaticResource plane2}" x:Name="plane2">
    <
    Viewport2DVisual3D.Material>
    <
    DiffuseMaterial Viewport2DVisual3D.IsVisualHostMaterial="True" Brush="White"/>
    </
    Viewport2DVisual3D.Material>
    <
    Viewport2DVisual3D.Visual>
    <
    Border Background="Yellow" BorderBrush="Black" BorderThickness="1">
    <
    Button Width="200" Height="30" Content="This is plane2"/>
    </
    Border>
    </
    Viewport2DVisual3D.Visual>
    </
    Viewport2DVisual3D>

    <
    Viewport2DVisual3D Geometry="{StaticResource plane3}" x:Name="plane3">
    <
    Viewport2DVisual3D.Material>
    <
    DiffuseMaterial Viewport2DVisual3D.IsVisualHostMaterial="True" Brush="White"/>
    </
    Viewport2DVisual3D.Material>
    <
    Viewport2DVisual3D.Visual>
    <
    Border Background="Blue" BorderBrush="Black" BorderThickness="1">
    <
    Button Width="200" Height="30" Content="This is plane3"/>
    </
    Border>
    </
    Viewport2DVisual3D.Visual>
    </
    Viewport2DVisual3D>

    <
    Viewport2DVisual3D Geometry="{StaticResource plane4}" x:Name="plane4">
    <
    Viewport2DVisual3D.Material>
    <
    DiffuseMaterial Viewport2DVisual3D.IsVisualHostMaterial="True" Brush="White"/>
    </
    Viewport2DVisual3D.Material>
    <
    Viewport2DVisual3D.Visual>
    <
    Border Background="Red" BorderBrush="Black" BorderThickness="1">
    <
    Button Width="200" Height="30" Content="This is plane4"/>
    </
    Border>
    </
    Viewport2DVisual3D.Visual>
    </
    Viewport2DVisual3D>

    <
    Viewport2DVisual3D Geometry="{StaticResource plane5}" x:Name="plane5">
    <
    Viewport2DVisual3D.Material>
    <
    DiffuseMaterial Viewport2DVisual3D.IsVisualHostMaterial="True" Brush="White"/>
    </
    Viewport2DVisual3D.Material>
    <
    Viewport2DVisual3D.Visual>
    <
    Border Background="Purple" BorderBrush="Black" BorderThickness="1">
    <
    Button Width="200" Height="30" Content="This is plane5"/>
    </
    Border>
    </
    Viewport2DVisual3D.Visual>
    </
    Viewport2DVisual3D>

    <
    Viewport2DVisual3D Geometry="{StaticResource plane6}" x:Name="plane6">
    <
    Viewport2DVisual3D.Material>
    <
    DiffuseMaterial Viewport2DVisual3D.IsVisualHostMaterial="True" Brush="White"/>
    </
    Viewport2DVisual3D.Material>
    <
    Viewport2DVisual3D.Visual>
    <
    Border Background="Magenta" BorderBrush="Black" BorderThickness="1">
    <
    Button Width="200" Height="30" Content="This is plane6"/>
    </
    Border>
    </
    Viewport2DVisual3D.Visual>
    </
    Viewport2DVisual3D>
    <
    ModelVisual3D.Transform>
    <
    Transform3DGroup>
    <
    RotateTransform3D>
    <
    RotateTransform3D.Rotation>
    <
    AxisAngleRotation3D Axis="0 1 0"
    Angle="{Binding ElementName=horz,
    Path=Value}" />
    </RotateTransform3D.Rotation>
    </
    RotateTransform3D>
    <
    RotateTransform3D>
    <
    RotateTransform3D.Rotation>
    <
    AxisAngleRotation3D Axis="1 0 0"
    Angle="{Binding ElementName=vert,
    Path=Value}" />
    </RotateTransform3D.Rotation>
    </
    RotateTransform3D>
    </
    Transform3DGroup>
    </
    ModelVisual3D.Transform>
    </
    ModelVisual3D>

    <!-- Light source. -->
    <ModelVisual3D>
    <
    ModelVisual3D.Content>
    <
    AmbientLight Color="White" />
    </
    ModelVisual3D.Content>
    </
    ModelVisual3D>

    <!-- Camera. -->
    <Viewport3D.Camera>
    <
    PerspectiveCamera Position="-2 2 4"
    LookDirection="2 -2 -4"
    UpDirection="0 1 0"
    FieldOfView="30"/>
    </
    Viewport3D.Camera>
    </
    Viewport3D>
    </
    DockPanel>
    </
    Page
    >

    Hope this helps
    Monday, December 24, 2007 7:34 AM
  • I think I am still a bit foggy. I am used to dealing with my objects as Model3DGroup because when using complex meshes, the last thing you want to do is split 100 surfaces by hand. Most exporters I have seen export it as a Model3DGroup so that you can easily manipulate the entire object and insert it into your scene as I pasted the XAML above.

     

    So if I want to place 2D visuals onto one specific surface it would seem to me it would be much easier to just reference it by its ID rather than having to split up each geometry like your sample.

     

    Please keep in mind when using scenes with complex meshes the last thing you want to do is hand edit that mesh or 100's of other meshes. Usually I am referencing the group as a whole.

     

    I hope I am making sense. I'm sure its just something I am not catching on.

     

    Any help would be greatly appreciated.

     

    Thanks and take care.

    Monday, January 07, 2008 9:08 PM
  • I am afraid that some manual editing of the exported XAML is still needed if you want to use Viewport2DVisual3D, because Viewport2DVisual3D is paralell with ModelVisual3D in the Visual3D's inheirtance hierarchy, the same as UIElement3D, they are both Visual3D immediate derivatives. So you need to replace the ModelVisual3D with Viewport2DVisual3D, and setting the Viewport2DVisual3D.IsVisualHostMaterial attached property to true to enable the lighting for the 2D visuals contained in Viewport2DVisual3D.

    Hope this helps

    Tuesday, January 08, 2008 6:05 AM
  • Hmm.. So now if I want to rotate etc the entire mesh which is 100 surfaces I have to split them all up and perform the transforms on them seperately? Can these be grouped somehow?

     

    So I hope there is some appreciation on how this really makes things tedious for scenes with 50 some objects which contain 100 some surfaces.

     

    Is this how 3DTools implemented it? I thought I recall it being simpler.

     

    Thanks very much for the help.

    Tuesday, January 08, 2008 2:31 PM
  • Yes, you can group Visual3Ds under other Visual3Ds. Make a ModelVisual3D and then add your Viewport2DVisual3Ds to the Children property. To transform them all, set the ModelVisual3D's Transform.

    It was essentially the same in 3DTools, except Viewport2DVisual3D was called InteractiveVisual3D and you had to put a Interactive3DDecorator around your Viewport3D.
    Wednesday, January 09, 2008 3:04 AM