Put image in ViewPort3D in wpf

I am having trouble displaying th Image in viewport3d from wpf.

    <Grid>
    <Image Source="G:\Demo\virtualization\virtualization\2.jpg"/>
    <Viewport3D Name="mainViewport" ClipToBounds="True" HorizontalAlignment="Stretch" Height="300">
        <Viewport3D.Camera>
            <PerspectiveCamera 
              LookDirection="0,0,-20"
              UpDirection="0,1,0"
              Position="-40,40,40" 
              />
        </Viewport3D.Camera>
        <Viewport2DVisual3D>
            <Image Source="G:\Demo\virtualization\virtualization\img3.bmp"/>
        </Viewport2DVisual3D>
    </Viewport3D>
</Grid>

Above is the code I'm using. The first image that is behind the 3D viewport is displayed, but the image that is inside the viewport3d is not displayed.

Where am I mistaken?

Please, help!

thank

+3
source share
1 answer

You need stuff. See if pasting this just above the image tag helps:

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

: MSDN. , , : http://msdn.microsoft.com/de-de/library/system.windows.media.media3d.viewport2dvisual3d.aspx

+1

Source: https://habr.com/ru/post/1767153/


All Articles