0

I'm using a graph shader to do a simple shift of the vertices of a 2D mesh. When object is in zero coordinates all seems to work, but the further from the center, the stronger the distortion, which should not be.

graph

I use URP 14.0.8 with Editor 2022.3.5f and shadergraph 14.0.8.

When I replace the space from the object to the world, the result does not change. From which I concluded that the coordinates returned are incorrect.

scene with result

To check if object and world space are equal made this structure. And in shader preview color is red, all seems to work, but in scene color is green, so object-relative space not working and returns world-origin-relative space. Checking scene

UPD. I found out that this behavior appears when more than one object uses the same material. It fixed by creating a separate instance of the material for each object on the scene. When I used the shader code, such a problem did not arise though. I found that problem may be in dynamic butching, but it is already disabled and SRP butching enabled. (Tried different configs with them, zero effect) Why does it work like that?

MrWorld
  • 1
  • 1
  • I wouldnt expect position to be anyhthing other than world position – BugFinder Aug 11 '23 at 14:43
  • @BugFinder could you say something.. in more detail please? Node position is responsible for the position of the vertex. The space of the object means that wherever the object is located in the world, the positions of the vertices relative to the object will be unchanged. What does "I wouldn't expect" mean? – MrWorld Aug 12 '23 at 21:17
  • exactly as it says.. OK.. I shall rephrase. I expect position to be its world position. just ike transform.position is a game objects world position.. – BugFinder Aug 13 '23 at 00:36
  • @BugFinder I see, probably formulated the question badly, edited it. – MrWorld Aug 14 '23 at 08:56

0 Answers0