Also notice that to get the list after we appended it, we have to enable Output option for the input list: Notice that the polygon index is the loop (iterator) index of the upper loop. We will create two loops, the first loop iterates over the polygons and gets the indices of the loops it contains through polygon.loop_indices, that loop in turn hands the indices to another loop which gets the small initially empty list at each of the loop indices and append the polygon index to it, set the new list to the generic list and reassign the generic list. We will append the index of the polygon to those lists indicating that the polygon is composed of that edge. We crate a list of n empty lists where n is the number of edges in the mesh, this can be done by the list comprehension for _ in range(n)]. We can get the indices of the loops through polygon.loop_indices and we can get the index of the loop edge through loop.edge_index, you can study those form the API.The implementation is nested and not direct, so take your time to understand it. So, loops can be used to identify which edges are in each polygon, but we want the inverse of that, we want a function that takes the edge and returns the polygons, this is something that we can solve by using a simple look up table. A loop also corresponds to an edge that is part of the polygon as well as share the vertex that the loop represents in the polygon, you can study this from the Design Document of the Bmesh structure.
The internal structure of meshes in Blender stores loops which are vertices of polygons, something that you may remember from our study in this answer. The problem reduces to finding the indices of the two polygons that each edge is part of. Let us define the angle of the edge as the angle between the normals of the two faces the edge is part of, that, of course, fails for boundary edge that is part of only a single polygon. The same workflow can be used, however, the boolean list used in filtering will change to be based on an angle threshold. So we can use the Mask List node to filter our edges based on the boolean list we generated before using such a node tree: To generate a boolean list of this property, we can use such list comprehension: Īnimation Nodes have a node Mask List which returns a filtered version of the input list if for each element its corresponding element in the input boolean List is True. The blender API provide access to this data through the e_freestyle_mark where it returns True if the edge is marked as a freestyle and False otherwise.
All we have to do is filter the edges by whether they are marked as freestyle or not. This works for the example of the look, but what I really want to do is draw an outline curve around it based on the view angle.Īnimation Nodes have a node Splines From Edges that takes a list of edges and vertices an returns splines that represents those edges. 3 was made by copying the object, fattening it, and moving it back behind the first object. Specifically, here's what it would need to be able to do:ġ) Create a spline/curve/vertex strand on marked edges, similar to freestyle's Edge Mark featuresĢ) Create spline/curve/vertex strand on edges based on face angles, similar to Crease.ģ) Create them based on contour/external contour, probably based on normal facing on external faces of the mesh.Ĥ) Merge the above together and add modifiers, materials, etc.ġ and 2 were made as noted, by manually duplicating a selection, separating the object, and converting to a curve. So I'm not looking for a detailed explanation, just a simple yes or no of it it works, and perhaps a rough explanation of where to start. I am not very familiar with animation nodes, so I don't know if the functionality is there, or if it is feasible. I am trying to see if Animation Nodes can be used to create geometry line art, similar to the various Line Set options in Freestyle.