Select primitives or edges by angle

   30933   31   6
User Avatar
Member
17 posts
Joined: March 2019
Offline
goat
You can set the normal angle to 5 and RMB on the icon to Select all matching normals.

Thanks for your help – though would you mind being a little more specific as to the “where” in terms of which node to set the “normal angle” parameter on as well as what “icon” to RMB on to get that option please?
Edited by awesomedata - March 26, 2019 12:35:10
User Avatar
Member
4189 posts
Joined: June 2012
Offline
awesomedata
goat
You can set the normal angle to 5 and RMB on the icon to Select all matching normals.

Thanks for your help – though would you mind being a little more specific as to the “where” in terms of which node to set the “normal angle” parameter on as well as what “icon” to RMB on to get that option please?


The select tool has a new option in 17.5.

1. Choose the Select arrow in the tools on the leftside of the screen
2. at the top of the viewport there is a new button to select by angle.
3. Enter the angle and the RMB on the icon.
4. Select in the viewport the edge you want and all other edges that have the same direction will be selected.

Hope that helps.
User Avatar
Member
17 posts
Joined: March 2019
Offline
goat
The select tool has a new option in 17.5

Wow, thanks! I wasn't aware of this.

Unfortunately I am making a digital asset which doesn't let me use the viewport to make selections specifically.
Is there some way to do this procedurally (without manual intervention) using nodes (or VEX) somehow?
User Avatar
Member
13 posts
Joined: July 2018
Offline
Hi!

I came across this thread while looking for a similar solution - i.e select edges by angle.

I didn't really see the solution I expected (but maybe I got confused) so I thought I'd whip one up in vex.

Pop the following into an Attribute Wrangle that's set to loop over primitives.

// These could be promoted to parameters
float edge_angle = 30.0;
string group_name = "seams";

float cos_theta = cos(1.0 - radians(edge_angle));

int hedge = primhedge(0, @elemnum);
int start_hedge = hedge;
int s = 0;

// Loop through all half edges on a face and mark any that
// have a greater angle than edge_angle.
do {
    int src_vrt = hedge_srcvertex(0, hedge);
    vector src_N = normalize(vertexattrib(0, "N", src_vrt, s));
    int dst_vrt = hedge_dstvertex(0, hedge);
    vector dst_N = normalize(vertexattrib(0, "N", dst_vrt, s));
    
    int equiv_hedge = hedge_nextequiv(0, hedge);
    int equiv_src_vrt = hedge_srcvertex(0, equiv_hedge);
    vector equiv_src_N = normalize(vertexattrib(0, "N", equiv_src_vrt, s));
    int equiv_dst_vrt = hedge_dstvertex(0, equiv_hedge);
    vector equiv_dst_N = normalize(vertexattrib(0, "N", equiv_dst_vrt, s));

    if (! (dot(src_N, equiv_src_N) > cos_theta &&
           dot(dst_N, equiv_dst_N) > cos_theta))
    {
        int src_pt = hedge_srcpoint(0, hedge);
        int dst_pt = hedge_dstpoint(0, hedge);
        setedgegroup(0, group_name, src_pt, dst_pt, 1);
    }
    
    hedge = hedge_next(0, hedge);
} while (hedge != start_hedge);

Good for combining with uvautoseam and breaking up hard surface models into islands for auto UV-ing.

Hope this helps!
Dan
Render Supervisor, occasional CG supe and general trouble maker @ DNEG
User Avatar
Member
385 posts
Joined: July 2018
Offline
dankripac_dneg
Hi!

I came across this thread while looking for a similar solution - i.e select edges by angle.

I didn't really see the solution I expected (but maybe I got confused) so I thought I'd whip one up in vex.

Pop the following into an Attribute Wrangle that's set to loop over primitives.

// These could be promoted to parameters
float edge_angle = 30.0;
string group_name = "seams";

float cos_theta = cos(1.0 - radians(edge_angle));

int hedge = primhedge(0, @elemnum);
int start_hedge = hedge;
int s = 0;

// Loop through all half edges on a face and mark any that
// have a greater angle than edge_angle.
do {
    int src_vrt = hedge_srcvertex(0, hedge);
    vector src_N = normalize(vertexattrib(0, "N", src_vrt, s));
    int dst_vrt = hedge_dstvertex(0, hedge);
    vector dst_N = normalize(vertexattrib(0, "N", dst_vrt, s));
    
    int equiv_hedge = hedge_nextequiv(0, hedge);
    int equiv_src_vrt = hedge_srcvertex(0, equiv_hedge);
    vector equiv_src_N = normalize(vertexattrib(0, "N", equiv_src_vrt, s));
    int equiv_dst_vrt = hedge_dstvertex(0, equiv_hedge);
    vector equiv_dst_N = normalize(vertexattrib(0, "N", equiv_dst_vrt, s));

    if (! (dot(src_N, equiv_src_N) > cos_theta &&
           dot(dst_N, equiv_dst_N) > cos_theta))
    {
        int src_pt = hedge_srcpoint(0, hedge);
        int dst_pt = hedge_dstpoint(0, hedge);
        setedgegroup(0, group_name, src_pt, dst_pt, 1);
    }
    
    hedge = hedge_next(0, hedge);
} while (hedge != start_hedge);

Good for combining with uvautoseam and breaking up hard surface models into islands for auto UV-ing.

Hope this helps!
Dan

thanks for the vex snippet but its not working, its not creating any groups.I m trying to select all the 90 degree edges

Attachments:
InkedCapture_LI.jpg (1.3 MB)

User Avatar
Member
13 posts
Joined: July 2018
Offline
You need to make sure you have vertex normals computed already as this vex compares the angles of vertex “N” on opposite half edge vertices.

Do you have a normal node with the cusp angle set to your taste upstream?
Render Supervisor, occasional CG supe and general trouble maker @ DNEG
User Avatar
Member
89 posts
Joined: Jan. 2015
Offline
Hello,
Is it anything wrong with the group edge by angle ?

Attachments:
houdinifx_ApnAhYq17L.png (1.0 MB)

Gameloft
User Avatar
Member
13 posts
Joined: July 2018
Offline
heh, well there you go.

I guess I never tried turning off the Base Group. It just selects everything with it on.

At least that vex snippet didn't take me too long.

Thanks!
Render Supervisor, occasional CG supe and general trouble maker @ DNEG
User Avatar
Member
13 posts
Joined: July 2018
Offline
For completeness, here's that vex working with a normal sop above it.



A little hard to see as I'm on a high DPI mac…

Attachments:
Screenshot 2019-07-02 23.41.24.png (411.0 KB)

Render Supervisor, occasional CG supe and general trouble maker @ DNEG
User Avatar
Member
385 posts
Joined: July 2018
Offline
PaQ WaK
Hello,
Is it anything wrong with the group edge by angle ?

nothing wrong with edge by angle, problem was my geometry was not hollow and the group node was not working properly, so i had to append a clean sop before trying to group the edges.
User Avatar
Member
385 posts
Joined: July 2018
Offline
Thanks!
dankripac_dneg
You need to make sure you have vertex normals computed already as this vex compares the angles of vertex “N” on opposite half edge vertices.

Do you have a normal node with the cusp angle set to your taste upstream?


Thanks i ll try that, i dont think i had any vertex normals
User Avatar
Member
15 posts
Joined: Oct. 2019
Offline
I needed to bevel corner edges on a building - I did mine simply with a group node
I enabled 'Keep By Normals', and set vector Direction to 1,0,1 and Spread Angle tp 0
I enabled 'Include By Edges' and set Min Edge Angle to 1 and Max Edge Angle to 180.

This only selected corner edges, and no flat edges. You could also collapse unneeded edges using this group if needed.

Attachments:
Capture.PNG (299.7 KB)

  • Quick Links