Can ScreenSpaceLines3D work with OrthographicCamera?

Topics: Developer Forum
Jul 30, 2008 at 1:56 AM
It always display nothing when I try to use OrthographicCamera.

<Window x:Class="Test.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:tool3d="clr-namespace:_3DTools;assembly=3DTools"
    Title="Window1" Height="463" Width="679">
    <Grid>
        <Viewport3D>
            <Viewport3D.Camera>
                <OrthographicCamera Position="1,1,1" LookDirection="-1,-1,-1" UpDirection="0,1,0" Width="20"/>
            </Viewport3D.Camera>
            <tool3d:ScreenSpaceLines3D Points="0,0,-6 0,0,6" Color="Red" Thickness="2"/>
            <tool3d:ScreenSpaceLines3D Points="-6,0,0 6,0,0" Color="Red" Thickness="2"/>
        </Viewport3D>
    </Grid>
</Window>

Is it because I didnot set up the camera well or the ScreenSpaceLines3D cannot work with OrthographicCamera?
I searched many samples, but it seems that all of them are using PerspectiveCamera.

Thanks for your help.

Aug 28, 2009 at 1:39 PM

Simple solution is to set the FarPlaneDistance of the camera. For example to some very large number.

 

By default, the FarPlaneDistance is infinity, which causes an error in MathUtils.GetProjectionMatrix for the OrthographicCamera.

Feb 29, 2012 at 3:07 PM

Thanks alot, Joozt