Boris: About the alpha channel

share shaders here
Post Reply
  • Author
  • Message
Offline
*sensei*
Posts: 372
Joined: 28 Jul 2013, 23:26

Boris: About the alpha channel

Hi Boris, hope you're well.

I have a simple question for you... In normal hlsl PS syntax color is always an operation against the alpha channel... eg

[edit here: accidentally but a divider instead of multiplicative operator]
color.rgb *= color.a

However I noticed in every ENB .fx file I see this operation is not included and with output the alpha is set to 1.0f in every case. like

float4 _oC0 = tex2D(_s0, _v0.xy);
float3 color = _oC0.rgb;
<...giant code chaos here...>
_oC0.a = 1.0f;
_oC0.rgb = color.rgb;
return _oC0;

I have adopted this logic in my shaders, however...
Is there some logic to skip this operation in ENB and force all alpha channels to 1.0? I see so many issues related to transparency, which is alpha channel related stuff. Isn't this caused by wrong operation in the .fx files?

Please enlighten me :)

Have a good day
Last edited by prod80 on 22 Apr 2014, 20:04, edited 1 time in total.

Offline
User avatar
*blah-blah-blah maniac*
Posts: 530
Joined: 30 Jan 2012, 13:18

Re: Boris: About the alpha channel

Of course there is a sense in not using that line. You want your colors to be fully visible? Then ignore the alpha channel. Alpha channel only makes sense if the colors is blended with another texture/color whatever afterwards, this here is fullscreen texture which has to be rendered 100% "opaque" so alpha channel = 1.0 is a must.
Boris will be able to give more technical correct answer, of course.

Offline
*sensei*
Posts: 372
Joined: 28 Jul 2013, 23:26

Re: Boris: About the alpha channel

Fully visible color and alpha is 1.0 ... so it doesn't change output anyway. This only affects transparent objects in which alpha < 1.0, which are plentiful as well.

So I am wondering about the technical behind this.

Edit: O wait I see. tex2D ..god. Dunno how I missed that simple thing.

Offline
User avatar
*blah-blah-blah maniac*
Posts: 17560
Joined: 27 Dec 2011, 08:53
Location: Rather not to say

Re: Boris: About the alpha channel

If i remember, all screen space shaders don't have alpha blending enabled, so alpha math is ignored, but for temporal antialiasing alpha must be closer to 1 to make it visible or 0 to disable taa in certain locations (like letterbox bars), this required in effect.txt or in enbeffect.fx, if first file not exist. Also for performance reasons faster to compute 3 component math only and force alpha channel to be constant.
_________________
i9-9900k, 64Gb RAM, RTX 3060 12Gb, Win7
Post Reply