I remember seeing builtin screen size variables in some shader code at some point. They are equivalent to Screen.height and Screen.width but i cant find anything about them now. Are there really any builtin variables for these values? if not there should be. I really dont want to have to assign these as global shader values because i need it to work without any code besides the shader itself.
Why do you need it to work without anything but the shader itself? Setting global properties is really easy, and it's not like you can use Unity to render anything without also being able to run a script.
Thanks, this is for my visual shader editor. I want to make a ScreenSize node. I guess I will have to let the end user make their own node for this if they need it.
For anyone looking, the answer to this question as of Unity3.5 is _ScreenParams.x and _ScreenParams.y
for anyone coming from google, the url is 404 now. it can now be found here: https://docs.unity3d.com/462/Documentation/Manual/SL-BuiltinValues.html
Or here if you want the documentation for the latest version of Unity instead of the version from 4 years ago: https://docs.unity3d.com/Manual/SL-UnityShaderVariables.html
As documentation said : "x is the width of the camera’s target texture in pixels, y is the height of the camera’s target texture in pixels, z is 1.0 + 1.0/width and w is 1.0 + 1.0/height." So if I understand the _ScreenParams refer more to a target texture than the screen size. In my case I create a RenderTexture on which the camera will render, so I set the target texture size of that camera and it's not the same as the screen size. I may missed something but as I undertand I don't have a way to get the screen size ?