I am loading a USD file with primvars, using a file node on the stage. I can't use an import USD in a geo node.
I want to use a primvar to create a group based on a threshold.
In the Obj/geo I would create a group based on an attribute threshold and then assign a material to the new group.
I don't see how to export the usd geometry with primvars to the sops context.
I don't see a way to create groups using the primvars in the lops context.
Any suggestions. I am new to USD and Solaris, so this may be something basic, but I couldn't find anything in the forum or in google.
Primvars and Groups
2317 2 0- brad_carvey
- Member
- 2 posts
- Joined: June 2020
- Offline
- jsmack
- Member
- 7755 posts
- Joined: Sept. 2011
- Offline
I'm not sure what you mean by a group, that concept doesn't really exist in USD. If you want to create a primitive selection using primvar values, I think they have to be constant primvars, and you can use a vexpression to select by value. This primitive selection pattern can either be used to define a collection, or used directly in a material assignment. The material assignment node also has vex pression/cvex shader to further generate the assignment procedurally.
None of these methods will allow assigning different materials to different ‘prim groups’ within the same mesh. The mesh would need to be authored with geomsubsets first (the equivalent of primitive groups in USD), or the meshs split into multiple meshes.
An example adhoc collection based on a string primvar:
or more simply:
None of these methods will allow assigning different materials to different ‘prim groups’ within the same mesh. The mesh would need to be authored with geomsubsets first (the equivalent of primitive groups in USD), or the meshs split into multiple meshes.
An example adhoc collection based on a string primvar:
{ string matname[] = usd_primvar(0, @primpath, "material_name"); if (len(matname)>0) return matname[0]=='redpants_mtl'; }
or more simply:
{ string matname[] = usd_primvarelement(0, @primpath, "material_name", 0); return matname=='redpants_mtl'; }
Edited by jsmack - Aug. 22, 2020 14:35:50
- mtucker
- Staff
- 4438 posts
- Joined: July 2005
- Offline
I'm going to take a different approach on this question and assume that you are trying to define “groups” within a single Mesh primitive, rather than defining “groups” of USD primitives…
If so, then what you're looking for are Geometry Subsets in USD. There is the Geometry Subset LOP to define subsets, and the Material Assignment LOP can actuall create geometry subsets and assign materials in a single node. I've attached a file that demonstrates both of these nodes in a very simple way.
If you have already defined your mesh “partition” using a primvar in USD, you can easily use SOPs to define a SOP group based on this primvar attribute. Primitive groups in SOPs get imported to LOPs as Geometry Subset when using the SOP Import LOP (though you may need to specify the names of the SOP groups that you want to import as subsets - I don't recall exactly).
If so, then what you're looking for are Geometry Subsets in USD. There is the Geometry Subset LOP to define subsets, and the Material Assignment LOP can actuall create geometry subsets and assign materials in a single node. I've attached a file that demonstrates both of these nodes in a very simple way.
If you have already defined your mesh “partition” using a primvar in USD, you can easily use SOPs to define a SOP group based on this primvar attribute. Primitive groups in SOPs get imported to LOPs as Geometry Subset when using the SOP Import LOP (though you may need to specify the names of the SOP groups that you want to import as subsets - I don't recall exactly).
-
- Quick Links