Forum

DX11 alphamask

I’m struggling here with a really really tough shader:
Swizzling the alpha channel and multiplying with a value.

omg

I don’t know why this won’t work like it did in dx9.

please help me out
thx

VVVV.7z (1.9 kB)

attach a Blend (DX11.RenderState)

looks the same :/
tried all modes

Are you sure?

BlendMode.zip (4.0 kB)

ugh I never checked, I expected a green picture.

I want to use the gradient as an alpha mask for the green quad.

Could you point out my mistake?

the dynamic gradient input is the problem…
you applied the gradient onto “lightness” instead of “alpha”.

attached a version that reads the lightness (in terms of blue) inside of the shader.

swim swim

VVVV_01.zip (3.5 kB)

I thought multiplying colors works like this:

p1.rgba (0,1,0,1) * p2.b (0.5)
p1.rgba (0,0.5,0,0.5)

and

p1.a (1) * p2.b (0.5)
p1.rgba (0,1,0,0.5)

no?

from your shader:

bildout = bild2.a * ((bild1.r + bild1.g + bild1.b)/3);

you assign a single value to a float4, no Color, only alpha multiplied by the greytone.

try:

bild2.a = ((bild1.r + bild1.g + bild1.b)/3);
return bild2;