Archived

This topic is now archived and is closed to further replies.

peter86

Viewing distance problem

Recommended Posts

I''m trying to set the viewing distance further away, but no matter what I put in for the far viewing plane in the D3DXMatrixPerspectiveFovLH function it''s still around 60. I can decrease it but I cannot increase it. Anyone know why?

Share this post


Link to post
Share on other sites
I use this code to change the view distance.


BOOL RenderRange(FLOAT fRange)
{
// Initialise Projection Matrix
D3DXMATRIX matProj;
D3DXMatrixPerspectiveFovLH(&matProj, D3DX_PI/4, 1.0f,1.0f, fRange);

// Attempt To Change Viewport Range
HRESULT hr = pDevice->SetTransform( D3DTS_PROJECTION,
&matProj);

if (FAILED(hr))
return FALSE;

return TRUE;
}


Check that you are putting the range in the correct parameter. If this still doesnt work then can you send info on how you are setting up the view projection, I have noticed some really weird effects looking backwars instead of forwards when using LookAt functions.

[edited by - MatthewEva on November 14, 2003 10:44:58 AM]

[edited by - MatthewEva on November 14, 2003 10:45:44 AM]

Share this post


Link to post
Share on other sites
This is unrelated to your problem, but why do you set 1.0f for the third parameter ? If your window is not square (windowed or fullscreen) it would be better to set it to (width/height), usually 1.25f or 1.333f.

Share this post


Link to post
Share on other sites
Here''s the code:

D3DXMATRIX matProj;
D3DXMatrixPerspectiveFovLH( &matProj, D3DX_PI/4, 1.0f, 1.0f, 200.0f );
g_pd3dDevice->SetTransform( D3DTS_PROJECTION, &matProj );

I can''t see anything wrong with it, can you?

Share this post


Link to post
Share on other sites
Not that stupid though. I looked for ''D3DTS_PROJECTION'' in other files, but I didn''t find anything so I started to look up the rendering function and found out that the skybox is always 50 units away from the camera, hiding things further away.

Share this post


Link to post
Share on other sites