Jump to content
  • Advertisement
Sign in to follow this  
synth_cat

which caps to check for table/vertex fog?

This topic is 3934 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 am trying to add fixed function fog to my game. The problem is that I am currently using a rather cheap rental computer with a somewhat flaky video card. On this card, when I turn on vertex fog or table fog, both are 100% dense (you can't see through them) unless they are in D3DFOG_EXP mode with density set to below 0.01 (which is far lower than I should have to go, if the D3D docs are correct.) I want my users to be able to have fog enabled for my game. 1) What is the cap in D3DCAPS9 which indicates if vertex fog is supported? What about the one for table fog? I just looked through the docs and there do not seem to be any flags directly concerned with whether or not these kinds of fog actually work or not. 2) What are some good values for fog density/start/end? Since this video card handles fog so badly, I have no way of determining what a good setup should be. Thanks! Greg [Edited by - synth_cat on October 12, 2007 3:05:33 PM]

Share this post


Link to post
Share on other sites
Advertisement
D3DFOG_EXP mode with density set to below 0.01 (which is far lower than I should have to go, if the D3D docs are correct.)

*****

No, the equation is based on absolute distance from viewer not relative distance to clip plane, so the density parameter you need to use is completely different depending on the scale of your scene. Im using 0.001 in my scene which gets dark around 2000 units away. If you have a graphing calculator you can just graph the equation, its easier to see the difference explicitly in a plot. I found that the D3DFOG_EXP2 works best.

Share this post


Link to post
Share on other sites
OK, thanks for explaining that - now I understand why I had to use such low values.


I'm still a bit confused about which caps I need to check on a user's system.

Here are the only fog-relevant caps I was able to find in D3DCAPS9:

In RasterCaps:

- D3DPRASTERCAPS_FOGRANGE
- D3DPRASTERCAPS_FOGTABLE
- D3DPRASTERCAPS_FOGVERTEX
- D3DPRASTERCAPS_ZFOG
- D3DPRASTERCAPS_WFOG

In ShadeCaps:

- D3DPSHADECAPS_FOGGOURAUD

In LineCaps:

- D3DLINECAPS_FOG


Let's say I just want to use table fog on a user's machine. Does this look OK to completely verify that table fog will work?


if(caps9.RasterCaps & D3DPRASTERCAPS_FOGTABLE)
{
if((caps9.RasterCaps & D3DPRASTERCAPS_WFOG)
|| (caps9.RasterCaps & D3DPRASTERCAPS_ZFOG))
{
//all is good
enable_tablefog=true;
}
}



Does this next snippet look OK to completely verify that vertex fog will work?

if(caps9.RasterCaps & D3DPRASTERCAPS_FOGVERTEX)
{
if((caps9.RasterCaps & D3DPRASTERCAPS_FOGRANGE)
&& (caps9.ShadeCaps & D3DPSHADECAPS_FOGGOURAUD))
{
//all is good
enable_vertexfog=true;
}
}


In the second snippet, is it really necessary to check the FOGRANGE cap? It doesn't seem as if range fog is necessary to make vertex fog work.

Anyway, please tell me if I've set up the caps-checking correctly for this stuff. Have I left anything out? I have a feeling there should be a more general cap like FOGSUPPORTED which would automatically tell if any kind of fixed-func fog were supported at all, but I can find no such thing in the docs.

Share this post


Link to post
Share on other sites
I just went over the docs you sent me - they were very informative. Thanks a lot!

So am I correct to say that I do _not_ need to check the D3DPRASTERCAPS_FOGRANGE bit just to use basic vertex fog?

Also, your pipeline does not mention the D3DPSHADECAPS_FOGGOURAUD bit in the Vertex Fog section. So am I also correct to assume that I do not need to check this either?

I have another question about the table fog checking code:

if(caps9.RasterCaps & D3DPRASTERCAPS_FOGTABLE)
{
if((caps9.RasterCaps & D3DPRASTERCAPS_WFOG)
|| (caps9.RasterCaps & D3DPRASTERCAPS_ZFOG))
{
//all is good
enable_tablefog=true;
}
}


Is the second if statement redundant? Does the D3DPRASTERCAPS_FOGTABLE bit automatically mean that either W or Z fog is enabled?

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!