when I apply One mat twice on two same object ie:two buildin plane,then dont work correctly,
But if I apply the mat on two diffrent obj ,ie: one is buildin plane,another is a cube they work fine
why does this happens?
but some times later ,it does work again,the case that one mat applied to same objs, so werid?
I cannot figure out what you are talking about, but it doesn’t sound like a shader issue. You think so?
It is sure a shader issue
here is the code:
struct v2f {
float4 pos:SV_POSITION;
float2 texc:TEXCOORD0;
};
v2f vert(appdata_base v)
{
v2f o;
float4 ori=mul(UNITY_MATRIX_MV,float4(0,0,0,1));
float4 vt=v.vertex;
vt.y=vt.z;
vt.z=0;
vt.xyz+=ori.xyz;//result is vt.z==ori.z ,so the distance to camera keeped ,and screen size keeped
o.pos=mul(UNITY_MATRIX_P,vt);
o.texc=v.texcoord;
return o;
}
float4 frag(v2f i):COLOR
{
return tex2D(_MainTex,i.texc);
}
the code just make a build_in plane oreint to camera always
but at first,when i use one material of this shader to two planes,
they both disapeared,
then I tried use two materials of this shader, and all is fine
I guess the problem because of cahce of unity,
so I build it standalone, but the problem stills there,
Ie: one mat of this shader applied to two planes,they both disapear,
but that wont happen when one mat of this shader applied to different type object,
SO i guess it comes to unity’s cache,Just not sure
and some times later,after i did some change,not essential change, all goes right,
Ie one same mat of this shader applied to two same obj all work fine
UNITY_MATRIX_MV and v.vertex take on different values when the meshes are batched, unless the objects are not rotated/scaled/translated.
That sounds why the porblem happens
But i did try to put the two plane at different position,Not work,ie not renderered
and i have tried to set it as the mat of a particel sysytem, ant the result is all particle was not renderered
and still now ,it wont work for particle system, ie lead to them not renderered
but they are fine for planes now, werid…
win7+d3d9
I guess the worked card should be 650M…