So I just spent more than 8 hours researching on Google, Answers, Stackoverflow etc. why this wouldn’t work, to no avail:
I followed this tutorial here:
http://studio.openxcell.com/remove-dustfog-object-unity-swipe.html
I used the instructions and shaders in there to make this “dust cleaning” effect work - but I have a problem fading out the image.
Here’s what I tried to do, in Properties I added an _Alpha Property as a Float:
Properties {
_MainTex ("Main", 2D) = "white" {}
_MaskTex ("Mask", 2D) = "white" {}
_Alpha ("Alpha", Float) = 0.5
}
Then I would try to insert that _Alpha Variable into this line of code (instead of the “1.0” that was there previously):
fixed4 frag(vert2frag input) : COLOR
{
fixed4 main_color = tex2D(_MainTex, input.texcoord);
fixed4 mask_color = tex2D(_MaskTex, input.texcoord);
fixed4 _Alpha;
return fixed4(main_color.r, main_color.g, main_color.b, main_color.a * (_Alpha - mask_color.a));
}
So far so good, but instead of letting me change the Alpha Channel of the Texture it produces a strange “flickering” of the image on Mac, and on Windows it gives me this error:
Shader error in ‘TextureMasking’:
incorrect number of arguments to
numeric-type constructor at line 52
(on d3d11)
I really need help, I want a dust-cleaning effect for my sprites but also want to alpha-fade this. It seems like NO one has done this before (which seems strange) and I can’t find anything on the Asset Store (I would gladly pay for it at this point).
Can anyone help?