Primvars in texture filepaths question

   1606   3   1
User Avatar
Member
77 posts
Joined: Oct. 2016
Offline
Hello there,
managed to load up textures based on primvars, but seems primvars have to match full path because i cant modify the string attribute form inside the shader or can i?
My usual workflow usually looked like i put an attribute on geo like @tx_name = "Concrete", and then from file input i extend it to "C:/folderstructure/"+@tx_name+"resolutonfolder"+"diffuse.exr" but in usd i have to bake in the primvars every single textures absolute path and modify primvars if for example want to hook up texture from different folder or want to change resolution of the maps? Or do i miss something?
Many thanks!
User Avatar
Member
77 posts
Joined: Oct. 2016
Offline
No idea anyone?

I also noticed since karma xpu seems not read primvars, but still would be cool to able to use expressions for filenames somehow.
Cheers!
User Avatar
Staff
4438 posts
Joined: July 2005
Offline
In VEX with Karma CPU I'm fairly certain you could do this using the VEX string manipulation methods. But I don't know what sort of capabilities MaterialX has for building paths from strings like this.
User Avatar
Staff
468 posts
Joined: May 2019
Offline
blakshep
I also noticed since karma xpu seems not read primvars, but still would be cool to able to use expressions for filenames somehow

This is a common request.
eg
https://www.sidefx.com/forum/topic/86748/ [www.sidefx.com]

String primvars are not working XPU yet, but we do have it planned.

In the meantime there are alternatives...
- use UDIMS (a float-primvar can be used to offset the UV coordinate, or order to choose what texture you want)
- have multiple texture/image nodes in the scene, and use a switch node to choose the result. (ie you'd have an integer primvar to select what texture you want)
  • Quick Links