|
I´m trying to get blended/ fading edges from a Mask. Using the depth mask shader (source wiki). with this modified version I can get the alpha/ blending information on the mask to control the diameter off the mask (base Alpha Cutoff) [CODE]Shader "Transparent/Mask" { }[/CODE] ...But Im trying to get Blending/ Fading edges instead of the solid cut i´m getting. PS: made same thread in unity forum with images
(comments are locked)
|
|
http://zammyart.com/mask.unitypackage move slider at transparent cube's material and check is it what you are looking for you can also repeat this yourself:
Shader "Transparent/Mask"
{
Properties
{
_MainTex ("Alpha (A) only", 2D) = "white" {}
_GreyPower ("Grey color power", Range(0,2)) = 1
}
SubShader
{
Tags {"Queue" = "Geometry+10"}
GrabPass { }
Pass
{
Fog { Mode Off }
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
sampler2D _GrabTexture;
sampler2D _MainTex;
float _GreyPower;
struct appdata
{
float4 vertex : POSITION;
float4 texcoord : TEXCOORD0;
};
struct v2f
{
float4 pos : SV_POSITION;
float4 uv : TEXCOORD0;
};
v2f vert (appdata v)
{
v2f o;
o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
o.uv = float4(v.texcoord.xy, 0, 0);
return o;
}
half4 frag( v2f i ) : COLOR
{
half4 c = tex2D(_GrabTexture, float2(i.uv.x, 1 - i.uv.y));
c.rgb = (c.r + c.g + c.b) * 0.33;
c.a = saturate(tex2D(_MainTex, i.uv.xy).a + _GreyPower - 1);
return c;
}
ENDCG
}
}
}
PS disable whole renderer if you don't fade out screen due to perfomance reason
Jul 19 '12 at 08:56 PM
ScroodgeM
PPS this shader can be simple modified to fade based on fade start time and fade speed - so you needn't to set grey color power each frame, just a start time and speed one time at srart fading
Jul 20 '12 at 09:32 AM
ScroodgeM
thanks, It did not work as (I)intended it loses the masking ability. Have to re-try/ test further
Jul 20 '12 at 11:30 PM
Uttpd
download package from link below and try do manually mask - if it works than it is 80% completed, just need to implement.
Jul 21 '12 at 03:52 AM
ScroodgeM
(comments are locked)
|

is it actual?
realtime? yes