question

Peter Keil avatar image
Peter Keil asked ·

Call different texture files based on primitive attributes in Houdini

Hey all,

New Arnold user here--Im using it with Houdini. Im trying to call a series of texture files from disk. There is an object that is iterated around 300 times, it has the same uv set for each iteration, but I want to call a different texture variation from disk for each iteration within the same shader. These 'objects' by the way are not objects in the maya sense, they are primitive groups within the same object--with a different primitive attribute id for each group.

When I was using mantra, I was creating material overrides using local variables. For example, the parameter 'displacement' was created on the primitives. It was a string attribute which literally specified which displacement texture maps to call based on their file location and name -- the id attribute was applied within the string to call the different textures sets

so for

id 2
the override was

displacement

`/Users/machineroom/Desktop/Justin/HOUDINI/PROJECTS/TREE_BLOOM/tex/disp_test_new/disp_test.2.exr`

This parameter (displacement) was then piped into the file input for the displacement maps.

Is there a way for me to replicate this setup to some degree using arnold?--perhaps the utility node?

This video here was helpful, but not as fully procedural as I would like considering the vast number of texture files I am going to have to call, and how specific I am going to have to be.

https://vimeo.com/265891657

Ive attached a series of picture files in hopes of making things clearer.

pic 1: The object itself

pic 2: visualization of id attributes-small window on left shows that each petal has a different id

pic 3: the material overrides set up on the object

pic 4: the shader setup itself

Thank you in advance for any suggestions

4-material-overridein-shader.png

10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Stephen Blair avatar image
Stephen Blair answered ·

Use the attr token to get user data exported on the shape

Share
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Philip Pappas avatar image
Philip Pappas answered ·

Hello, found this post after i learned python while trying to do the same thing in Houdini Mantra but as soon as i plugin to the material node my primitive attribute a warning pops saying

"Error: Infinite recursion in evaluation..."

also no textures show up on the viewport.

Can you share an example?it would be really helpful to spot the error

,

Hello, found this post after i learned python while trying to do the same thing in Houdini Mantra but as soon as i plugin to the material node my primitive attribute a warning pops saying

"Error: Infinite recursion in evaluation..."

also no textures show up on the viewport.

Can you share an example?it would be really helpful to spot the error

Share
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

rachid Hadj Abderrahmane avatar image
rachid Hadj Abderrahmane answered ·

Hi

7 months ago I did a tutorial on mtoa token <attr:> & <shapeName> , for Maya, maybe you can adapt that to Houdini
take a look here
https://www.youtube.com/watch?v=OtL7HMWyBPI

Share
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Peter Keil avatar image
Peter Keil answered ·
@Stephen Blair

Thanks. I did have that figured out finally. I think the reason its still not working is because i have to add that attr as user data inside the shader. How do I bind the string attr to the shader itself? As far as inputs are concerned the image node is what is calling the file--where does the user data attribute get plugged in? Right now I just have the user attrib node in there with the attr string, but its not plugged in yet. Ive attached another screenshot to show where im at. Thanks for the help!

screen-shot-2018-12-21-at-32739-pm.png


Share
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Stephen Blair avatar image
Stephen Blair answered ·

<attr:disppath>

Share
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Peter Keil avatar image
Peter Keil answered ·

Hey @Stephen Blair so I now have the primitives tagged with the following attribute:

basically the file locations are stored as a string and the attribute is called disppath
@disppath
'/Users/machineroom/Desktop/Justin/HOUDINI/PROJECTS/TREE_BLOOM/tex/disp_test_new/disp_test.1.exr'

etc etc.

Its a primitive attribute again

On the shader side i have the image file hooked up:

i'm trying a few different inputs to get it to call the string but im not getting any results:

The last thing I tried was

<disppath:> because i thought the other two inputs were optional..

Im obviously doing something wrong.

what is the syntax here for the input?

Thanks!


Share
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Peter Keil avatar image
Peter Keil answered ·

thanks for the quick response--trying to set it up now

Share
10 |600 characters needed characters left characters exceeded

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 5 attachments (including images) can be used with a maximum of 2.0 MiB each and 9.8 MiB total.

Welcome to the Arnold Answers community.

This is the place for Arnold renderer users everywhere to ask and answer rendering questions, and share knowledge about using Arnold, Arnold plugins, workflows and developing tools with Arnold.

If you are a new user to Arnold Answers, please first check out our FAQ and User Guide for more information.

When posting questions, please be sure to select the appropriate Space for your Arnold plugin and include the plugin version you are using.

Please include images, scene and log files whenever possible as this helps the community answer your questions.

Instructions for generating full verbosity log files are available for MtoA, MaxtoA, C4DtoA, HtoA, KtoA, and Kick.

If you are looking for Arnold Documentation and Support please visit the Arnold Support site.

To try Arnold please visit the Arnold Trial page.

Bottom No panel present for this section.