Hello everyone. I have the following transparent png and i would like to apply it to a mesh without any tiling so that i get a darkness effect. To specify, the mesh is procedurally generated and is used for dynamic 2d shadows. If i set tiling to 0 i only get a black texture.
Any ideas/suggestions? Take care everyone 

2 Answers
2
To accomplish what you need, shader supporting transparency is a must, as stated in comments. But additionally, you have to set tiling back to 1, and have your mesh properly UV mapped.
This the sahder you would need :
Shader "Custom/Custom Transparency" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
_Color("Color",Color) = (1,1,1,1)
}
SubShader {
Tags { "Queue"="Transparent" }
CGPROGRAM
#pragma surface surf Lambert alpha
struct Input {
float2 uv_MainTex;
};
uniform sampler2D _MainTex;
uniform float4 _Color;
void surf (Input IN, inout SurfaceOutput o) {
float4 tex = tex2D (_MainTex, IN.uv_MainTex);
tex.rgb *= _Color.rgb;
o.Albedo = tex.rgb;
o.Alpha = tex.a;
}
ENDCG
Use a texture with transparency or set Alpha from grayscale in texture import settings.
If you apply the material on plane created on Unity you will not need to create your own mesh. But as ArkaneX said if you want to apply it on a specific mesh, think about UV mapping.
Hope it helps !
Hello, I do not understand your issue. I mean what is the point with "tilling". If you need to use this texture on your mesh, create a material with a shader that manage transparency.
– livevladIf I understand well, you want to apply this texture on a plane and to make the black transparent. If this is the case just tell me and I could provide you a very simple shader to do that. I don't know all the shaders provided by Unity and Transparent/Cutout won't do what you want.
– livevladThat is indeed the case. I apologise for draggint this out so much :C
– Cognitive_Dissonance