Targetting sub-geometry in Solaris in a crowd sim
5347 14 1- ChrisCousins
- Member
- 16 posts
- Joined: March 2016
- Offline
Hi - hope someone can help. I've got a crowd sim that I'm trying to migrate from Mantra to Karma. In Mantra the materials work via style sheets, works fine.
In Solaris, the problem seems to be that agent geo isn't accessible. I can assign a material per agent, but can't access the sub-geometry to get different materials on clothing, hair etc.
Here's the scene graph - I've got all agents called 'Suzie' just for testing purposes. The string '*/sopcrowdimport1/suzie' correctly selects all the character geometry. However I can't get it to select the components; using '*default_Ch41_Hair*' selects nothing. This is my first proj using solaris (as you might notice...) so hopefully there's a basic fix ;-) Cheers -- Chris
In Solaris, the problem seems to be that agent geo isn't accessible. I can assign a material per agent, but can't access the sub-geometry to get different materials on clothing, hair etc.
Here's the scene graph - I've got all agents called 'Suzie' just for testing purposes. The string '*/sopcrowdimport1/suzie' correctly selects all the character geometry. However I can't get it to select the components; using '*default_Ch41_Hair*' selects nothing. This is my first proj using solaris (as you might notice...) so hopefully there's a basic fix ;-) Cheers -- Chris
- frostfx
- Member
- 44 posts
- Joined: May 2017
- Offline
Hi,
you can do this via collections. Just make sure you have the "Allow Instance Proxies in Collection" checkbox enabled and use whatever primpattern method that works best, for example something like %reference:/sopcrowdimport1/agentdefinitions/suzie/shapelibrary/path to your selection
Then in the assign material node you can use the collection and under Material Binding set the Method to Collection Based.
This way you can assign different materials to all of your shapes and do agent based variations inside the shader based on primvars.
you can do this via collections. Just make sure you have the "Allow Instance Proxies in Collection" checkbox enabled and use whatever primpattern method that works best, for example something like %reference:/sopcrowdimport1/agentdefinitions/suzie/shapelibrary/path to your selection
Then in the assign material node you can use the collection and under Material Binding set the Method to Collection Based.
This way you can assign different materials to all of your shapes and do agent based variations inside the shader based on primvars.
Edited by frostfx - Nov. 16, 2021 06:53:58
- ChrisCousins
- Member
- 16 posts
- Joined: March 2016
- Offline
frostfxAh - interesting! I was trying to replicate the stylesheet workflow (ie assign main materials and then overwrite with variations. This is new to me but sounds like it'll do the job - thanks! Will report back if there's any progress.
Hi,
you can do this via collections. Just make sure you have the "Allow Instance Proxies in Collection" checkbox enabled and use whatever primpattern method that works best, for example something like %reference:/sopcrowdimport1/agentdefinitions/suzie/shapelibrary/path to your selection
Then in the assign material node you can use the collection and under Material Binding set the Method to Collection Based.
This way you can assign different materials to all of your shapes and do agent based variations inside the shader based on primvars.
- ChrisCousins
- Member
- 16 posts
- Joined: March 2016
- Offline
Failed I'm afraid, I can't seem to make this work. I've attached the collection and apply material setups just in case I did anything stupid, but whatever I do seems to result in either all the agents getting the hair material, or none of the agents getting any materials at all - going to go back to style sheets for now and lumber on with Mantra, will have another stab at this another time.
Edited by ChrisCousins - Nov. 16, 2021 12:51:40
- frostfx
- Member
- 44 posts
- Joined: May 2017
- Offline
all should be good in the collection part, just make sure under options the allow instance proxies checkbox is enabled.
On the assign material node it seems like you have not set the primitive pattern to the collection. So instead of the default expression it should read: %hairselect
Also for this to work you dont need to include the descendant primitives in Collection. Under Path /sopcrowdimport1 should work at your case and you can leave the name part empty.
Its pretty tricky to get your head around everything working with crowds in Solaris at first, but ive found it rewarding in so many parts already
On the assign material node it seems like you have not set the primitive pattern to the collection. So instead of the default expression it should read: %hairselect
Also for this to work you dont need to include the descendant primitives in Collection. Under Path /sopcrowdimport1 should work at your case and you can leave the name part empty.
Its pretty tricky to get your head around everything working with crowds in Solaris at first, but ive found it rewarding in so many parts already
Edited by frostfx - Nov. 16, 2021 13:58:44
- ChrisCousins
- Member
- 16 posts
- Joined: March 2016
- Offline
Thank you so much for persevering with me on this, we have hair! I even managed to work out variations without too much fussing around (who am I kidding it took quite a few goes, but all good now):
Thanks again for your patience! For anyone else new to this, here's the working setup with collection + material:
Cheers - Chris
Thanks again for your patience! For anyone else new to this, here's the working setup with collection + material:
Cheers - Chris
- louisx
- Member
- 46 posts
- Joined: July 2009
- Offline
frostfx
Its pretty tricky to get your head around everything working with crowds in Solaris at first, but ive found it rewarding in so many parts already
Hello,
thanks for your explanation, helped me a lot.
Following your workflow I get a material assignment, varying per instace proxy.
Now I would like to vary the material parms, per instanced proxy ( brian_body, brian_pants, ... ) to pick up different textures. The MaterialVariation node only allows me to vary per instanced Agent ( brian_1 ). So I cant vary based on the subgeo.
Is there a way to make it work?
Thanks in advance,
Cheers Martin
Edited by louisx - April 6, 2022 16:40:18
- frostfx
- Member
- 44 posts
- Joined: May 2017
- Offline
one option you could do is assign different attributes to your agents and then use those for the variation. So rather than assigning different pants materials to different agents you can assign a master pants material to all the pants and let the attributes decide what kind of variant each agent gets. Im not sure if thats the most efficent way (having lots of attributes on lots of agents) but thats the approach we ended up using for a recent production due to the way our agents were setup in the first place.
- louisx
- Member
- 46 posts
- Joined: July 2009
- Offline
frostfxHey,
one option you could do is assign different attributes to your agents and then use those for the variation. So rather than assigning different pants materials to different agents you can assign a master pants material to all the pants and let the attributes decide what kind of variant each agent gets. Im not sure if thats the most efficent way (having lots of attributes on lots of agents) but thats the approach we ended up using for a recent production due to the way our agents were setup in the first place.
thats exaclty what I want to do, and how i have set it up.
I have one shirt material, it gets the agentname from the instanced agents and loads the correct textures.
But it seems I can only read from the instanced primitive ( brian_1 for examples ) not the instanced proxys ( briand_body, brian_pants, ... ).
This way I could assign joshs_shirt to brian. And the shader would still pick up the correct textures.
I dont know if its even possible.
I also attached a simple hip file to demonstrate the problem. Vary shader parms per instanced proxy.
Cheers Martin
Edited by louisx - April 7, 2022 05:35:44
- frostfx
- Member
- 44 posts
- Joined: May 2017
- Offline
im not sure i understand exactly. modified your file slightly to what i was refering to. You cant assign materials directly to instance proxys but you can target them via collections. Right now your collection is targeting the agents themselves, which you dont really need to do. You can assign different attributes to your agents in sops and use them to vary your instance proxys in all kinds of ways you need.
- louisx
- Member
- 46 posts
- Joined: July 2009
- Offline
frostfxThanks for your file. If you disable the seed in your shirt shader, the colors are the same per agent.
im not sure i understand exactly. modified your file slightly to what i was refering to. You cant assign materials directly to instance proxys but you can target them via collections. Right now your collection is targeting the agents themselves, which you dont really need to do. You can assign different attributes to your agents in sops and use them to vary your instance proxys in all kinds of ways you need.
I would like to read an attribute from the instanced proxy geo and feed that to the shader. So in Sops i would give josh_shirt the attribute rand=1 and josh_pants rand=2. Then in Solaris the shader pics up the "rand" per instance proxy, not just per agent. Thats why I assigned the same shader to all instanced proxys. Probably its easier with multiple shaders, just want to know if its possible with one.
I thought that there is maybe a way to achive this, I m not writing to instanced proxy just reading an attribute from it. Also the material gets binded directly to the instanced proxy, at least in the scene graphtree I see the binding.
Attached a new hip, with an updated Agent, containing the a random attribute per subgeo.
Cheers
Edited by louisx - April 7, 2022 16:50:32
- frostfx
- Member
- 44 posts
- Joined: May 2017
- Offline
I think its actually doing what you expect it should. Looks like the random node in the shader just fails for some reason. Sorry we use only materialX nodes, but if you connect the bind node directly to basecolor you can see that the primvar is indeed picked up (or if you feed it to float to vec first input set the other ones to 1 and feed that into a hsvtorgb, the materialX way, since there is no random node in materialX).
- louisx
- Member
- 46 posts
- Joined: July 2009
- Offline
frostfxYou are right, its working. Just had to uncheck the "clamp position to integer" toggle on the random node, MaterialX also works. Thanks a lot for pointing me in the right direction.
I think its actually doing what you expect it should. Looks like the random node in the shader just fails for some reason. Sorry we use only materialX nodes, but if you connect the bind node directly to basecolor you can see that the primvar is indeed picked up (or if you feed it to float to vec first input set the other ones to 1 and feed that into a hsvtorgb, the materialX way, since there is no random node in materialX).
- antini
- Member
- 7 posts
- Joined: Jan. 2021
- Offline
Hello there,
We are working on a crowd system too inside Solaris (with Arnold rendering) but we are kind of stuck with material attribution.
For each Mesh, we have a GeomSubset for each shop_materialpath. They are inside the shapelibrary but as you can see, they exist also inside instances.
So we try your solution, but I have the impression that the expression "%reference:/geo/Crowd_Import/agentdefinitions/definition_*/shapelibrary/*/SHOP_*" doesn't refer to any geometry. Did they change this pattern with the latest version ?
That's what I did so far :
If you have any idea about what i'm doing wrong, I am all ears !
Cheers
We are working on a crowd system too inside Solaris (with Arnold rendering) but we are kind of stuck with material attribution.
For each Mesh, we have a GeomSubset for each shop_materialpath. They are inside the shapelibrary but as you can see, they exist also inside instances.
So we try your solution, but I have the impression that the expression "%reference:/geo/Crowd_Import/agentdefinitions/definition_*/shapelibrary/*/SHOP_*" doesn't refer to any geometry. Did they change this pattern with the latest version ?
That's what I did so far :
If you have any idea about what i'm doing wrong, I am all ears !
Cheers
- antini
- Member
- 7 posts
- Joined: Jan. 2021
- Offline
-
- Quick Links