Cannot compute wNear and wFar from projection matrix

Posted by DeadMG on Game Development See other posts from Game Development or by DeadMG
Published on 2012-03-31T13:24:43Z Indexed on 2012/03/31 17:45 UTC
Read the original article Hit count: 374

Filed under:
|

I've got the following error from Direct3D when attempting to render in 3D:

Direct3D9: (WARN) :Cannot compute WNear and WFar from the supplied projection matrix

Direct3D9: (WARN) :Setting wNear to 0.0 and wFar to 1.0

My projection matrix is as follows:

D3DXMatrixPerspectiveFovLH(
    &Projection,
    D3DXToRadian(90),
    (float)GetDimensions().x / (float)GetDimensions().y,
    NearPlane,
    FarPlane
);
D3DCALL(device->SetTransform(
    D3DTS_PROJECTION,
    &Projection
));

The NearPlane is 0.1f, the FarPlane is 40.0f, and the dimensions are 1920x1018. This code was working earlier but I appear to have broken it, and I'm not sure where the fault is. Previously I've only encountered it if NearPlane was 0, and Google hasn't suggested any other causes either. Any suggestions?

© Game Development or respective owner

Related posts about c++

Related posts about directx9