Jump to content
  • Advertisement

Archived

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

Xeno

Fade In/Out Effect

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

hi, im trying to implement the fade in/out effect using Dx8 Vertex buffers, but it seems to be very sloww coz i have to Lock/Copy/Unlock the vertices data each time im changing the alpha channel value... is there any other way to do it?

Share this post


Link to post
Share on other sites
Advertisement
Yes.. indeed. You can manipulate the gammaramps on your 3d-hardware directly in your code. This is pretty fast, but you are limited to simple fades (like fade to black).

Although I haven''t tried it, it should be possible to implement a fade using maps (like light/dark-mapping(modulating)), without locking/unlocking the vertexbuffer each frame.

Erik

Share this post


Link to post
Share on other sites
You can also use texture stage alpha functions to adjust alpha so you don't have to lock/unlock vertices.


m_pd3dDevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );
m_pd3dDevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA );

m_pd3dDevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_TFACTOR );
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );
m_pd3dDevice->SetRenderState(D3DRS_TEXTUREFACTOR, dwTransparency);


[edited by - nPawn on December 25, 2002 11:38:52 AM]

Share this post


Link to post
Share on other sites
interesting...

alpha argument 2 is set to texture factor, and the alpha operation is set to modulate. then the texture factor is set to something.. gotta try that out

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!