Material variation in stage through a wrangle

   220   2   0
User Avatar
Member
3 posts
Joined: May 2024
Offline
Hi I am looking for a way to change the filepath of a material through a wrangle in lops via a primvar.
The closest I've come is this:
s@inputs:file = "texturepathx.jpg";
This line is meant to test if it's possible to assign a texturepath to a material via a wrangle. Which works.
string map = s@primvars:map;
Here I'm getting my primvar containing my texture.
s@inputs:file = map;
Here I'm trying to assign the primvar to my file attribute.

The problem I currently have is that the wrangle is trying to retrieve the primvars:map attribute from the mtlximage primitive itself, instead of getting it from my geo prim.

I'm currently just testing it with one texture, but my goal is to be able to change the file input based on a primvar with varying texture paths.

Sadly doing this in the shader itself is not possible due to me working houdini 20.5.

Any help or different approaches are welcome!
User Avatar
Member
9262 posts
Joined: July 2007
Offline
you can't set inputs:file attribute on a single material primitive itself to a varying value, since that material has no idea to which primitives it may be bound and how such values would map to them

you either need a material per variation, which you can easily do even in 20.5 using Assign Material LOP and it's Parameter Override VEXpression which will create material variations for you automatically (example attached)

or the override can happen automatically using primvars during render, however for string primvars this is possible only since 21.0 for XPU
Edited by tamte - Sept. 20, 2025 13:12:03

Attachments:
ts_texture_per_prim_variation_20.5.hipnc (296.0 KB)

Tomas Slancik
CG Supervisor
Framestore, NY
User Avatar
Member
3 posts
Joined: May 2024
Offline
That works perfectly! Thank you so much!
  • Quick Links