HellBlazer13
04-12-2004, 12:41 PM
How would I go about implementing fog in a Direct X 8 2D engine? I've attempted this twice now, but my textures just become the same color as the fog color, so you can't see the actual image.
Fog?HellBlazer13 04-12-2004, 12:41 PM How would I go about implementing fog in a Direct X 8 2D engine? I've attempted this twice now, but my textures just become the same color as the fog color, so you can't see the actual image. mark113 04-16-2004, 04:49 PM I have used this for spellcasting effects. It is easy to implement and draws really fast. Try something like this in your RenderScene function. vObjD3DDevNC.SetRenderState D3DRS_ALPHABLENDENABLE, 1 for i = 1 to SpriteCount If SpriteArray(i).Transparent = 0 Then vObjD3DDevNC.SetRenderState D3DRS_SRCBLEND, 5 vObjD3DDevNC.SetRenderState D3DRS_DESTBLEND, 6 ElseIf SpriteArray(i).Transparent = 1 Then vObjD3DDevNC.SetRenderState D3DRS_SRCBLEND, 5 vObjD3DDevNC.SetRenderState D3DRS_DESTBLEND, 7 End If vObjD3DDevNC.SetTexture 0, TextureArray.fGetTextureArray(x).Texture next i vObjD3DDevNC.SetRenderState D3DRS_ALPHABLENDENABLE, 0 vObjD3DDevNC.EndScene vObjD3DDevNC.Present ByVal 0, ByVal 0, 0, ByVal 0 As I go through my sprite array I read if I want the sprite tobe rendered solid or transparent and change the renderstate back and forth within he Renderscene function. You will need to order the solid, ground level sprites first. Then the transparent fog sprites should be at the end of the array. This just sort of blends the two colors. |
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum