[Sidefx-houdini-list] For each in VOP

Matt Estela matt.estela at gmail.com
Fri Feb 19 07:59:28 EST 2016


very cool!

On 19 February 2016 at 23:48, Olivier Jeannel <facialdeluxe at gmail.com>
wrote:

> For what it's worth, here's a little demo of what I was after :
> https://vimeo.com/155960784
>
> On Fri, Jan 29, 2016 at 12:03 PM, Olivier Jeannel <facialdeluxe at gmail.com>
> wrote:
>
> > Hey there,
> > I found a way to get my primpoints arrays getting sorted after using the
> > Sort sop node.
> > I changed the previous line of vex :
> > int pts[]= sort( primpoints(0,0));      //array list of points on the
> > primitive [0,1,2,3,...]
> >
> > And, now it seems to reorder the arrays as selected in the Sort sop :)
> >
> > On Wed, Jan 27, 2016 at 5:08 PM, Olivier Jeannel <facialdeluxe at gmail.com
> >
> > wrote:
> >
> >> Thank you,
> >> I'll try with a primitive vop then, see if I'll have more luck.
> >> The thing is, although I'm "rather at ease" (sorry I'm not sure it
> >> translate well in english) with classic vop node (coming from an xsi ice
> >> background), the loop system appears a bit messy at first sight _ That's
> >> why I'm asking for for loop sample for beginner :/
> >> So really, if you have a visual example of how to connect this, please
> do
> >> not hesitate.
> >>
> >> The thing is I wanted to translate my vex in vop node because I'm having
> >> a problem with primpoints in vex.
> >> I have this loop :
> >>
> >>
> >> vector tata[];                                //build empty array of
> >> vector
> >> vector pos[];                                //build empty array of
> vector
> >> int pts[]=primpoints(0,0);             //array list of points on the
> >> primitive [0,1,2,3,...]
> >>
> >> i at j=(primvertexcount(0,0));        //number of points on the primitive
> >> (4)
> >>
> >> for (int i=0;i<@j;i++)
> >> {
> >> tata[i]=point(0,"N",pts[i]); //buil array with all normal
> >> pos[i]=point(0,"P",pts[i]); //build array of position
> >>
> >> }
> >>
> >> v at edge_axis =tata[ch("index")];
> >> v at pivot = pos[ch("index")];
> >>
> >>
> >> About primpoints the doc says : This function returns an array of
> points,
> >> in the same order as stored on the primitive itself.
> >>
> >> But if I use a Sort sop node (random)  before the Attributes Wrangle
> >> node, I can see the order of the ptnum has changed BUT the order of my
> >> arrays has not change.
> >> The array put the values alwys in the same order.
> >>
> >> Other than that, the scene works beatifully, it's just I'd like to be
> >> able to reorder (sort) these arrays.
> >>
> >> Am-I doing something wrong ? I'am a real beginner in coding.
> >>
> >>
> >> On Tue, Jan 26, 2016 at 10:59 PM, Jesse Erickson <
> >> mr.nicey.pants at gmail.com> wrote:
> >>
> >>> Good advice up top :) Re: the old trick, you can just use a Primitive
> Vop
> >>> now. Vop Sops are deprecated and Attrib Vops will iterate over points,
> >>> verts, prims or run only once in detail mode. That's what I meant about
> >>> skipping the For Each Loop and just running it in a Primitive Vop!
> Lotsa
> >>> ways to crack this nut
> >>>
> >>> On Tue, Jan 26, 2016 at 1:04 PM, Andrew Lyons <tstexture at gmail.com>
> >>> wrote:
> >>>
> >>> > 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
> >>> > >
> >>> > _______________________________________________
> >>> > Sidefx-houdini-list mailing list
> >>> > Sidefx-houdini-list at sidefx.com
> >>> > https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
> >>> >
> >>> _______________________________________________
> >>> Sidefx-houdini-list mailing list
> >>> Sidefx-houdini-list at sidefx.com
> >>> https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
> >>>
> >>
> >>
> >
> _______________________________________________
> 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