Targetting sub-geometry in Solaris in a crowd sim

   4512   14   1
User Avatar
Member
11 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

User Avatar
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.
Edited by frostfx - Nov. 16, 2021 06:53:58
User Avatar
Member
11 posts
Joined: March 2016
Offline
frostfx
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.
Ah - 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.
User Avatar
Member
11 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
User Avatar
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
Edited by frostfx - Nov. 16, 2021 13:58:44
User Avatar
Member
11 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
User Avatar
Member
45 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

Attachments:
material_assignment.png (98.9 KB)
subgeo_var.png (122.7 KB)

User Avatar
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.
User Avatar
Member
45 posts
Joined: July 2009
Offline
frostfx
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.
Hey,
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

Attachments:
sg2.png (212.0 KB)
solaris_crowd_instance_subgeo_variation.zip (2.4 MB)

User Avatar
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.

Attachments:
solaris_crowd_instance_subgeo_variation_mod.hip (389.8 KB)

User Avatar
Member
45 posts
Joined: July 2009
Offline
frostfx
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.
Thanks for your file. If you disable the seed in your shirt shader, the colors are the same per agent.

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

Attachments:
rand_attrib.png (166.0 KB)
solaris_crowd_instance_subgeo_variation2.zip (2.2 MB)

User Avatar
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).
User Avatar
Member
45 posts
Joined: July 2009
Offline
frostfx
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).
You 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.
User Avatar
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
User Avatar
Member
7 posts
Joined: Jan. 2021
Offline
In fact when I managed to select my geo corectly, it's the Assign Material which give me error for tempting assigning materials to proxies:
  • Quick Links