Get the size of a texture in the material editor

Is there a way to get the width and height of a texture in the material editor?

Probably this could help.

I was hopping for a more direct approach inside the material editor, but this is fine too I guess, thanks.

You can use HLSL’s GetDimensions() instruction from within the material editor to fetch the information out of a texture object. This code in a Custom node would do the trick:

float2 dim;
TextureObject.GetDimensions(dim.x, dim.y);
return dim;

Your graph should look like this Imgur: The magic of the Internet

Thanks, really should be more posts like this with custom node