it is not understand at all.....

Started by
5 comments, last by Saiz 20 years, 9 months ago
Hi, I read a lot of tutorials without success, it makes me feel those tutorials are not written for a good understanding of this technology or for people that really don't understand the problem. I want to put a texture over a previous one making use of third one for the alpha channel. Impossible to get it! I try to render first texture in a pass, and then the second texture in a second pass, but using the third texture as alpha channel for the second pass. Would any guru here give me any clue how to do it? Thank you, Saiz
Advertisement
Why don''t you combine the textures into one image before rendering? It''ll give you the effect you wanted, and you don''t have to bother with extensions and stuff...
Newbie programmers think programming is hard.Amature programmers think programming is easy.Professional programmers know programming is hard.
Because the possibities are high and if in theory it will done very fast for any graphic card (if I knew how to do it).

Saiz
Are you using DirectX or OpenGL? On most modern hardware you don''t need to do multiple passes to do what you want, you can do it all in one pass. You just need to set each of your textures to a different texture stage (DX terminology, don''t know if it''s the same for OpenGL) and then set your texture stage states to the appropriate blending modes to achieve the effect you want. Alternatively, if your target hardware supports it, you could write a pixel shader to do what you want.

Without knowing exactly what you want to do this for I can''t say if it''s the best way of achieving your aim but here''s how you could do it with DX:

Render your first texture in the first pass normally.

In the second pass, set your second texture as the texture for texture stage 0 and your third (alpha channel) texture as the texture for texture stage 1. Then set your texture stage states to:

ColorOp[0] = MODULATE;
ColorArg1[0] = TEXTURE;
ColorArg2[0] = DIFFUSE;
AlphaOp[0] = MODULATE;
AlphaArg1[0] = TEXTURE;
AlphaArg1[0] = DIFFUSE;
ColorOp[1] = SELECTARG2;
ColorArg1[1] = TEXTURE;
ColorArg2[1] = CURRENT;
AlphaOp[1] = SELECTARG1;
AlphaArg1[1] = TEXTURE;
AlphaArg2[1] = CURRENT;

That should do what you want if I''ve understood you correctly.

Game Programming Blog: www.mattnewport.com/blog

Thank you very much Matt, it works perfect in DirectX.

It clear that I don''t understand it well and you are an expert.

If you have time I would a honour if you could have a look to my sim and scenery (www.sailorsofthesky.com). I''d like to have some 3D expert support.

Saiz
Looks nice. Although not enough guns, explosions and deaths

Everything is better with Metal.

Sorry work perfect..

[edited by - saiz on July 6, 2003 2:59:45 AM]

This topic is closed to new replies.

Advertisement