Hi guys,
When I check “apply to points” parm on in the ForEach Sop with “Each Attribute Value” chosen, I see some points swap their point numbers to each other.
Of course this doesn't happen if I write point attribute value as “$PT” in the AttributeCreate Sop. But even when I change the attribute value to “rand($PT*324)”, the order of point numbers don't seem to follow the attribute values. Just wonder why the swapping occurs when I use the “apply to points” parameter.
Thanks in advance, hope see some threads
Sewang
ForEach Sop Applied to Points
7005 8 0- bird7king
- Member
- 3 posts
- Joined: 1月 2011
- Offline
- zdimaria
- Member
- 390 posts
- Joined: 1月 2012
- Offline
in trying to find out what was going on, i found some more weird behavior. i set up mostly the same network, but in my file, toggling apply to points also changes the attributes that were being fed into the for each sop. this makes no sense to me, but before i shout bug.. maybe someone with more knowledge could take a look?
toggling apply to points, while looking at the details view sorted by attribute1, the attributes go from 2, 2, 4, 5, 5, 6, 7.. to 2, 2, 4, 5, 6, 7, 9… how can this be? the attribute is created before the foreach sop.. why would the foreach sop ever change attributes?
toggling apply to points, while looking at the details view sorted by attribute1, the attributes go from 2, 2, 4, 5, 5, 6, 7.. to 2, 2, 4, 5, 6, 7, 9… how can this be? the attribute is created before the foreach sop.. why would the foreach sop ever change attributes?
.
- zdimaria
- Member
- 390 posts
- Joined: 1月 2012
- Offline
- tamte
- Member
- 8795 posts
- Joined: 7月 2007
- Offline
the way how For Each Sop works for Attribute values is a little tricky
it will loop through all points/primitives in order and for each attribute value it will gather all primitives/points with the same value within tolerance and process them in the same iteration
then it will merge results from all iterations as a separate geometries into one so this will change primitive/point order for all cases (except for case when you loop over individual primitives/points in original order)
it is not changing the value of the attribute though, it may seem so since it gets reordered
so what you can do is create integer attribute holding original primitive/point numbers with $PR or $PT prior to for loop and then after the loop, sort it back according to that attribute using Sort SOP
it will loop through all points/primitives in order and for each attribute value it will gather all primitives/points with the same value within tolerance and process them in the same iteration
then it will merge results from all iterations as a separate geometries into one so this will change primitive/point order for all cases (except for case when you loop over individual primitives/points in original order)
it is not changing the value of the attribute though, it may seem so since it gets reordered
so what you can do is create integer attribute holding original primitive/point numbers with $PR or $PT prior to for loop and then after the loop, sort it back according to that attribute using Sort SOP
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
- zdimaria
- Member
- 390 posts
- Joined: 1月 2012
- Offline
cool, but my point is that the foreach is changing the attribute values. theyre not just reordered. if you open the details view, sorted by attribute1 in my file, not by point number, the values are 2, 2, 4, 5, 5…. uncheck apply to points, and yes the order of the points change, but resort by attribute1 in the details view and you get 2, 2, 4, 5, 6. the foreach is indeed changing the values of point attributes.
.
- bird7king
- Member
- 3 posts
- Joined: 1月 2011
- Offline
Thanks guys,
Inside the Voronoi Fracture Sop, there are a bunch of ForEach Sop Nodes, actually one of which is being used in the way that you've just mentioned(using Sort Sop). And yeah, when I set the tolerance parm to 0, it rarely seems to have the swapping anymore. Still I see the swapping occurring sometimes.
Zack, I don't think they're changing. For example, if you keep track of the attribute value of point 5, you'll see the same value for point 5 even after ForEach sop (applied to points) applied; swapping occurred.
Inside the Voronoi Fracture Sop, there are a bunch of ForEach Sop Nodes, actually one of which is being used in the way that you've just mentioned(using Sort Sop). And yeah, when I set the tolerance parm to 0, it rarely seems to have the swapping anymore. Still I see the swapping occurring sometimes.
Zack, I don't think they're changing. For example, if you keep track of the attribute value of point 5, you'll see the same value for point 5 even after ForEach sop (applied to points) applied; swapping occurred.
- zdimaria
- Member
- 390 posts
- Joined: 1月 2012
- Offline
- zdimaria
- Member
- 390 posts
- Joined: 1月 2012
- Offline
- 66184727
- Member
- 1 posts
- Joined: 12月 2010
- Offline
-
- Quick Links