Fade Screen
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?
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.
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]
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
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.
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.
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.
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
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement