- Home /
Shader from Unity documentation not work while see only one object on screen
I am trying to apply tangent shader from Visualizing tangents and binormals (http://docs.unity3d.com/Manual/SL-VertexProgramInputs.html) to prefab and shader not work properly until I have more then one instance of this prefab on screen. And all not work on any instance count on screen when I assign new material with this shader to each instance. I don't understand what are the problem? Thanks.
Answer by Ericool · Mar 24, 2015 at 04:28 PM
could we see some pic or code ?
Code from documentation:
Shader "Debug/Tangents" {
SubShader {
Pass {
Fog { $$anonymous$$ode Off }
CGPROGRA$$anonymous$$
#pragma vertex vert
#pragma fragment frag
// vertex input: position, tangent
struct appdata {
float4 vertex : POSITION;
float4 tangent : TANGENT;
};
struct v2f {
float4 pos : SV_POSITION;
fixed4 color : COLOR;
};
v2f vert (appdata v) {
v2f o;
o.pos = mul( UNITY_$$anonymous$$ATRIX_$$anonymous$$VP, v.vertex );
o.color = v.tangent * 0.5 + 0.5;
return o;
}
fixed4 frag (v2f i) : SV_Target { return i.color; }
ENDCG
}
}
}
One object:
Two objects (just enable second object):
Adding more objects don't change anything.
Your answer
Follow this Question
Related Questions
Make material always culled. 1 Answer
Texture alpha doesn't scroll with offset 1 Answer
Unwanted rendering on top of all objects!? 0 Answers
Determining render order by position 1 Answer
See through issue in iOs 0 Answers