Houdini Engine 7.0
|
Houdini groups can contain primitives, points, and edges. Primitives can be whole polygon meshes, single polygons, volumes, curves, spheres, and so on. It is possible, for example, to have a single group contain some of the polygons from one mesh, some of the polygons from another mesh, a volume, and a curve, all at the same time.
It is up to the asset maker to use groups as they see fit but the most common use case for primitive groups is assigning multiple textures to the same polygon mesh. This is the reason why we by default split polygon meshes by group. See Parts for more information on this splitting.
You query information on groups by first getting a list of group names per Geo and per HAPI_GroupType, using HAPI_GetGroupNames(). The number of groups on a geo can be found by calling HAPI_GeoInfo_GetGroupCountByType() on its HAPI_GeoInfo or directly from:
Here's an example of getting group names:
You then get the membership information for the groups you're interested in, per Part this time, using HAPI_GetGroupMembership(). The membership information is a list of integers, one for each element (according to HAPI_GroupType), where 1 means the element is contained in the group while 0 means the element is not contained in the group. The size of this array is the same as HAPI_PartInfo_GetElementCountByGroupType() given the HAPI_PartInfo of the part you queried and the HAPI_GroupType.
As a helper flag, you can pass a bool pointer membership_array_all_equal
to HAPI_GetGroupMembership() to see whether all the membership values are 1 or all of them are 0 without checking each one yourself.
Here's an example of getting group membership:
You can only add groups and set group memberships on input nodes. See Marshalling Geometry Into Houdini.
To add a group to an input node call HAPI_AddGroup() and give it the desired HAPI_GroupType and group name. Then, set the group's membership using HAPI_SetGroupMembership(), with the same HAPI_GroupType and group name as well as an integer array containing the memberships. This array should be the size given by HAPI_PartInfo_GetElementCountByGroupType() on the HAPI_PartInfo you used with HAPI_SetPartInfo() and your HAPI_GroupType.
Houdini does not provide an explicit edge representation to the user. Instead, edges in Houdini are implicitly defined by pairs of points. Because of this, interacting with edge groups through HAPI differs in some respects from how you would interact with point and primitive groups.
Just like point and primitive groups, you can query information on edge groups by first getting a list of edge group names per Geo using HAPI_GetGroupNames(). The number of edge groups on a geo can be found by calling HAPI_GeoInfo_GetGroupCountByType() on its HAPI_GeoInfo or directly from:
Note that if you're getting the edge group count of input geometry, the number of edges will not be available until after the geometry has been committed by HAPI_CommitGeo().
Before you can query the edge group membership information, you must first get the number of edges in the edge group by calling HAPI_GetEdgeCountOfEdgeGroup(). This method returns the number of edges in the group. When you are allocating the array to hold the edge group membership, its size must be twice the edge count in order to hold a point pair for each edge. You can get the edges using the HAPI_GetGroupMembership() method. This method will fill the membership array with pairs of points that represent the edges that belong to the edge group.
The same process for adding and setting point and primitive groups can be used for edge groups. HAPI_AddGroup() is used to add the group and HAPI_SetGroupMembership() is used to send the point pairs defining each edge in the group.