[Sidefx-houdini-list] new points at center of poly faces

Robert Kelly isstuff at gmail.com
Wed Mar 30 16:02:39 EDT 2011


I think it may be the best trick ether way. I had used some of the
other methods in the past so when i stumbled onto it I knew it was a
winner.

On 30 March 2011 09:32, Alvaro Castaneda <varomix at gmail.com> wrote:
> great trick Robert, that works great, also the centroid SOP Sebastian posted
> works great but it looses the normals, so If you want normals Robert's trick
> is the best right now
>
> Thanks
>
>
>  *.:varomix:.*
> MIX Studio
> 3D Artist/Generalist TD
> www.varomix.net
>
>
> On Wed, Mar 30, 2011 at 9:02 AM, Robert Kelly <isstuff at gmail.com> wrote:
>
>> Correct me if this doesn't  work for you but the best trick I know is the
>> convert sop And convert to circles! You get a point per primitive with a
>> normal and some scale data if you dig in to the circles with python.
>>
>> Sent from my tiny puter.
>>
>> On 2011-03-30, at 2:16 AM, Szymon Kapeniak <szymon.kapeniak at gmail.com>
>> wrote:
>>
>> > Also prim_attribute() evaluating "P" at s=t=.5 will return centroid of a
>> quad primitive, so this can be handled in pure vex. The only catch is that
>> centroid for a triangle is at 0.3 not 0.5, and for ngons > 4 is at t=1.0...
>> ;)
>> >
>> > skk.
>> >
>> > Dnia 30 mar 2011 o godz. 09:20 sgustafso at gmail.com napisał(a):
>> >
>> >>
>> >> One approach that's reasonably efficient:
>> >>
>> >> Create a vector primitive attribute called 'center' with values
>> $CEX,$CEY,$CEZ. When creating primitive attribs, the $CE[XYZ] vars refer to
>> the primitive centroid.
>> >> Use a line sop with npoints set to nprims() to create your points, then
>> delete the line prim but keep the points. This can be slightly more
>> efficient that going through a copy sop (especially a copy sop with
>> transforms!) for high point counts if you just need to create a bunch of
>> points and move them later. ymmv.
>> >> Use a primattrib vop inside of a vopsop to apply the 'center' attribute
>> to the points. primattrib expects a geometry file, but you can feed it an op
>> path. I usually set the oppath with an expression like:
>> "op:`oppwf()`/../SOURCE_GEOM[$FF]"
>> >>
>> >> That should do it. So brief recap: attribcreate to get an attrib holding
>> the centroid, whatever method you want to instantiate a bunch of points to
>> move, then vopsop to set the positions.
>> >>
>> >> Another trick for getting the centroids is to use attrib promotions.
>> I.e,. create point attrib 'pos' set to $T[XYZ], then promote to a primitive
>> attrib with the mode set to average, leaving you with an attrib holding the
>> centroids. I've used this in the past before I realized that $CE[XYZ] would
>> work, and it seemed to scale pretty well.
>> >>
>> >> At Wed, 30 Mar 2011 17:33:36 +1000,
>> >> Rangi Sutton wrote:
>> >>>
>> >>> add sop.. copy sop with nprims("../PRIM_SRC") in the num copies, and in
>> >>> translates use prim("../PRIM_SRC", $CY, "P", 0).
>> >>>
>> >>> Make an asset. Forget about it. Maybe python does this better.
>> >>>
>> >>> Actually, I think there's an asset in that toolbox that was posted the
>> other
>> >>> day that does this.
>> >>>
>> >>> scaling prims to zero does work though.. can be a problem if you have
>> >>> identical prims.. since they'll fuse.
>> >>>
>> >>> Beers,
>> >>> r.
>> >>>
>> >>>
>> >>>
>> >>> On 30 March 2011 17:24, Miles Green <Miles.Green at al.com.au> wrote:
>> >>>
>> >>>> Hi,
>> >>>> I need to efficiently get a new point at the center of all my current
>> poly
>> >>>> faces..
>> >>>>
>> >>>> i'm sure there are multiple ways to do this, but my current method of
>> :
>> >>>>
>> >>>> [input polygons]-->[facet(uniquepoints]->[primitive (scale to
>> 0.001)]->
>> >>>> [fuse]
>> >>>>
>> >>>> is a little slow..
>> >>>>
>> >>>> any other suggestions appreciated
>> >>> _______________________________________________
>> >>> 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
>>
> _______________________________________________
> 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