Search Unity

Question How is my shader interacting with itself?

Discussion in 'Shader Graph' started by dr4, Mar 12, 2020.

  1. dr4

    dr4

    Joined:
    Jan 14, 2015
    Posts:
    108
    I'm veeery confuse about something, I created a shader that works great with one object in the game, but as soon as I add one or more objects with the same material to the scene they start interacting with each other when I move them around or put them in some positions (they hate being close to each other or occupying the same "x" position, they are ok with the same "y" which doesn't make any sense to me) they change each other positions and sometimes become invisible (I suspect that they just teleport very far), without touching anything else, the objects are just simple sprites carrying the material, they are not doing anything else, I can't understand why they would do that as the shader doesn't seem to allow any interaction with itself, even without running the game (as I said if I have only 1 element with this shader everything works great)

    Is there something here that would make 2 objects with the same material dislike each other?

    upload_2020-3-12_22-57-29.png
     

    Attached Files:

  2. alexandral_unity

    alexandral_unity

    Unity Technologies

    Joined:
    Jun 18, 2018
    Posts:
    163
    Are the objects in scene batched in any way? Batching will make the object position of objects close together use the same look up bounds and per-object behavior will not be consistent.
     
  3. dr4

    dr4

    Joined:
    Jan 14, 2015
    Posts:
    108
    I'm unsure, I have been reading around about it (never touched any batch at all) but changing it doesn't seem to affect, but I found the reason (still do not understand why) it seems to be the scale, I had those sprites on scale 0.2 (I needed them small) changing it to 1 makes them act normally, so I guess the solution is "remake" them in a smaller version and use the scale 1.

    thank you very much for taking time to answer