How can I access the 3d view port's dimension (width and height) in the shader node editor?

I need the ratio of height/width of the 3d view port in the shader node editor, but I googled a lot, found nothing, is it possible to do this?

If you just want the pixel ratio, than you can use this small hack:

-EDITED-
Note that this only works for surfaces oriented to Z, because the way the Bump node calculates derivatives is in Mikk space (too much complicated for a short answer)…
and i noticed that is not very accurate in some pov’s.
Python could also be a solution, if you managed to get wich editor is the right one; or OSL with getattribute("camera:pixelaspect");.

1 Like

It seems the pixel ratio is ok for me, thank you for your help.