Jump to content

Getting Texture resolution


Recommended Posts

Hi guys,

I just tried asking this over on the official forums, but they died on me just as I hit submit so I've no idea if it was posted or not.

Simply put, I'm looking for a way to get the resolution of a texture, specified in a SOP operator.

I can get size from a COP 2 NET -> File node, but it seems I have to trigger the COP to update the size parameter - the only way I can see to do this is to physically switch to a compositor view.

Is there either:

i) A way to force the COP to update when I change the texture reference in my SOP

or

ii) A more elegant way of going about this? Perhaps through hscript/python or VEX, though I see the Resolution node and ixres/iyres functions are all COP context...I assume they'd leave me with the same issue?

Any pointers appreciated.

Thanks in advance.

Edited by Adam T
Link to comment
Share on other sites

  • 1 year later...

you can use res() expression to get resolution of the COP node, it'll force it to update if necessary

or

if you want to avoid COPs you can use hou.imageResolution() to get resolution of image file directly

I was searching for that kind of elegant solution for a while. Thank you very much for your tip.

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...