Sign in to follow this  
allecsro

Hide scene edges using fog

Recommended Posts

I have a large outdoor scene, and I want its edges to be hidden(blurred). I've tried setting up fog, but it applies to all the scene, and so the sky is also obscured.Am I doing this right(by using fog), or is there a better way? Here is the code I use to set up fog :
 float Start   = 0.5f;
 float End     = 0.8f;
 float Density = 0.10f;

 D3DDevice->SetRenderState(D3DRS_FOGENABLE, TRUE);
 D3DDevice->SetRenderState(D3DRS_FOGCOLOR,  0x00FFFFFF);
 D3DDevice->SetRenderState(D3DRS_FOGSTART,  *(DWORD*)&Start);
 D3DDevice->SetRenderState(D3DRS_FOGEND,    *(DWORD*)&End);
 D3DDevice->SetRenderState(D3DRS_FOGDENSITY,*(DWORD*)&Density);

 D3DDevice->SetRenderState(D3DRS_FOGTABLEMODE,D3DFOG_EXP2);
 D3DDevice->SetRenderState(D3DRS_FOGVERTEXMODE,D3DFOG_NONE);
 D3DDevice->SetRenderState(D3DRS_RANGEFOGENABLE,false);
 

Share this post


Link to post
Share on other sites
Unfortunately that often looks very odd, as the sky stands out clearly and contrasts sharply to the rest of the scene, rather then blending nicely into the 'background'. Perhaps a way around this would be to render the sky with fogging on, however reduce the fogging levels whilst rendering the sky? This certainly isn't technically correct, but it may work for what you want to achieve.

I too have been looking for a way to get the balance between fog and visibility of the sky 'just right'.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this