dmu
Hi there this has been bugging me and I have been messing around for a few days.  Hopefully some of the users here can shed some light, or just comments on how the setup can be improved would be appreciated.  Anything in brackets refers to the node name in the scene.

I have a bunch of cubes instanced using copier onto a cylinder.

I have a point node at the beginning (spacing_point) that has an expression on weight to control distribution, so I don't get a cube on every point, but rather a checker board type pattern.  This is multiplied with the RGB vertex colors (multVertColors_point) so that the areas I have painted black also do not have instances.

This weightPP attr goes into a group node (weightMapToComps_group) set to weightMap operation, and this feeds the rest of the network, namely a pointAttributeToArray (prunedComps_pointAttributeToArray) that outputs position and normal to the copier.

Okay!  So far so good.  BUT, I noticed the point count is still the same no matter what I change in the weight expression.  For example, as a test, if I kill all particles over $ID 200 with a simple if statement in the weight block, the cubes dissapear, but the poly count stays the same!  Only if I switch the prunedComps_pointAttributeToArray useComponents attr to "Input Component List", then set "Prune" to On, does the poly count change.  However, this ruins the instance placement and orientation.

There's also a few textures to play with scale, but whatever, ignore those.

My simple powers of deduction have produced the following:

My network is still carrying the weight expression through to the final result somehow, and I just need to fix the connections to all somehow respect the pruned component list, but i have not been successful in doing so yet.

Scene file is attached, if anyone can shed some light on this, or point out how I could simplify, that would be amazing.




pshipkov
You can think about it this way:
- on the input you have a point cloud
- each point has associated attributes - like position, weight, rotation, etc.
- under the hood these are just arrays of data
- these length of these arrays has to match so the data is properly mapped - point 200 has weight and rotation that are the 200th elements from other arrays
- if you delete bunch of points then you have to delete and bunch of data in the rest of the arrays, but you don't do that. As a result data gets mapped the wrong way.

When you delete points this deletes array elements and shrinks the array.
Do the same with the rest of the arrays and things will work just fine.
Or delete the points beforehand and use the result to accumulate the rest of the data.
Reply 0 0
dmu
Yeah I knew that was generally what was going wrong, just needed to find the right combination of nodes to solve it :)

I eventually got it working, I'll post the things that tripped me up as a new user for anyone who reads.

As you say, it's the array sizes that is the problem.  A lot of len(getAttr) helped me see which plugs were compatible or not.

First, most nodes have the ability to use the Input Component List, but only the pointAttributeToArray has the "prune" option, which actually changes the size of the array rather than simply ignoring some values.

Therefore, all nodes that required a inGeometry plug needed the pruned point list, so I used  pointCloudToMesh after the pointAttributeToArray which was pruning the components, so that made those arrays the correct size.

A note about the pointCloudToMesh node, it seems like the output did not carry tangent data unless the "map" option was checked on?  Not sure why that is, but I needed the tangent/binormal data and that had me confused for a while.

Thanks for the reply Peter!
Reply 0 0
pshipkov
tangents are calculated in UV space.
i will tweak something in there, so when you request tangents it will do it without asking for "uvs" flag to be turned on.
Reply 0 0
Reply