jehgar Posted July 3 Share Posted July 3 The effect I'm trying to achieve is getting the copied primitives to follow or flow in the direction of the guides (displayed in red) I've created using the groom tools. I'm using the attribute furdirection from the guide groom node as a source attribute. The closest example I've been able to find so far is in this tutorial (Applying Scales to Mesh Surfaces - from Konstantin Magnus). Any help would be greatly appreciated. Thank you! Quote Link to comment Share on other sites More sharing options...
Sepu Posted July 4 Share Posted July 4 Without looking at the file, I am just guessing here but the only thing you should need on your guides is orient along curve node, which should give you the vectors you need for the ctp to align the geo to the guides. And just isolate the first pt of your prims. Which you can do in a wrangle i@group_kill = vertexprimindex(0, @vtxnum)==0; 1 Quote Link to comment Share on other sites More sharing options...
jehgar Posted July 4 Author Share Posted July 4 Thank you for your response! I'm still having trouble getting the copied primitives to flow in the direction of the guides. Any thoughts on what the issue might be? 240704_Peeling.hiplc Quote Link to comment Share on other sites More sharing options...
Sepu Posted July 4 Share Posted July 4 So I few things here, The orient-along curve won't calculate the correct vectors on the meshes. Second, the prim wrangle was not doing anything since you want to affect the pts (so you need to run over pts) and it needs to be on the curves and then use a blast for the group. Or you could use the remove point function as well if you want to do it all in a wrangle, (blast it's faster btw for optimization when you have millions of pts). Usually, for instance something in H you want your obj pointing Z+ Anyway here are 2 options. One uses the point curves for the ctp or transfer the attribute from the curves into the mesh to do the same. There are other ways as well to do the same. 240704_Peeling_fix.hiplc Quote Link to comment Share on other sites More sharing options...
jehgar Posted July 5 Author Share Posted July 5 Thank you again for your help! You're new file cleared up some confusion. I made a mistake and didn't realize I was object merging the original guides, before any manipulation instead of the output guides after using the goom tools. I was racking my brain trying to figure out why the cones were pointing away from the red guides even after looking through the your updates, when in reality I was referencing the wrong node. Anyways, thank you! 240704_Peeling_fix_02.hiplc Quote Link to comment Share on other sites More sharing options...
jehgar Posted July 5 Author Share Posted July 5 I'm experiencing a new issue related to the orientation of copied primitives. While I can get the copied primitives to follow the direction of the groom guides, their orientation relative to the surface is inconsistent. However, in my other example I share in the screenshots, when I use the measure node the primitives overlap and orient themselves normal to the surface. Any help would be greatly appreciated to achieve both: getting the copied primitives to flow in the direction of the groom guides and ensuring they orient normal to the surface geometry. Thank you! 240704_Peeling_A2.hiplc Quote Link to comment Share on other sites More sharing options...
jehgar Posted July 5 Author Share Posted July 5 I think I may have identified the problem, I just don't have a solution. I believe the y coordinate of the orient attribute needs to map up with the primitive normals of the original surface. However, I'm unsure how I can get the rotation value between the primitive normals and the orient attribute to line up. 240704_Peeling_A3.hiplc Quote Link to comment Share on other sites More sharing options...
Librarian Posted July 6 Share Posted July 6 @jehgar try this with mops falloff .2 diff codes with small changes int nbs[] = neighbours(0, i@ptnum); float dist_min = 1e3;//1000 foreach(int nb; nbs){ vector pos_nb = point(0, 'P', nb); float dist_nb = distance(v@P, pos_nb); if(dist_nb < dist_min){ dist_min = dist_nb; } } float a; float b = chf("b"); f@pscale = dist_min; v@up =normalize(v@up); vector n1 = @N; vector n2 = @up; vector cz = normalize(cross(n1,n2)); v@cz = cz; float ang = radians(f@mops_falloff*180); vector4 q = quaternion(ang,cz); @N = qrotate(q,@N); @up = qrotate(q,@up); ____O______ int nbs[] = neighbours(0, i@ptnum); float dist_min = 1e3;//1000 foreach(int nb; nbs){ vector pos_nb = point(0, 'P', nb); float dist_nb = distance(v@P, pos_nb); if(dist_nb < dist_min){ dist_min = dist_nb; } } float a; float b = chf("b"); if(f@mops_falloff<0.5){ a = fit(f@mops_falloff,0,0.5-b,0,1);} if(f@mops_falloff>=0.5){ a = fit(f@mops_falloff,0.5+b,1,1,0);} f@pscale = dist_min*a; v@up =normalize(v@up); vector n1 = @N; vector n2 = @up; vector cz = normalize(cross(n1,n2)); v@cz = cz; float ang = radians(f@mops_falloff*180); vector4 q = quaternion(ang,cz); @N = qrotate(q,@N); @up = qrotate(q,@up); Quote Link to comment Share on other sites More sharing options...
jehgar Posted July 6 Author Share Posted July 6 Thanks for the help! Could I get a little more guidance with the mops falloff. I'm pretty sure I'm using it incorrectly. On a side note, I found a piece of code from a post on SideFX that aligns the y-axis with the primitive normal. However, this code also modifies the z-axis, therefore removing the tangent to the original surface which I need to maintain the direction and flow of all the primitives matrix3 m = dihedral({0,1,0},@N); float angle = rand(@ptnum)+@Time; rotate(m, angle, @N); @orient = quaternion(m); 240704_Peeling_A4.hiplc Quote Link to comment Share on other sites More sharing options...
jehgar Posted July 8 Author Share Posted July 8 After racking my brain trying to use orient and quaternions I ended up figuring out a workaround, although if anyone has any better methods of achieving the same results I would be curious. I did the following: Used ray to project the normals from the original skin surface from the groom tools onto the blasted points from the orient along curve Renamed the normal attribute to up Transferred the up attribute on to the original points 240707_Peeling_A5.2.hiplc 1 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.