Advertisement Jump to content
Sign in to follow this  

FFP Pixel Fog - unable to use world coordinates for start/end?

This topic is 4886 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm having a bit of trouble getting the fixed function pipeline fog to work correctly.. I heard that you can specify the linear fog start/end using world coordinates, however I have been unable to do this! right now my fog code looks like:
pd3dDevice->SetRenderState( D3DRS_FOGCOLOR, D3DXCOLOR( 1.0f, 1.0f, 1.0f, 1.0f ) );
pd3dDevice->SetRenderState( D3DRS_FOGTABLEMODE, D3DFOG_LINEAR );
pd3dDevice->SetRenderState( D3DRS_FOGSTART, FtoDW( 0.99f ) );
pd3dDevice->SetRenderState( D3DRS_FOGEND, FtoDW( 1.0f ) );
pd3dDevice->SetRenderState( D3DRS_FOGENABLE, true );

So I have to specify 0.99 - 1.0f to get the fog to appear off in the distance. This doesn't give much control at all and forces me to move the near plane further away to get any sort of far away fog. What I want to do is specify the start/end in world coordinates, but it isn't working! My projection matrix SHOULD be Eye-W compliant (or whatever) as I'm using D3DXMatrixPerspectiveFovLH() to generate it... Has anyone been able to get their linear fog to work using world coordinates? Any thoughts on what I could be doing wrong? [Edited by - kosmon_x on September 2, 2005 7:06:38 PM]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!