dynamic filename in texture node

   3106   2   1
User Avatar
Member
143 posts
Joined: Sept. 2017
Offline
I'm working on a project, where I need to get many different pictures on a wall and would like to do it in a smart way. I got the model with the frames already modeled from the client, I grouped together the canvases, used a wrangle node to assign every primitive a random integer from 1 to X, X being the number of image files in a folder, all named 1.jpg to X.jpg.

I'm using Redshift, already figured out I can't use primitive attributes, but only point attributes, so I had to promote the attribute. I've bound the Filename string to a spare input in the Texture node, I have a working DataInteger node in my material builder, the only thing missing is to connect the output of the data integer node (so the attribute) to the texture node's Spare Input 0.
Attached is a screenshot of the whole thing… I need to connect somehow the Output of the RSUserDataInteger1 to the SpareInput0 of TextureSampler1, then everything should hopefully work.

How would you go about this?

Attachments:
Capture.JPG (65.5 KB)

User Avatar
Member
1 posts
Joined: Jan. 2015
Offline
Hi Ivan, Did you end up figuring this out? I'm looking to do the same with Redshift, drive the texture file names with primitive attributes, but haven't figured out a solution yet.
User Avatar
Member
143 posts
Joined: Sept. 2017
Offline
Nick Loy2
Hi Ivan, Did you end up figuring this out? I'm looking to do the same with Redshift, drive the texture file names with primitive attributes, but haven't figured out a solution yet.


Hi Nick,

from what I managed to find out and test myself, there are two ways to go about this:

You could use the Shader Switch node, that can switch between up to 10 textures based on incoming ID. For more textures, you'd need to combine more of them and the whole thing would get unnecessarily complicated very quickly. Though I did use this approach at first and it worked.

The other, and in my opinion better way to do this is to use UDIMs. So instead of creating a new attribute, you just offset the UV coordinates by different amounts. Then, you specify the texture path as ../genericTextureName<UDIM>.jpg, the <UDIM> part should be contained in the link in this exact notation and corresponds to udim coordinates contained in the file name, as described here: Your text to link here… [docs.redshift3d.com]. This way, you get a virtually unlimited number of randomly assigned textures only using a single RS Texture node.

Hope this helps.
Ivan
  • Quick Links