Jump to content
  • Advertisement
Sign in to follow this  
BloodLust666

Fade Screen

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

What's a good way to fade the screen in and out gradually. At first i was changing the ID3DXSprite->Draw() color values lower to 0, to fade out and up to 255. Then i was thinking isn't of that (cuz whenever i have 3D objects) i could make a transparent black rectangle that covers the screen, then slowly increase the alpha to make more black show up to make it look like everything in screen is fading out, and decrease the alpha to make everything appear like it's fading in. Is this idea good? or does anyone else have a different approach?

Share this post


Link to post
Share on other sites
Advertisement
Yeah, that's a good idea. The color values are more versatile since you can then fade different surfaces independantly, but if there's a bunch of stuff on the screen, the rect fade is much easier.

Share this post


Link to post
Share on other sites
fade different surfaces? i was just talking about putting a sprite with a texture all black as big as the screen in my sprite render loop and when i need to fade the screen, i'll change the alpha values for the rect so it fades the screen all together.

Share this post


Link to post
Share on other sites
Er maybe I wasn't clear...

You talk about 2 methods:

1. Manipulate ->Draw() values for each object.
2. Manipulate black rectangle over entire screen.

The 2nd is a good idea, and useful when you need to fade the entire screen. Much easier than picking all the objects on the screen and fading them together.

The 1st is a decent idea, good to have anyways, since you'll sometimes need to fade different objects/sprites/surfaces independantly [like have something fade in once it enter Line of Sight, or corpses fade out after a certain time]

Share this post


Link to post
Share on other sites
how would i create a plain black texture (alpha 255) without having to actually create it and save it, then load it in my program. basically how do i explicity with code create a black texture

Share this post


Link to post
Share on other sites
There's probaby a bunch of ways to do this. For me:

On my vid card, using DX9, with D3DFVF_DIFFUSE set, I create a textured quad with a null texture [0 as the 2nd param to SetTexture], and set the vertex colors to the color I want; black in this case.

Share this post


Link to post
Share on other sites
i would use that, but i'm only useing ID3DXSprite's and my engine only uses those. i'd prob. use that when i go to 3D but i need something that load's a iDirect3DTexture9 and draws all the pixels black.

Share this post


Link to post
Share on other sites
Eh... *goes to msdn* I've not used the sprite interface. Probably totally duplicated its functionality... I really need to stop that sort of thing...

Ah. Try to put 0 as the the first parameter to ID3DXSprite::Draw and black as the last [0xff000000]. That should do the same thing I think.

Share this post


Link to post
Share on other sites
Hi,

Probably you have one sprite with a back section. As all your rect will be black then just grab that 1x1 pixel in your texture and stretch it all over the sprite.

Or just create your texture 1x1, lock it and fill it with black.

Luck!
Guimo


Share this post


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

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!