Jump to content
  • Advertisement
Sign in to follow this  
J-Fox

TextureStageStates for selfmade Vertexfog

This topic is 3849 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

Hey, I wrote my own code for vertexfog which returns the fogamount for each vertex [0;1] and by that I get the vertexcolor. Now I ran into problems with white fog. DirectX will use a diffusecolor of &H000000 for a black object and &HFFFFFF for a fully textured object. I need it to be like this: 0,0,0 = Full black 127,127,127 = Full texture 255,255,255 = Full white Without vertex or pixelshaders though. (DirectX8)

Share this post


Link to post
Share on other sites
Advertisement
Try this instead:

Set D3DRS_TEXTUREFACTOR to fog color (ie: white = 0xFFFFFFFF).
Set diffuse alpha to fog amount (0-255). Your diffuse color can be whatever you want. If you don't want diffuse colors you can set it to white, or put the fog color in here instead.

In stage 0 do the regular MODULATE, TEXTURE, DIFFUSE.
In stage 1 do BLENDDIFFUSEALPHA, CURRENT, TFACTOR, which will lerp between textured/lit and fog based on your fog amount.

Since you're not using vertex shaders you must be modifying each vertex whenever the fog amount changes... every frame when you're moving. Ouch! Do you realize D3D has an optimized path for software vertex shader support. You can use SM2 vertex shaders mixed with fixed pipe pixel processing on any DX9 compatible card (ie: DX7 hardware or later).

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!