[DB] Transparence de shader [Résolu]

Questions à propos du scripting Shader.
Artcraft
Messages : 33
Inscription : 21 Août 2019 13:38

[DB] Transparence de shader [Résolu]

Message par Artcraft » 26 Août 2019 20:10

Bonjour,

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"
	
}
Dernière édition par Artcraft le 07 Sep 2019 11:15, édité 1 fois.

Artcraft
Messages : 33
Inscription : 21 Août 2019 13:38

Re: [DB] Transparence de shader

Message par Artcraft » 26 Août 2019 20:58

bon bin j'ai trouvé par moi meme...

manquait le pragma alpha:fade

Avatar de l’utilisateur
F@B
Messages : 1844
Inscription : 01 Août 2013 10:41
Contact :

Re: [DB] Transparence de shader

Message par F@B » 28 Août 2019 08:49

salut

je dirais en ajoutant Alpha et en mettant dans le bonne RenderQueue

Tags {"Queue" = "Transparent" "RenderType"="Transparent" }

#pragma surface surf Standard fullforwardshadows alpha:fade
ʕ·͡ᴥ·ʔ ==> Mon Portfolio <== ʕ·͡ᴥ·ʔ

Merci de lire et de prendre en considération la Nétiquette des Forums avant de poster un sujet !

Artcraft
Messages : 33
Inscription : 21 Août 2019 13:38

Re: [DB] Transparence de shader [Résolu]

Message par Artcraft » 07 Sep 2019 11:32

merci !

Répondre

Revenir vers « les Shaders »