Archived

This topic is now archived and is closed to further replies.

DGates

Problem w/ Fog and CD3DMesh

Recommended Posts

DGates    138
I''m creating an underwater simulation and am using a class very similar to Miscrosoft''s CD3DMesh from their sample framework to load my models. Everything is fine until I turn on fog. Then all I get is the sillouette of the models in the color of the fog. I''ve tried all kinds of different fog settings without it working. Out of curiosity, I also turned on fog in the OptimizedMesh sample and got the same result. I just added this to the RestoreDeviceObjects fcn: m_pd3dDevice->SetRenderState(D3DRS_FOGENABLE, TRUE); m_pd3dDevice->SetRenderState(D3DRS_FOGCOLOR, 0x00004080); So is there a problem with the FVF that the mesh uses or something? I read about projection matrices needing to be in the correct format, etc. and I have Z buffering turned on. I also went through the MFCFog example and tried all the differnet fog setting but nothing is working! Any hints would be much appreciated since I would really like to have fog working with these models. I''m using DXSDK 9.0 if that matters.

Share this post


Link to post
Share on other sites
tok_junior    229
You''re just fogging too much, that''s the only problem.
Fog only fogs the primitives you draw, not the background, to make it seem like it does, clear the backbuffer to the fog-colour instead of black.
Do that, and lower the fog-density, and you should be alright.

--
MFC is sorta like the swedish police... It''''s full of crap, and nothing can communicate with anything else.

Share this post


Link to post
Share on other sites
DGates    138
Thank you thank you thank you!!!

I got it working perfectly by screwing with the start and end distance on linear fog.

Never occurred to me. I just thought I had something wrong with my z-buffer or who knows what else and was scerwing it up.

Again, thank you. Wish I had posted here earlier before I spent 8 hours reading those crappy DX9 docs that just confused me more anyway.

Share this post


Link to post
Share on other sites
tok_junior    229
There''s never any harm in posting here, so don''t bang your head bloody against the code The worst case is noone will answer you, and that rarely happens.
Happy coding

--
MFC is sorta like the swedish police... It''''s full of crap, and nothing can communicate with anything else.

Share this post


Link to post
Share on other sites