Access viewport transform scale in shader code?

Godot Version

4.3

Question

I need to access viewport transform’s scale for a certain screen reading shader
I’m currently doing this by code
Is there a way to access it directly from the shader code?
Thanks in advance!

Already solved!
Solution:

shader_type canvas_item;

varying mat4 CM;

void vertex() {
	CM = CANVAS_MATRIX;
}

void fragment() {
	vec2 scl = vec2( length(CM[0]) , length(CM[1]));
}

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.