I have been trying to use the FarPlaneDistance property for a FirstPersonCamera, but the clipping doesn't occur and the FarPlanceDistance value never holds. I have seen in another thread that I may need to set OptimizeNearAndFarCameraPlanes to false on my scene object ... but I don't have a scene object. Is there something I need to disable or do in a specific way to get the FarPlaneDistance to "take"? I am using a WPFHost inside a Winforms application, if that makes a difference.
Thanks, Will.
You are right, the DXEngine automatically calculates the near and far plane distances so that they are as close together as possible. This increases the depth resolution and minimizes the z-fighting artifacts. Anyway, if you want to manually control the near and far plane values, you need to set the OptimizeNearAndFarCameraPlanes to false (this is a property on th DXScene object).
If you are using DXViewportView, then you can get the DXScene from its DXScene property. The property is set when the DirectX device is initialized - you can subscribe DXSceneDeviceCreated event to be notified when this happens:
Code:
_dxViewportView.DXSceneDeviceCreated += delegate(object sender, EventArgs args)
{
if (_dxViewportView.DXScene != null) // Can be null in WPF 3D rendering (used as fallback by default)
_dxViewportView.DXScene.OptimizeNearAndFarCameraPlanes = false;
};