Page 1 of 1

Boris: About the alpha channel

Posted: 22 Apr 2014, 13:02
by prod80
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

Re: Boris: About the alpha channel

Posted: 22 Apr 2014, 15:57
by Marty McFly
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.

Re: Boris: About the alpha channel

Posted: 22 Apr 2014, 20:01
by prod80
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.

Re: Boris: About the alpha channel

Posted: 23 Apr 2014, 19:24
by ENBSeries
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.