Transform Position Absolute to Local is Inaccurate? Is there a fix?

I followed a tutorial for mesh painting that unwraps the uv, snapshots it and uses that data to figure out the uv-coordinates to paint on.

I wanted to convert this code from world space to relative space, that way I would only need to unwrap and save the UV data once which will make the whole thing significantly cheaper since the scene capture is the most expensive part of this code.

However, when I do this, there is a loss in accuracy for the UVs, it still paints on the correct location but it’s like there are gaps in the UV where it won’t paint. I took a closer look and basically what I found is that the UV unwrap is slightly skewed if I convert it to local space.

Absolute(Accurate):


Local Space(Inaccurate):

It’s not 100% predictable either, for instance I tried re-testing on a different level, and what happened there was that the uv unwrap was that there were clear very narrow seams at the edges of the uv island which wouldn’t get painted on., e.g. it wasn’t skewed, but it’s scaling was off by a very narrow margin instead.

Here is the original absolute world postiion code:

And here it is converted to local space:

And here is the tutorial i followed.

Is there a way to fix this?

I can think of a few hacky ways around the problem like moving the actor to the world origin, rotating it just the right way, snapshotting the uv, then moving them back and using relative position from then on might for instance work (edit: It does) but I would really like it if someone could help me figure out why this is happening and how to solve it from the root of the problem, is it possibly an engine bug or is it some factor I’m not accounting for? I don’t like that this node seems malfunctioning cuz there is a pretty solid chance I might want to use it for some other things later.