[Sidefx-houdini-list] For each in VOP

Andrew Lyons tstexture at gmail.com
Tue Jan 26 16:04:58 EST 2016


and keep in mind that vex is SIMD, and runs in parallel where possible.
Think of a vop sop as essentially a single function (or shader), and its
multiple data input is every point in the first input. Last time I checked
that last part was hard coded, so in some sense a vop sop is always a hard
coded foreach loop over every point in the first input. Given this, the
following code:

For each Primitive:
    Import P from Point index N°3.

Is actually:

Foreach point:
    For each Primitive:
        Import P from Point index N°3.

And you may not want that.

An old trick is to make sure your first input only has as many points as
the number of iterations you actually want, and then index data from the
second input. In your example, you would want npoints in your first input
to match nprims. Use a facet sop to Unique points, a primitive sop to scale
each Primitive to zero on its centroid, and then another facet/fuse sop to
consolidate points to achieve that.

After that - what Jesse said.

Good luck!
On Jan 26, 2016 4:49 AM, "Olivier Jeannel" <facialdeluxe at gmail.com> wrote:

> Hi list,
>
> I'm looking for simple tutorial or example about the For Each Loop in VOP.
> I've seen the Masterclass https://vimeo.com/142534639
>
> What I'd like to do is
> For each Primitive, Import P from Point index N°3.
> I managed to write it in vex, but I'm stuck reproducing this in AttribVOP.
>
> If anyone has 5mn :/
> _______________________________________________
> Sidefx-houdini-list mailing list
> Sidefx-houdini-list at sidefx.com
> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>



More information about the Sidefx-houdini-list mailing list