HLSL would alpha blending work here?

This topic is 1702 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

Look at this code:

texture t0;             // first texture to blend
texture t1;             // second texture to blend
float4x4 world;       // world matrix
float4x4 view;       // view matrix

technique singlepass
{
pass p0
{
Texture[0]        = <t0>;
ColorOp[0]        = SelectArg1;
ColorArg1[0]      = Texture;
Texture[1]        = <t1>;
ColorArg1[1]      = Texture;
ColorArg2[1]      = Current;
ColorOp[2]        = Disable;
WorldTransform[0] = <world>;
ViewTransform     = <view>;
}
}


Question 1: if the second texture had a background filled with pixels with transparent alpha,and in the middle a blue rectangle(non transparent alpha),would it matter,or would i just see the entire thing(black with the blue rectangle in the middle)? Would the operation care about the alpha at all?

Question 2:

Why ColorOp[2] = Disable; ?

Wouldn't that just cancel the entire result and output nothing?

Share on other sites

I never really was good with the fixed function pipeline (FFP), it always was about a lot of guessing and trial & error for me. When I moved to shaders, everything was suddenly MUCH simpler, easier, clearer.

I'm sorry I won't help you with your problem, but I still have IMHO a good advise for you - if you already are in this stage when you don't know how to achieve something (even quite simple) with the FFP and you are confused about the all settings, you should seriously consider learning shaders.

Edited by Tom KQT

Share on other sites

Shaders will come later only after I understood this problem.

So the process of stage sampling is split into 2,the unit for rgb and the unit for alpha. By default,they are both activated. But what happens with the alpha unit when the color unit adds 2 textures together?

Edited by noatom

Share on other sites

So the process of stage sampling is split into 2,the unit for rgb and the unit for alpha. By default,they are both activated. But what happens with the alpha unit when the color unit adds 2 textures together?

It depends on how the alpha stage is configured. If you don't explicitly set it, the default values are used. You can find the default values in the documentation.

Btw, cannot you simply test it to see what it does? I think you would get an answer much faster than by asking here ;)

Shaders will come later only after I understood this problem.

The point is that you really don't need to understand this problem if you stop using FFP. This everything is specific only to FFP, with shaders you don't have to know it at all. So instead of learning this quite useless stuff, you could spend the time learning shaders, which will be incomparably better time investment. ;)

Edited by Tom KQT

1. 1
2. 2
3. 3
4. 4
frob
12
5. 5

• 16
• 13
• 20
• 12
• 19
• Forum Statistics

• Total Topics
632172
• Total Posts
3004561

×