Search the Community
Showing results for tags 'multiply particles'.
-
Hello, I`m working on Ink style effect. I would like to add point in between two (or more) nearest existing points, interpolate velocity and push new point slightly in vel direction, to have little bit more circular interpolation. That works well, better than point jitter or different cheap techniques. I would like to still fell motion from original sim. But I stuck on duplicated positions of some points, which is logical, other points can have similar near point. So I would like to add some counter, so if there were pair in past, don`t create new point. We are talking about millions of new points, so I need it as cheap and straight forward as possible. Basic idea, with some new points duplicated: float maxDistance = chf("maxDistance"); float minDistance = chf("minDistance"); int maxPoints = chi("maxPoints"); int nearPnts[] = nearpoints(0,@P,maxDistance, maxPoints); foreach (int pnts; nearPnts){ float distance = distance(point(0,"P",pnts), @P); if (distance > minDistance){ vector nearPos = point(0,"P", pnts); vector nearVel = point(0,"v", pnts); vector centerPos = lerp(nearPos, @P, 0.5); vector centerVel = lerp(nearVel, @v, 0.5); centerPos += centerVel * chf("pos_offset"); int newPoint = addpoint(0,centerPos); setpointattrib(0,"v",newPoint,centerVel); setpointattrib(0,"id",newPoint,@id*1000); setpointattrib(0,"newBorn",newPoint,1); } } I`m trying to add some counter ("tested") but seems like I cant read this attribute and my head is twisted I can see in spreadsheed, that "tested" has some range, so I need to connect with it. Any idea? Thanks a lot float minDistance = chf("minDistance"); int maxPoints = chi("maxPoints"); i@tested = 0; int nearPnts[] = nearpoints(0,@P,maxDistance, maxPoints); foreach (int pnts; nearPnts){ float distance = distance(point(0,"P",pnts), @P); setpointattrib(0,"tested",pnts,1,"add"); if (distance > minDistance && point(geoself(), "tested", pnts) == 1){ vector nearPos = point(0,"P", pnts); vector nearVel = point(0,"v", pnts); vector centerPos = lerp(nearPos, @P, 0.5); vector centerVel = lerp(nearVel, @v, 0.5); centerPos += centerVel * chf("pos_offset"); int newPoint = addpoint(0,centerPos); setpointattrib(0,"v",newPoint,centerVel); setpointattrib(0,"id",newPoint,@id*1000); setpointattrib(0,"newBorn",newPoint,1); } }
- 3 replies
-
- 1
-
- krakatoa
- multiply particles
-
(and 3 more)
Tagged with: