cudarsjanis Posted July 23, 2019 Share Posted July 23, 2019 (edited) Hi. I have a particle sim where I have dense and sparse particle areas. I would like to set pscale for all sparse particles close to 0. I made this wrangle following Entagma tutorial with forloop, but when I apply this wrangle to the sim with millions of particles, it`s way too heavey. Any other approach how I could achieve same result? Attached there is hip. And using Cd just for visualization purposes. Cheers Janis points.hip Edited July 25, 2019 by cudarsjanis Quote Link to comment Share on other sites More sharing options...
bunker Posted July 24, 2019 Share Posted July 24, 2019 you can try with pcnumfound(), have a look: point_density_bunker_001.hipnc 1 Quote Link to comment Share on other sites More sharing options...
cudarsjanis Posted July 24, 2019 Author Share Posted July 24, 2019 9 hours ago, bunker said: you can try with pcnumfound(), have a look: point_density_bunker_001.hipnc This works nicely. Just rendering now to see how it works for moving particle cache. Thanks a lot! I`m doing this post sim as I couldn`t get my particles do that in the sim. I used pop vop for vel update and was mixing v with noise to get particles more streaky together, like plasma. it works untill some point and then the further they get away, some of them just leave dense areas. Basically I was trying to get whitewater foam like behavior, so sim is streaky. any idea how I could use pcnumfound() in pop wrangle. where less dense particles would try to stick to areas where is more dense? I`ll attach hip. How far I got for this plasma look. Cheers Janis points2.hip Quote Link to comment Share on other sites More sharing options...
bunker Posted July 25, 2019 Share Posted July 25, 2019 sure, you need 2 things: - finding how many points are within a radius: with pcnumfound() - finding the average position within that radius: with pcfilter() // pointcloud handle (found points within a radius) int handle = pcopen(0,"P",@P,chf("radius"),chi("maxpoints")); // average position within a radius vector p = pcfilter(handle,"P"); // point density (normalized) float density = pcnumfound(handle)/float(chi("maxpoints")); // display density @Cd=density+{0,0,1}; // move points towards the average position // particles with less density will move more @P += (p-@P)*chf("regroup")*(1-density); points3.hipnc 2 Quote Link to comment Share on other sites More sharing options...
cudarsjanis Posted July 25, 2019 Author Share Posted July 25, 2019 (edited) On 24/07/2019 at 10:50 PM, bunker said: sure, you need 2 things: - finding how many points are within a radius: with pcnumfound() - finding the average position within that radius: with pcfilter() // pointcloud handle (found points within a radius) int handle = pcopen(0,"P",@P,chf("radius"),chi("maxpoints")); // average position within a radius vector p = pcfilter(handle,"P"); // point density (normalized) float density = pcnumfound(handle)/float(chi("maxpoints")); // display density @Cd=density+{0,0,1}; // move points towards the average position // particles with less density will move more @P += (p-@P)*chf("regroup")*(1-density); points3.hipnc Dude, you`re a legend! Works perfectly. Just gonna adjust influence by age, as I need that only for the tips at the shot that I`m working on, and it`s done. Thanks a lot. Cheers Janis Edited June 7, 2021 by cudarsjanis Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.