- Home /
Question by
gonee5001 · Mar 09 at 10:14 AM ·
transparent shader
How do I render my hair correctly?
This is my hair card mesh.
The hair card pointed by the arrow is inside.
I want to render the outer hair card so that the inner hair card is invisible, is there a way?
Shader "Wit/TransparentTextureWithColor" {
Properties {
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
_Color ("Main Color", Color) = (1,1,1,1)
}
SubShader {
Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
LOD 100
ZWrite Off
Blend One OneMinusSrcAlpha
Pass {
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata_t {
float4 vertex : POSITION;
float2 texcoord : TEXCOORD0;
};
struct v2f {
float4 vertex : SV_POSITION;
half2 texcoord : TEXCOORD0;
};
sampler2D _MainTex;
fixed4 _Color;
float4 _MainTex_ST;
v2f vert (appdata_t v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
fixed4 color = tex2D(_MainTex, i.texcoord);
color.rgb *= color.a;
color *= _Color;
return color;
}
ENDCG
}
}
}
3211231223.jpg
(94.2 kB)
Comment
Your answer
Follow this Question
Related Questions
Transparent shader in background queue 2 Answers
set gameobject in front of all others and don't have own faces appear in front of each other 1 Answer
Transparent shader decreases frame rate. Which material i should use for transparent object? 3 Answers
can see inside object that is supposed to be fully opaque 0 Answers
whats wrong with Transparent/diffuse shader and my object? 2 Answers