Jump to content

lookup vop?

Recommended Posts

After struggling with the ramp parameter's lack of bezier handles, with catmull-rom always wanting to put a hump right in the place I'd like to smooth out, I've decided that it might be easier to input my own lookup values.


While there's a lookup cop, and lookup chop, there is unfortunately no lookup vop.  Is there a vop or vex command I'm overlooking? If not, what could I search for to find the concept of how to implement some lookup code in a vex snippet?


An example file is attached below if anyone would like to offer any ideas. 


(I'd like to keep all this in an attrib vop if possible, as eventually I'd like to implement it in a shader as a companion to the sop version.  So I haven't used the channel editor->parameter->chf() workaround here.)


Link to comment
Share on other sites

there is ch() function in VEX you can use (so Inline VOP or Snippet VOP)

there you can specify time as well so you can lookup channel at certain time

you can use chf(), chv(), ... to get float, vector, ... parms directly

Link to comment
Share on other sites


Though, Is there any way to remap to another vops value?

what do you mean by that?


EDIT: oh, I see your file

for looking up you need a function like y=f(x), where you supply x and you'll get y

so arbitrary single value will not do

if your "value" (function)  is noise, simply plug your VALUE_TO_CHANGE as a position input to the noise to lookup the noise value, etc, you simply need the function

Edited by anim
Link to comment
Share on other sites

Oh, I just used the noise as a simple example... in another larger setup I had a value coming in that I really wanted to modify based on another calculated value, like one would with lookup cop or chop


If that functionality wasn't built in, I thought it might be a good chance to look into the math behind a lookup operation, but I have yet to find a good explanation.



Link to comment
Share on other sites

as I said you need a function

so as CHOP channel is essentially a function over time or COP collumn/row is a function over x or y, you can directly lookup the value

but for SOP attributes you have just values on components so no function unless it's directly VOP function or you decide that you want to sample values over certain path on the surface


so for example if you have values on the curve that you want to sample, you can use primuv() VEX/Primitive Attribute VOP to lookup the value based on u coordinate or for NURBS based on u/v


otherwise I don't really know what you expect to lookup the value by

if you assume that the geo is grid (like COPs, or line like CHOPS) you can directly sample based on x or y or z axis and the closest surface using xyzdist() function

the same if it's not a grid and you want to lookup value from the closest surface


you can as well have your "value" in the volume and lookup that using volumesample()

Edited by anim
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.

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