Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Zombie

Amount of transculency

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

Advertisement
There are plenty of ways to do this:

1. lower the alpha of the textures
2. lower the alpha of the vertices
3. lower the constant alpha

You need to read up on the different blending functions that exist. I assume that (VB) means that you are using DX7 and Visual Basic so here's a few keywords that you can search for:

D3DRENDERSTATE_ALPHABLENDENABLE
D3DRENDERSTATE_SRCBLEND
D3DRENDERSTATE_DESTBLEND
D3DTSS_ALPHAOP
D3DTSS_ALPHAARG1 (2)
D3DTEXTUREOP

I can't give you much more help until you know which aproach you wish to use.


- WitchLord

Edited by - WitchLord on May 13, 2000 6:28:58 PM

Share this post


Link to post
Share on other sites
I don''t know what those three do, which means I have to explain this situation, which is simple- I have to fade the textures so, that they aren''t visible anymore, and the game can destroy them as useless. Well, choose an approach for me, but let it be the most useful in all cases.

Share this post


Link to post
Share on other sites
If the whole object should be equally translucent all over, I would go with number 3. Unfortunately I don''t have time to go into the details right now. But you need to tell Direct3D that it should use the TextureFactor for the alpha in the blending

Here''s some pseudo code:

SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE,TRUE);
SetRenderState(D3DRENDERSTATE_SRCALPHA, D3DBLEND_SRCALPHA);
SetRenderState(D3DRENDERSTATE_DESTALPHA, D3DBLEND_INVSRCALPHA);
SetTextureStageState(0,D3DTSS_ALPHAOP,D3DTOP_SELECTARG1);
SetTextureStageState(0,D3DTSS_ALPHAARG1,D3DTA_TFACTOR);

// Set the alpha value with the TextureFactor, I''m setting it to 50% transparency here
SetRenderState(D3DRENDERSTATE_TEXTUREFACTOR,0x7F000000);

When you render the object now, I believe it will be semi-transparent as you want it to be. (Bewarned that this is from the top of my head and not tested, so it might be wrong.)

- WitchLord

Share this post


Link to post
Share on other sites
Witchlord ->

Have I understood you right with the texturefactor you don''t need to use the alpha channel for the texture if you want the same blend for the whole texture?

Regards
/Joachim

Share this post


Link to post
Share on other sites
Correct me if I''m wrong, but couldn''t you just change the color value(or emissive value, I forget which one) of the objects material? They do this in the fireworks example. Which method is faster/more efficient?

-Doddler

Share this post


Link to post
Share on other sites
Yes, in the fireworks sample they do set the emissive color of that material. This works great for the particles as it is possible to set both color and transparency of them this way, but for it to work you must have additive blending.

With additive blending the color in the frame buffer and the color in the texture is added and then cropped to 1. What this means is that you can''t have fully opaque objects, and the rendering also have a tendency to saturate into a white haze (which looks great for particle systems).

I don''t think there are any speed/efficiency difference between the two. Which to use completely depends on the effect you wish to get.

- WitchLord

Share this post


Link to post
Share on other sites
I''ve faced a little problem in setting the renderstate. Is there a way to set them smoothly, with a dial from 0 to 100? When a variable''s value is 0, the transculensy is complete (the object isn''t visible). And when the same var''s value is 100, the object should be completely visible. And I''m (still) not so good at hexes, how can you see from "0x7F000000" that the transparency is 50%?

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!