• Advertisement
Sign in to follow this  

Fade Screen

This topic is 4511 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
Quote:
Original post by EvilKnuckles666
will the idea on doing Draw() with a NULL pointer to a texture work? i think i'll do that idea.


Give it a try. I cannot guarantee it. Like I mentioned earlier, non-Sprite rendering in DX with a null texture and diffuse color [like Sprite seems to use] does do that effect for me.

I wouldn't be suprised if it was in reality undefined behavior though.

Share this post


Link to post
Share on other sites
ok having a NULL pointer to a texture causes an error... i was thinking of just having that 1 by 1 black texture, stretching it out. but then i was thinking there HAS to be a way to just draw it on there, then i was thinking how drawing programs work, by drawing lines from point to point by where the mouse is

So NOW i'm going to try to have an ID3DXLine interface, have the width 1024 (width of the screen) and draw a black line from the top to the bottom every frame with the alpha i am going to store. That a good idea?

Share this post


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

  • Advertisement