[DB] Transparence de shader [Résolu]
Publié : 26 Août 2019 20:10
Bonjour,
Comment puis je rendre ce shader transparent?
Comment puis je rendre ce shader transparent?
Code : Tout sélectionner
Shader "Custom/Sin Wave" {
Properties{
_Tile("Tile", Range(0.0,1.0)) = 0.5
_Color ("Color", Color) = (1,1,1,1)
_ForegroundColor("Foreground Color", Color) = (1,1,1,0)
_BackgroundColor("Background Color", Color) = (0,0,0,0)
_ForegroundMask("Foreground Mask", 2D) = "white" {}
_ForegroundCutoff("Foreground Cutoff", Range(0,1)) = 0.5
_BackgroundCutoff("Background Cutoff", Range(0,1)) = 0.5
_Radius("Radius", Range(0.0,1.0)) = 0.5
}
SubShader
{
Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
LOD 100
ZWrite Off
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#pragma surface surf Standard
#pragma target 3.0
sampler2D _ForegroundMask;
struct Input {
float2 uv_ForegroundMask;
};
fixed4 _ForegroundColor;
fixed4 _BackgroundColor;
fixed4 _Color;
half _ForegroundCutoff;
half _BackgroundCutoff;
half _Radius;
half _Tile;
void surf(Input IN, inout SurfaceOutputStandard color)
{
fixed x = (-0.5 + IN.uv_ForegroundMask.x) * _Tile;
fixed y = (-0.5 + IN.uv_ForegroundMask.y) * 2;
fixed radius = 0.5 + sin(x * 3.1415926535) * _Radius;
radius -= (0.5 * y + 0.5);
clip(radius - _BackgroundCutoff);
clip(_ForegroundCutoff - radius);
color.Albedo = _Color;
}
ENDCG
}
FallBack "Unlit/Transparent"
}