Scattering Inside a Foreach Loop Issues

   2381   4   2
User Avatar
Member
14 posts
Joined: Jan. 2014
Offline
Hi all,

I am trying to scatter inside a foreach loop. I am passing the geometry to scatter on in pieces using partition and rule is based on an attribute. In each loop I change the density attribute used by the scatter node, based on the foreach iteration and reference an attribute array on the points being used to scatter on.

example
f[]@Density = [0.0, 0.2, 0.5];
f@ScatterDensity = f[]@Density[iteration];

I am completely stumped how to collect the scattered points from each loop into one whole collection outside the foreach?

Thoughts would be greatly appreaciated
Edited by neil_math_comp - May 11, 2017 11:05:57
User Avatar
Member
7771 posts
Joined: Sept. 2011
Offline
Don't use a foreach for this. Use a single density attribute on your chunks that varies in the desired way, and scatter all at once, using the density from attribute option on the scatter sop.
User Avatar
Member
471 posts
Joined: Nov. 2013
Offline
Hello.
I put a simple example hope it helps you.

Attachments:
For Each Density.hip (129.3 KB)

User Avatar
Member
1743 posts
Joined: March 2012
Offline
(Just an FYI that I added a [code vex][/code]block to the original post, so that the square brackets wouldn't be removed by the forum.)
Writing code for fun and profit since... 2005? Wow, I'm getting old.
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
User Avatar
Member
14 posts
Joined: Jan. 2014
Offline
Hi,

Thanks for the responses everybody.


@jsmack - I want to use a foreach loop to effectively do what you are saying but on several different density attributes. The asset has a data driven UI so the end-user can decide how many different scattering densities and their relationships. Trying to cater to all this in one density attribute is too chaotic in the results. But thank you for the suggestion.

@Nima Thanks that example showed me my piece context was wrong, points (DOH) in stead of primitive.

@ndickson - thank you for showing me about the code block, you saved by brackets

This was my first post here, thank you for being so gentle

R-
  • Quick Links