HLSL Get Dimensions

I was wondering if it was possible for HLSL code to retrieve the pixel size of a texture and use it as a constant, which can then feed into the rest of a material chain. I found a few pages regarding HLSL’s ability to do this, but not any concrete way to implement this in the material editor, or any performance considerations. From what I’ve seen, it seems better to simply input this number as a constant parameter than as a value, but because of how complex my tiling shader is getting, any way to simplify this for the end user would be much appreciated.

Hi mariomguy, seems that GLSL doesn’t have similar functionality (that i could find); the easiest way would be to have a parameter and set the value via a parameter. I’ll add a request for a custom material node for getting the size (which then the Engine would fill in, or use the ‘nice’ version on D3D).

Thank you so much! The thought of creating a material node that the engine can fill-in with values at compile time just blew my mind!