clones bugging with Shader Offset command?

alt text

If you copy and paste 2 planes with a shader “Offset” value (to prevent coplanar pixel jumbling) they have artefacts, same if you clone them, but if you import them both separately through the “browser>GameObject>Create” and give them the same shader the offset works great. So for example you couldn’t clone posters on a wall, windows on a house, etc.

I also tried Setting the offset value during clone instantiation, it didn’t solve it:

InstantiateObject.renderer.material.mainTextureOffset = Vector2(-8,-6); 

Here is the shader code that only works in manually placed objects, but fails when you copy the same objects into a shared space.

Pass {
    Cull Front
		Offset -8,-8
    SetTexture [_MainTex] {
        Combine Primary * Texture
    }

if you test this out, Artefacting is always apparent if the 2 plane objects are rotated like cards. why dont clones take pixel offset commands? do i have to force a “deep copy” in JS:

panel.renderer.material.mainTexure = Instantiate (panel.renderer.material.mainTexture) as Texture2D;

I think you are mixing two different offset.

  • The offset in the shader code moves the geometry towards the camera to prevent z-fightling
  • The mainTextureOffset is a UV-mapping offset.

Checkout solutions for z-fighting in the following answer: