Archived post by matte

Just a random thing if anyone finds it useful – here’s some vex to quantise a value to steps, with variable smoothness: “` float smoothstep(float n; float x) { if (n == 0) return x; return 1.0/(1.0+pow(1.0/x-1.0,n) ); }
vector smoothstep(float n; vector x) { if (n == 0) return x; vector un = {1,1,1}; return un/(un+pow(un/x-un,n) ); }
// step: levels of quantisation // val: value to quantise // rolloff: smoothness
val *= step; vector fraction = smoothstep(rolloff, frac(val)); val = floor(val) + fraction; val /= step; “`

default houdini smooth() doesn’t work symmetrically

Attachments in this post:
http://fx-td.com/houdiniandchill/wp-content/uploads/discord/20192210/08/19/smoothquant.png

Archived post by matte

@nicholas ralabate afaik it doesn’t make a RAT, so blurring/filtering can be slow

imo image texture access in vex is just slow in general

On a recent project which involved lots of SOPs/VEX texture access I accellerated it substantially by first pre-loading the texture into a 2D volume, then sampling the volume rather than the texture

Archived post by jake rice

@dchow @CoskuTurhan “`Hello Jake, There are two phases to cooking a DOP frame: the network pass and the solve pass. Former takes care of setting parameters and building the sequence of operators that are to act on the objects; the solve pass then actually invokes these operators. The issue is that substepping triggered by the Gas Substep solver is done as part of the solve pass, while the Switch Solver gets its switch value set during the network pass. To perform its solve, Gas Substep DOP basically determines how many substeps to take and calls its sequence of input operators that number of times. So when the Switch Solver is reached, it uses the switch value that was evaluated at the network pass. In other words, the value of that parameter does not get refreshed for each of your substeps.
You can get the behaviour you want by disabling Override with Default and using the data specified in Switch Value Name. This data will have to be modified to account for your frame number logic, which can be done fairly easily with a Script Solver. Note that this works because the parameter value is static (name of the data to use), but the actual data stored gets evaluated every time the node goes to perform its solve. “`

Archived post by Reinhold

looks like vtx0 is {0, 0, 0}, vtx1 is {1, 0, 0}, vtx2 is {0, 1, 0} and vtx3 is {0, 0, 1}. and any point in between is just a linear interpolation of these four values. shouldn’t take too long to get there now

got it working now. building a matrix from the tet vertex positions and running an inverse transform on the point position puts the sample point into the normalized barycentric space, i.e. the new point position is the barycentric coordinate

“` int prims[]; vector p = v@P; vector vtxp[];
prims = primfind(1, v@P, v@P);
foreach(int prim; prims) { for(int i=0; i<4; i++) { vtxp[i] = vector(point(1, "P", primpoint(1, prim, i))); } matrix3 mat = set(vtxp[1] - vtxp[0], vtxp[2] - vtxp[0], vtxp[3] - vtxp[0]); p -= vtxp[0]; p *= invert(mat); } v@uv = p;“`

Archived post by rbowden

No worries. I never got an answer in here before and honestly glad Im not the only one running into the issue.

FWIW I also emailed SideFX about this also and got this response:
Hello Ryan,
If you want to use the white selection arrow button, you’ll need to replace the script in the script_action tag. These scripts tend to be highly context dependent, and I’m guessing that the current tag was just copied by dragging a group field with the white selection arrow button into the Edit Parameter Interface. The main function being called, soputils.selectGroupParm(), takes a dictionary of arguments to control how it operates. Since I don’t think it’s possible to edit multi-line scripts in the Tags list UI, the easiest way is to just set your script_action tag “kwargs[‘node’].hdaModule().scriptFunction()” and then define this scriptFunction() in your HDAs PythonModule.
You can take a look at the source for soputils.selectGroupParm() in $HFS/houdini/python2.7libs/soputils.py for things that function tries to do and the arguments it expects. You can set kwargs[‘nodepath’] to the path of the node from which you want to select, or set kwargs[‘node’] to point to a node from whose input you want to select and kwargs[‘inputindex’] to specify which index.