Jump to content
  • Advertisement


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


Sprites and VertexFog problem

This topic is 6190 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 have a small 3d demo where I user vertex fog and it works great all by itself. But when I paint a sprite (with alpha) on the screen, all the sprites colors are replaced by the fog color, but that color is blended correctly with the background. When one of my 3d objects pass behind the sprite I can see it, but otherwise it just blend in with the fog background of course. This is how I draw the sprite:
  pd3dxSprite->Draw( m_texture, NULL, NULL, NULL, 0, NULL, 0xFFFFFFFF );
pd3dxSprite is of type LPD3DXSPRITE And this is how I enable fog in my scene:
  // Enable fog blending.

  m_pd3dDevice->SetRenderState(D3DRS_FOGENABLE, TRUE);
  // Set the fog color.

  m_pd3dDevice->SetRenderState(D3DRS_FOGCOLOR, Color);

  // Set fog parameters.

  m_pd3dDevice->SetRenderState(D3DRS_FOGVERTEXMODE, Mode);
  m_pd3dDevice->SetRenderState(D3DRS_FOGSTART, *(DWORD *)(&Start));
  m_pd3dDevice->SetRenderState(D3DRS_FOGEND,   *(DWORD *)(&End));
Again, if I turn off the fog, my sprite works fine, it has correct colors and blends correctly with the background. But when I enable the fogging, all the sprite colors are replaced by the fog color but the sprite blending is still ok. Anyone got any idea where I'm messing up? I'm pretty new to d3d so I might have done a silly mistake here How it looks with only fog enabled How it looks with only the sprite enabled How it looks with both features enabled Thanks Edited by - Starwolf on December 30, 2001 3:35:22 PM

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

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

GameDev.net 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!