Jump to content

A good way for making grid divisions depend on pixel resolution


Recommended Posts

Hi,
I have quite a specific question. What would be a good and straightforward way to make a grid's divisions and aspect ratio depend on an image I am to use in an Attribute from Map SOP to color it? My aim at the moment is a HDA that let's the user choose an image from the hard drive, adds it's colors to the grid and calculates the divisions of that grid and the aspect ratio of that grid based on the image. Currently it seems to me I have to jump through using either Python, COPs context or VEX shader context, although it seems like something that perhaps is somehow still doable in only SOPs and VEX/VOPs. I don't have nothing against doing it in COPs, shader VOPs or Python, I just haven't thought of a straightforward way to get information from one of these areas to SOPs. Under shader VOPs there is a Resolution node that should give these numbers perhaps in the most straightforward way, and there are the COP specific VEX functions ixres and iyres and inputs in the COP VOP node, but at the moment the way VEX and VOPs work in COPs seems different enough from SOPs that I haven't found out a good way to get these numbers into SOPs. Same problem with using Python node in SOPs. Any ideas on how best to tackle this?

Edited by Jaanus
syntax errors, missing words
Link to comment
Share on other sites

Thank You! This was a very helpful response indeed. Although the size calculation doesn't work for me for some reason yet, although triple-checked the spelling (will probably give a go at finding a fix myself later), Your solution to my main question indeed was straightworward and a lot more elegant than any route I thought I would have to go through. In addition You gave me some ideas on how to tackle some other problems in the future. Thank You!

Edited by Jaanus
Link to comment
Share on other sites

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...