I am afraid there is no such built_in variable. What I did is create uniform vec3 size, and simply pass aabb of the object into it. Knowing maximum size I can make all kinds of relative operations on vertices.

Thanks for your answer but I already figured it out.

I was trying to get a cordinate system like blenders object cordinates where the center of the object has (0,0,0) value and the values increase as you move away from the object. My idea was to use VERTEX built-in but the values are not relative to the origin of the object. My mistake was thinking they in global cordinates but turns out they are actually in something called view space. So what I needed is to transform the VERTEX values to be in global space (which basically is global cordinates) then to local space to get my cordinate system. To do that you just multiply VERTEX with the inverse view matrix then inverse model matrix (world matrix in godot 3.4).

Anyway thanks for taking time to look at my question.

magicalogic | 2022-07-10 16:01

It sounds great, You actually helped me more than I helped You :).
So all I need to do is multiply VERTEX by both of these matrices ?

Inces | 2022-07-10 18:37

Yes, in that order.

magicalogic | 2022-07-11 01:40

Do you have a source for VERTEX being in viewspace?

Vertex data (VERTEX, NORMAL, TANGENT, BITANGENT) are presented in local model space.

omggomb | 2022-07-11 09:42

I tried using them as such in visual shader editor but it didn’t work. Everything changed when I rotated the viewport meaning VERTEX is in viewspace. Maybe it’s a visual editor thing or something to do with me using godot 4.