why color changes with rotating the view or import second coordinate while just show the POSITION
These four assets share the same material.
Left two are imported from MAYA and right two are Unity default.
Everything is right except putting the cube with the second coordinate into the scene.
When assign the material, both cube imported from MAYA change the color as the picture shows.
Sometimes when rotating the view, the color changes.
The plane has the second coordinate and the cube is Unity default.
=====
My shader is here , using Unity 2017.1
Shader "Position"
{
SubShader
{
Tags{ "RenderType" = "Opaque" }
LOD 100
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float3 coords : TEXCOORD0;
float4 pos : SV_POSITION;
};
v2f vert(appdata v)
{
v2f o;
o.pos = UnityObjectToClipPos(v.vertex);
o.coords = v.vertex.xyz;
return o;
}
fixed4 frag(v2f i) : SV_Target
{
fixed4 c = fixed4(i.coords,1.0);
return c;
}
ENDCG
}
}
}
Your answer
![](https://koobas.hobune.stream/wayback/20220612132243im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Looking at a Chunk from Straight Down will not Render Blocks, but Looking at it from the Side does? 1 Answer
Get real colors like white or black 1 Answer
2D Mobile: How to mask a gameObject with another gameObject (with soft edges) 0 Answers
Is there a shader I could use to always render a material over another material? 0 Answers