Sign in to follow this  

[D3D] Fade out screen (and using sprite interface)

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

Hello, I was wondering if there's a simple methode to fade in/out easily. I read that one can set the alpha value when calling the sprite's draw method but that would be too much work for me since there are collections of objects which do have other objects and finally on a deep level there's the sprite's draw method. Is there a quick way to fade all sprites on the screen? Just like the way of setting the DAC registers in DOS. I'm using the ID3DXSprite interface which may be a little different from standard way of apply such effects (lighting, TL, shading or something like that which can be used when using textures/meshes)? Thanks in advance,

Share this post


Link to post
Share on other sites
You could possibly use the sprite interface for a cheap post-processing effect, but I've not tried it myself so don't know how easy it'd be.

To be honest, just rendering a screen-aligned full-screen quad at the very end of rendering and altering the alpha value (and colour) does the trick and is efficient enough. More importantly the basic framework is essentially that of "post processing" which is definitely a handy feature to include - with guaranteed shader's in D3D10 there are a HUGE number of possibilities here [wink]

hth
Jack

Share this post


Link to post
Share on other sites
Ok, I will have a look on the post-processing you mentioned. Other suggestions are still welcome.

Share this post


Link to post
Share on other sites
I've always done it by rendering a screen sized black quad with varying alpha, much like jollyjeffers suggests.

Share this post


Link to post
Share on other sites
Quote:
Original post by Jerax
I've always done it by rendering a screen sized black quad with varying alpha, much like jollyjeffers suggests.

This is the easy to way to fade in/out but with the restriction that your source or destination image be just a solid color. Fading from one screen to another is probably best done with a custom sprite interface that would allow you to fade them all in/out at once, if you are opposed to using render targets/post processing. Or you can just fade in the 'new stuff' on top of the 'old stuff' and when the new stuff is at 100% opacity just delete the old stuff.

Share this post


Link to post
Share on other sites
Quote:
Original post by MasterWorks
This is the easy to way to fade in/out but with the restriction that your source or destination image be just a solid color.


Quote:
Original post by MasterWorks
Or you can just fade in the 'new stuff' on top of the 'old stuff' and when the new stuff is at 100% opacity just delete the old stuff.


I've got several sprites on top of each other, if I should use a fraction of the full, 0xFF, alphablend it would merge with one of the previous sprites (both source and destination, altough first screen is cleared with black, do have pixels in it that differ from each other). Is that what you mean?

Quote:
Original post by MasterWorks
Fading from one screen to another is probably best done with a custom sprite interface that would allow you to fade them all in/out at once, if you are opposed to using render targets/post processing.


You mean that I should derive that interface? Now I'm using just the normal interface and the first idea to fade out is to flag a status which commands the normal draw function of the mainloop to call a colorized version of the normal version so each object passes the colorized version on to the deepest level. Using the D3DCOLOR_RGBA(0xPP,0xQQ,0xRR,0xFF) as a parameter for the colorized version where PP, QQ and RR changes as a result of the times/ticks passed in the fade out loop.

Share this post


Link to post
Share on other sites
Quote:
Original post by rmdeboer82
I've got several sprites on top of each other, if I should use a fraction of the full, 0xFF, alphablend it would merge with one of the previous sprites (both source and destination, altough first screen is cleared with black, do have pixels in it that differ from each other). Is that what you mean?

Yes, sort of. We are referring to the same idea of using ticks per second (or whatever) as part of the fading loop, to modulate the vertex color's alpha value (using a variable instead of 0xFF). My specific suggestion was that if your new sprites that are fading in cover the entire screen area, then there's no need to 'fade out' the background or else you'll get some weird blend with black involved. I'm not sure exactly why you refer to using D3DCOLOR_RGBA(0xPP,0xQQ,0xRR,0xFF) which seems to be more for coloring sprites than fading them (making a sprite 'black' is not the same as fading it out unless you are using additive blending.)

Share this post


Link to post
Share on other sites
Solved, I used the normal sprite interface and loaded a black image onto it, resized it with a transformation and drawing it with a increasing/descreasing alphablending.

Share this post


Link to post
Share on other sites

This topic is 3837 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this