Mike Battcock
mike.battcock
About Me
Connect
LOCATION
Not Specified
WEBSITE
Houdini Skills
Availability
Not Specified
Recent Forum Posts
Randomising crowd textures per model with Solaris and Arnold May 11, 2025, 3:57 a.m.
I think I'm close...
I'm now storing the texture path without the variant number on the clothes geometry before I create the agent.
I then use a wrangle lop to create a random "variant" primvar per agent.
I can then assemble the full file path in my shader by using tokens in the Arnold image node:
<attr:texture><attr:variant>.jpg
This works however the randomisation is done per agent not per clothing model on the agent, so if two agents have the same clothing combination and the same (texture) variant attribute then they will have identical clothes and textures. I want to increase randomisation by randomising per clothing model, not agent.
Is this possible?
The only other options I can think of that could maybe work:
- generate a random number in the shader (which I think would work per agent clothing item?..) and then use something like osl to concatenate the texture prefix and the random number to get the full path
Or maybe create a shader per clothing model - we have around 70 clothing models so managing 70 shaders isn't ideal.
Or creating duplicating the clothing models for each texture variant or something but this sounds like a terrible idea...
I'm now storing the texture path without the variant number on the clothes geometry before I create the agent.
I then use a wrangle lop to create a random "variant" primvar per agent.
I can then assemble the full file path in my shader by using tokens in the Arnold image node:
<attr:texture><attr:variant>.jpg
This works however the randomisation is done per agent not per clothing model on the agent, so if two agents have the same clothing combination and the same (texture) variant attribute then they will have identical clothes and textures. I want to increase randomisation by randomising per clothing model, not agent.
Is this possible?
The only other options I can think of that could maybe work:
- generate a random number in the shader (which I think would work per agent clothing item?..) and then use something like osl to concatenate the texture prefix and the random number to get the full path
Or maybe create a shader per clothing model - we have around 70 clothing models so managing 70 shaders isn't ideal.
Or creating duplicating the clothing models for each texture variant or something but this sounds like a terrible idea...
Randomising crowd textures per model with Solaris and Arnold May 10, 2025, 4:12 a.m.
I'm able to randomise skin textures with something like this in a wrangle lop:
int variant = floor(rand(@elemnum+ch("seed")) * 10);
string root = chs("root");
s@primvars:diffuse = sprintf('%s/skin_%s.exr',root,variant);
And then loading the diffuse attribute in a User Data String in my Arnold shader which plugs into an Arnold image vop filename.
That works well but I need to do something similar for the clothes. The clothes have specific textures for each model (with a number of variants per model) so I need to incorporate the asset name when building the texture path. How can I do that and still have a random variant per agent?
Or is this better achieved with a material variation lop? Does that work with Arnold?
If I can solve that i would like to take it one step further... The number of texture variants is not always the same for each model. I've written a python script to scan the folders and count the number of available variants. I can store this on the geometry before I create the agent and then this attribute is available in the shape library in lops. So in my wrangle I would like to:
- get the asset name (from the lop node name)
- find the corresponding "texture_variants" number from the shape library
- create a random variant number based on the number of available variants
- build the texture path and save it as a primvar
- use the primvar in my shader
I'm new to Solaris so any help would be a massive help.
int variant = floor(rand(@elemnum+ch("seed")) * 10);
string root = chs("root");
s@primvars:diffuse = sprintf('%s/skin_%s.exr',root,variant);
And then loading the diffuse attribute in a User Data String in my Arnold shader which plugs into an Arnold image vop filename.
That works well but I need to do something similar for the clothes. The clothes have specific textures for each model (with a number of variants per model) so I need to incorporate the asset name when building the texture path. How can I do that and still have a random variant per agent?
Or is this better achieved with a material variation lop? Does that work with Arnold?
If I can solve that i would like to take it one step further... The number of texture variants is not always the same for each model. I've written a python script to scan the folders and count the number of available variants. I can store this on the geometry before I create the agent and then this attribute is available in the shape library in lops. So in my wrangle I would like to:
- get the asset name (from the lop node name)
- find the corresponding "texture_variants" number from the shape library
- create a random variant number based on the number of available variants
- build the texture path and save it as a primvar
- use the primvar in my shader
I'm new to Solaris so any help would be a massive help.
Mplay scripting Dec. 20, 2024, 8:47 a.m.
Yea but there are a few issues with the OpenGL ROP too:
- its not representative of the viewport, e.g. it doesn't have the viewport background colour, it doesn't show the grid, the lighting settings are separate to the viewport settings. This can be good sometimes but also unhelpful if you just want a straight viewport render that matches what you can see in the viewport
- the frame range in mplay starts at 1 regardless of the frame range you set on the OpenGL ROP - it does actually render the correct frames, but the playback starts from 1 in Mplay which is unhelpful and inconsistent with doing a flipbook from the Flibpook button
- its not representative of the viewport, e.g. it doesn't have the viewport background colour, it doesn't show the grid, the lighting settings are separate to the viewport settings. This can be good sometimes but also unhelpful if you just want a straight viewport render that matches what you can see in the viewport
- the frame range in mplay starts at 1 regardless of the frame range you set on the OpenGL ROP - it does actually render the correct frames, but the playback starts from 1 in Mplay which is unhelpful and inconsistent with doing a flipbook from the Flibpook button