Sign in to follow this  
noatom

HLSL would alpha blending work here?

Recommended Posts

noatom    927

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>;
      ColorOp[1]        = Add;
      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 this post


Link to post
Share on other sites
Tom KQT    1704

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 this post


Link to post
Share on other sites
noatom    927

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 this post


Link to post
Share on other sites
Tom KQT    1704

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this