• Advertisement
Sign in to follow this  

Blending and disappearing

This topic is 3639 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. I'm writing a little lens flare routine using dx9. It works but it has an ugly behaviour when the light reaches the border of the screen.. it's an on-off behaviour.. if light is visible, then show the artifacts, else not. I don't like it very much, i prefer a sort of "trigger", so when i'm near the border, the artifacts become less and less shiny until they disappears. Now, i think i can do it using blending equation. col = source * blending + dest * 1; blending at center of the screen is 1, and near to the borders becomes <1, until it reaches 0 when the lights cross the border. But how can i do it? pD3dDevice->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_ONE); pD3dDevice->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_ONE); for the center, but i've not found a way to give a variable blending factor < 1 for the source. any idea? Thanks

Share this post


Link to post
Share on other sites
Advertisement

if you use src=ONE and dst=ONE, you're using additive blending, so, what you have to do is "darken" the source texture before blending it to the destination; a good way to do it is to set the diffuse color of your texture unit to the blend factor you want.

Share this post


Link to post
Share on other sites
Quote:
Original post by vicviper

if you use src=ONE and dst=ONE, you're using additive blending, so, what you have to do is "darken" the source texture before blending it to the destination; a good way to do it is to set the diffuse color of your texture unit to the blend factor you want.


ok, but the blend factor is variable, i've to change the texture every frame?

Share this post


Link to post
Share on other sites
Quote:
Original post by vicviper

if you use src=ONE and dst=ONE, you're using additive blending, so, what you have to do is "darken" the source texture before blending it to the destination; a good way to do it is to set the diffuse color of your texture unit to the blend factor you want.


Ok, i'm stupid :)
I've only to change the draw parameter, not all the texture, bit by bit.
thank you, it works.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement