Skip to main content
GameDev.net gamedev.net
🔒 Locked

funky alpha fading problem

Started by neonstar Dec 25, 2001 at 4:11 PM 8 replies 750+ views
Original Post
neonstar
neonstar
howdy folks, I''m trying to do various alpha fades in my game engine, such as fading a big quad over the screen for screen fades and fading enemies out when they die. it works, but i have this funky effect during the fade. when i decrement the alpha level in the D3DCOLOR variables of the vertices, the fade goes down as it should to zero, but the visual of the effect seems to jump right to zero around 100 or below. this makes the fade look really crappy cause it fades and then all of a sudden dissapears. for the screen fade-ins, it makes the screen fade in a bit and then pop right into view. anyone know how i could fix this problem? am i just going about it the wrong way? ah, also: i was playing black and white yesterday and i noticed something cool about their screen fades. there seems to be some kind of diamond pattern that appears on the screen, but you can''t really see it. it just blends things better, i guess. i''m assuming that it''s mip-mapping or dithering in effect for a stretched logo or something... thoughts? anyway, i''d appreciate any help here cause i''m winding down to the loosely tenative publisher demo release date and i''d love to have things looking amazing thanks, and happy holidays, dave -- david@neonstar.net neonstar entertainment
--david@neonstar.netneonstar enter
Forcas
Forcas
Hmm.... probably has to do with the variable you''re using to do the fade. Post some code up, please.
-Forcas writeln("Does this actually work?");
neonstar
neonstar
basically all i''m doing is using a D3DCOLOR_RGBA variable and feeding it a decremented alpha value to do the fade effect. i''ll decrement the alpha level every 300 or so milliseconds to get the desired effect, but it gives that little jump around 100 A. and if i wasn''t clear enough, i''m decrementing like (255, 255, 255, 255) to (255, 255, 255, 0). well, that would be for a screen fade in, but you get the idea.

hope that helped.

dave

--
david@neonstar.net
neonstar entertainment
--david@neonstar.netneonstar enter
Forcas
Forcas
Remember... it''s ARGB, not RGBA. Also, It should work fine. It''s kinda hard to tell what''s wrong without the code.
-Forcas writeln("Does this actually work?");
neonstar
neonstar
are you sure, cause when I use RGBA, the alpha component works partially. whatever, though, i''ll take your advice and see how it turns out. if it works, i''ve got a lot of code changing to do.... ugh.

thanks,
dave

--
david@neonstar.net
neonstar entertainment
--david@neonstar.netneonstar enter
neonstar
neonstar
nope, didn''t fix it, i''ve still got the little jump goin on. the fade works nicely to a point, but then it takes a jump right to the extreme to which i''m fading to (0 or 255).

any other ideas? maybe there''s some alpha flag i set wrong?

dave

--
david@neonstar.net
neonstar entertainment
--david@neonstar.netneonstar enter
DrunkenHyena
DrunkenHyena
G''day!

That sounds really odd. Have you tried it on the Reference rasterizer to see if it''s a driver bug?

What are your texture stage states set to?

If you set the alpha to 100 manually does it still disappear?


Stay Casual,

Ken
Drunken Hyena
Stay Casual,KenDrunken Hyena</FON
neonstar
neonstar
aha, figured it out. apparently i just had to change this:

m_D3DD->SetRenderState(D3DRS_ALPHAREF, 0x7F);

to this:

m_D3DD->SetRenderState(D3DRS_ALPHAREF, 0x00);

i knew it had to be a renderstate

thanks,
dave


--
david@neonstar.net
neonstar entertainment
--david@neonstar.netneonstar enter
a person
a person
apparently you are using alpha testing somewhere, since alpharef should default to 0 (and alpha testing default is allow all pixels).
neonstar
neonstar
yes, i''ve got alpha testing enabled. should I not have that enabled or something? keep in mind, i''ve written a 2D engine with D3D8...

dave

--
david@neonstar.net
neonstar entertainment
--david@neonstar.netneonstar enter

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.