So I'm trying to wrap my head around VEX coding for use in the Attribute Wrangle node in SOP context and I need a function like the hscript picni() function in order to do a pixel color lookup from a COP2 node. Using the old Point SOP, I would have used an expression like this (to, for example, set the red channel of the Cd attribute):
picni("../artwork/OUT", $BBX, 1 - $BBZ, D_CR)
Where artwork is a COP2 network and OUT is simply a Null node at the end of the comp nodes yielding the final image to use for pixel lookups.
So what is the equivalent of that in SOP-context VEX code?
I had to clamp the bounding box values to 0.9999 because rawcolormap() wraps a value of 1.0 around to 0.0, an annoying behavior that picni() does not exhibit.
This is a lot harder to read than the hscript expression it replicates. I hope it has superior performance to make up for that.
you can also use texture() call which has variadic arguments for filtering and wrapping but also Attribute From Map SOP which will provide that for you without coding, just provide uvs and yes, the performance is uncomparable, picni() is very slow
tamte you can also use texture() call which has variadic arguments for filtering and wrapping but also Attribute From Map SOP which will provide that for you without coding, just provide uvs and yes, the performance is uncomparable, picni() is very slow
(BTW, the Attribute From Map SOP doesn't have “edge” or “clamp” type wrapping options, so I'll be sticking with the above VEX expression in an Attribute Expression SOP.)
jrcooper (BTW, the Attribute From Map SOP doesn't have “edge” or “clamp” type wrapping options, so I'll be sticking with the above VEX expression in an Attribute Expression SOP.)
according to help edge clamp and streak are equivalents so it does have the option you need:
clamp or edge or streak The texture coordinates will be clamped to the range 0 to 1. This causes evaluations outside the range to evaluate to the color at the closest edge of the image (the border pixels are streaked outside the range).
black or decal or color Coordinates outside the range 0 to 1 will evaluate to the border color (rather than a color in the image). The border color is black (i.e. 0) by default.
but you can also use texture VOP as jsmack mentioned