Viewing distance problem

Started by
5 comments, last by peter86 20 years, 5 months ago
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?
Advertisement
Please post some of your code... makes it easier for us to help you
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]
#ifndef _DIRECTX PostQuitMessage(0);#endif
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.
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?
It''s going to sound stupid, but...

Do a ''find in files'' for ''D3DTS_PROJECTION'' and make sure you''re not setting it anywhere else in your project that you forgot about.
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.

This topic is closed to new replies.

Advertisement