Fade Screen

Started by
11 comments, last by BloodLust666 18 years, 7 months ago
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?
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML
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.
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.
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML
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]
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
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML
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.
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.
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML
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.
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


will the idea on doing Draw() with a NULL pointer to a texture work? i think i'll do that idea.
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML

This topic is closed to new replies.

Advertisement