HI!, thx to read my thread.
i have some problem to hair shader in render.
its looks like well in unity view and unity game view.
but in the game view, remove transparent part and rendered only Opaque
this capture is from the unity view, unity game view and frame debug
in the capture, transparent part be rendered. all looks like well.
but…this error capture from the in game view
so…transparent part be removed. think i quess, this transparent not rendered error is… seems like next capture
this capture from frame debug, before the draw mesh transparent.
that status seems like error…its reason why i quess that
and so… i reserch to many way how to it works well.
how to forced fix render queue, how to transparency be rendered well, how to remove camera background color(this error capture is next)…
(this capture is solved remove transparency, but camera background color rendered together,
edit line107 value to 0.5 )
this is my shader code
Shader "Wit/Hair"
{
Properties
{
_MainTex ("Diffuse (RGB) Alpha (A)", 2D) = "white" {}
_Color ("Main Color", Color) = (1,1,1,1)
_Cutoff ("Alpha Cutoff", range(0.01,1)) = 0.5
_NormalTex ("Normal Map", 2D) = "bump" {}
_NormalPower ("NormalPower", range(0, 5)) = 0.75
_SpecularTex ("Specular (R) Spec Shift (G) Spec Mask (B)", 2D) = "gray" {}
_SpecularMultiplier ("Specular Multiplier", float) = 10.0
_SpecularColor ("Specular Color", Color) = (1,1,1,1)
_SpecularMultiplier2 ("Secondary Specular Multiplier", float) = 10.0
_SpecularColor2 ("Secondary Specular Color", Color) = (1,1,1,1)
_PrimaryShift ( "Specular Primary Shift", float) = -0.01
_SecondaryShift ( "Specular Secondary Shift", float) = -0.28
_RimColor ("Rim Color", Color) = (0,0,0,0)
_RimPower ("Rim Power", Range(1,3)) = 1.292
_TintColor ("Tint Color", Color) = (0,0,0)
_TintPower ("Tint Power", Range(0,1)) = 0.292
[HideInInspector]_LogLut ("_LogLut", 2D) = "white" {}
}
SubShader
{
Tags { "RenderType" = "fadeCutout" "Queue" = "Transparent-499" "IgnoreProjector"="True" "RequireOption" = "SoftVegetation" }
LOD 250
Blend SrcAlpha OneMinusSrcAlpha
ZWrite off
cull off
Pass {
ColorMask 0
ZWrite On
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct v2f {
float4 vertex : SV_POSITION;
float2 texcoord : TEXCOORD0;
};
sampler2D _MainTex;
fixed _Cutoff;
v2f vert (appdata_img v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.texcoord = v.texcoord;
return o;
}
fixed4 frag (v2f i) : SV_Target
{
fixed4 col = tex2D(_MainTex, i.texcoord);
clip(col.a - _Cutoff);
return 0;
}
ENDCG
}
Pass
{
Tags {"LightMode"="ShadowCaster"}
ZWrite Off
Cull Off
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_shadowcaster
#include "UnityCG.cginc"
struct v2f {
V2F_SHADOW_CASTER;
float2 texcoord : TEXCOORD1;
};
v2f vert(appdata_base v)
{
v2f o;
TRANSFER_SHADOW_CASTER_NORMALOFFSET(o)
o.texcoord = v.texcoord;
return o;
}
sampler2D _MainTex;
fixed _Cutoff;
float4 frag(v2f i) : SV_Target
{
fixed4 col = tex2D(_MainTex, i.texcoord);
clip(col.a - _Cutoff);
SHADOW_CASTER_FRAGMENT(i)
}
ENDCG
}
Pass {
ZWrite Off
AlphaTest GEqual 0.95
SetTexture [_MainTex] { }
}
CGPROGRAM
#pragma surface surf Hair keepalpha alpha:fade vertex:vert nolightmap finalcolor:tonemapping
#pragma target 3.0
#include "./Hair_alpha.cginc"
void surf (Input IN, inout SurfaceOutputHair o)
{
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
o.Alpha = saturate(c.a / _fade);
surf_base(IN, o);
if(o.Alpha < _fade) {
clip(-1.0);
}
}
ENDCG
}
FallBack "Mobile/VertexLit"
}
i still try to this now, i can’t solved this from camera. it making it for uploading to the platform.
i try solve this problem to seems like this shader in capture, it works well.
but its hard to me… i need any help, clue, refrence and any ideas for this.
thanks to read !