![]() ![]() ![]() See if you can replicate the workflows shown above with an attribute interpolate sop (some work, some don't), and vice versa, see if you can do what an attribute interpolate does in vex.This creates 2 executables ViennaPS2D and ViennaPS3D which run processes in 2 or 3 dimensions respectively.Using the above, how would you get cars to properly orient themselves on the curve? The lazy way is to use a trail sop, set it to calculate and if there's no other attribs, will point the copied geo along but how would you then convert to so its a stable rotation? There's hints elsewhere on the wiki for this, but see if you can work this out yourself.Try primuv with curves/polylines, see if you can push points along a curve, see how you might use it for a simple crowd system.Find the example on this site of using attrib interpolate with a scatter sop, see how similar it is to the primuv trick.It assumes that you have points with and and will use those to lookup geometry from the second input, and interpolate attributes from what it finds (mostly people just want Use modulo with time to animate the uv vector you feed to primuv to have shapes smoothly slide across a single poly grid It's primary purpose is to make scattered points be stable on animated geometry, but if you look at how it works and the attributes it expects, it's very similar to the ideas shown so far. It's worth pointing out that you can sometimes avoid vexing yourself into a corner and use the attribute interpolate sop instead. Henry Foster goes into a lot more detail on his blog: I primid v uv dist dist = xyzdist ( 1, P, primid, uv ) P = primuv ( 1, 'P', primid, uv ) Cd = primuv ( 1, 'Cd', primid, uv ) Go back to a 10x10 grid, create a point with an add sop and position it somewhere near the grid, connect the point to the first input of a wrangle, grid to the second, and try this: Similar to the rotate and scale matrix functions, because this function can return more than one piece of information, but vex doesn't support that kind of thing, you setup placeholder variables first, call the function referencing those variables, and afterwards, those variables will contain the information you need. But what if we want to bridge these two ideas? Ie, we have a position in 3d space, and we want to get an attribute from the closest position on some geometry. Primuv gives you any attribute you want if you give it a parametric uv location. Minpos gives you the closest on geometry when you feed it some arbitrary position. Incidentally, if you've ever done some mantra rendering, applied a texture to a default grid, and wondered why you get a per-face uv even if you haven't assigned anything, this is why in the absence of 'real' uv's, mantra will fall back to parametric uv's instead. ![]() Here's a primitive tube, sphere, line, grid, circle, and their corresponding parametric uvs: They won't always be in a square shape as you get with a 4-sided poly, but they should guarantee that you can reference any single position on the primitive shape without overlaps. If my calculations are correct, all surface type primitives (so no volumes/metaballs) should have parametric uv's. Now increase the scatter count, and increase the number of divisions on the grid, you can see that the red/green gradient corresponds to each prim: You can visualise this with a scatter sop, output tab, turn on 'sourceprimuv', but change the name to 'Cd'. It takes the first vertex of the prim, then the last, and uses that to define a 0:1 gradient across it. This is calculated per primitive, and can be thought of as a 2d bounding box style calculation, on the surface of the prim. This is because primuv (and a few other tools) use what are called parametric uvs. Here I've put a uv project and uv quickshade on the grid before the wrangle, and I can slide around the uv properties as much as I want, the rubber toy still moves in exactly the same way: In fact, even if you do create uv's in whatever way you specify, the behaviour will be the same. Those with sharp eyes might have wondered how we can specify uv coordinates to the primuv function, but we have no attributes. Note that in all these examples, whats going on is giving us an interpolated value it knows the value of P and N at the points that define the primitive, and by us specifying a uv, its using that to interpolate between those points for the attribute you specify. Here I've switched the grid to nurbs mode, used a mountain sop to give it some animated noise, now we have the geo rolling over a stormy sea (the nurbs grid is treated as a single prim): ![]() Or more practically, this works on a deforming nurbs mesh. ![]()
0 Comments
Leave a Reply. |