How to set different textures using attribute [ REDSHIFT ]

   1842   6   0
User Avatar
Member
7 posts
Joined: 8月 2014
Offline
I have point attribute and I want use it to set different texture for each object. Point attribute is named frame and it's a number between 1 and 10. Files are named "code (1).png", "code (2).png", "code (3).png".... Ussualy to pass attribute to material network I use RSUserDataColor node, but I'm not sure how to pass that value to as a string to texture field.
Filename now looks like this:
$HIP/images/code ($F).png
But instead of $F it should use point attribute named frame.
Please help!



Edited by Vytautas Rimkus - 2023年7月24日 15:17:25

Attachments:
hip_file.zip (53.4 KB)

User Avatar
Member
83 posts
Joined: 6月 2020
Offline
Personally I'd just construct the texture paths using a wrangle in SOPs, save that as a string attrib on the geo then read that into your shader.
User Avatar
Member
7 posts
Joined: 8月 2014
Offline
freshbaked
Personally I'd just construct the texture paths using a wrangle in SOPs, save that as a string attrib on the geo then read that into your shader.
But how to read that into the shader. RS texture node doesn't have Filename input.

Attachments:
prev4.png (48.8 KB)

User Avatar
Member
83 posts
Joined: 6月 2020
Offline
I haven't used RS in a while but pretty sure RS has it's own node for reading in images. RSImage or RSTexture or something. Isn't TextureSampler a native Houdini node? If so, you should stick to RS nodes.

If the RS image node doesn't have a plug for filename then I'm sorry but I don't have a good answer off the top of my head.
Edited by freshbaked - 2023年7月24日 20:20:22
User Avatar
Member
7 posts
Joined: 8月 2014
Offline
I found solution. So you can pass texture name value with material node. And in the material network add filename input and connect it with the rs texture filename.

Attachments:
prev5.png (48.0 KB)
prev6.png (36.4 KB)
prev7.png (61.0 KB)

User Avatar
Member
690 posts
Joined: 2月 2017
Offline
Or you use a RS shader switch. feed in all the textures with texture nodes. Then use an integer point attribute to switch between them.

Cheers
CYTE
Edited by CYTE - 2023年7月26日 05:04:59
User Avatar
Member
136 posts
Joined: 1月 2015
Offline
You can also use the rsUserDataString connected to the Redshift OSL Texture node(From Github).
Edited by Heileif - 2023年7月26日 12:28:51
  • Quick Links