Jump to content

How to use grooming guides to drive the direction of copied primitives


Recommended Posts

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!

240703_SS_01.png

240703_SS_02.png

Link to comment
Share on other sites

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;

 

  • Like 1
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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_SS_03.png

240704_SS_04.png

240704_Peeling_fix_02.hiplc

Link to comment
Share on other sites

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!

 

 

240705_SS_03.png

240705_SS_02.png

240705_SS_01.png

240705_SS_04.png

240704_Peeling_A2.hiplc

Link to comment
Share on other sites

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. 

240705_SS_AfterOrientEdit_06.png

240705_SS_BeforeOrientEdit_06.png

240704_Peeling_A3.hiplc

Link to comment
Share on other sites

@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);

 

Link to comment
Share on other sites

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);

 

240706_SS_MOPS-Falloff_Error_01.png

240706_SS_Before-Orient-Rotation_01.png

240706_SS_After-Orient-Rotation_01.png

240704_Peeling_A4.hiplc

Link to comment
Share on other sites

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:

  1. Used ray to project the normals from the original skin surface from the groom tools onto the blasted points from the orient along curve
  2. Renamed the normal attribute to up 
  3. Transferred the up attribute on to the original points 

240707_SS_01.png

240707_SS_02.png

240707_Peeling_A5.2.hiplc

  • Thanks 1
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...