Multiple shaders on an Agent

   4006   3   1
User Avatar
Member
1269 posts
Joined: March 2014
Offline
I'm playing with the Crowd tools, and I'm loving it so far. I did run into a problem with my character, because of packed primitives and multiple shaders.

I looked through some tutorials on how to work with packed primitives, but I could not find a way to retrieve the groups or name attributes on the crowd agent.

What would be the right way to extract the name attributes and apply multiple shaders back onto the character agents?

Any idea.
Werner Ziemerink
Head of 3D
www.luma.co.za
User Avatar
Member
2658 posts
Joined: June 2008
Offline
I am still struggling with how to apply multiple shaders to a multi-mesh FBX file. So I am wondering about multiple materials on complex agents as well.

You can drop down a PopWrangle and use VEX code to directly fetch groups, names and really any attribute that is applied to the agents.


string handle_path = “opobj/crowd_sim:crowdobject/Geometry”;
int agent_count = npoints(handle_path);
string my_group = point(handle_path,“agentgroup”,@id);
for (int i = 0; i < agent_count; i++) {
string candiate_group = point(handle_path,“agentgroup”,i);
candidate_location = point(handle_path,“P”,i);
candidate_distance = length(candidate_location - @P);


It is also possible to go the other way and write directly to the attributes of each agent.

setpointattrib(geoself(), “sf_enemy_id”, i@id, i, “set”);
setpointattrib(geoself(), “sf_enemy_distance”, i@id, candidate_distance, “set”);
setpointattrib(geoself(), “sf_enemy_location”, i@id, candidate_location, “set”);


This approach kind of turns the attributes into a multi-global variable sheet.
.
.
.
Ah, check this out.
https://www.sidefx.com/docs/houdini14.0/nodes/sop/unpack [sidefx.com]

You can apply material stylesheets when unpacking the agents. Do you have an Unpack node in your sim?
Edited by - Oct. 2, 2015 13:16:02
Using Houdini Indie 20.5
Windows 11 64GB Ryzen 16 core.
nVidia 3060RTX 12BG RAM.
User Avatar
Member
1269 posts
Joined: March 2014
Offline
Thanks, I will give it a go.

Normally I use the Packed Edit node on packed prims (as per Rohan Delvi's tutorial), but with agents it does not have the group or name attributes available after baking out the agent.

If I unpack the crowd all the agents pick up the materials correctly, so I was hoping that there was a easier way to get it to work without Material Stylesheets. Unpacking slows down everything to a halt.

Will let you know if I get it up and running.

Thanks again
Werner Ziemerink
Head of 3D
www.luma.co.za
User Avatar
Member
1269 posts
Joined: March 2014
Offline
I tried the PopWrangle VEX code, but get a syntax error. I have no VEX experience, so it makes no sense to me.

Still can't get more materials to show up on agents. :cry: :cry: :cry:
Werner Ziemerink
Head of 3D
www.luma.co.za
  • Quick Links