Community
Arnold for Houdini Forum
Rendering with Arnold in Houdini and Solaris using the HtoA plug-in.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

referencing point number array in an operator

1 REPLY 1
Reply
Message 1 of 2
philipborgMWE44
138 Views, 1 Reply

referencing point number array in an operator

I'm assigning texture names from an array to objects based on their point number in houdini like so:

string textureVariantBase[] = {"paint_a","paint_b","paint_c"};
i@idGrid = @ptnum;
int mapNum = i@idGrid % 3;
s@textureCol = textureVariantBase[mapNum];

..then just using <attr:textureCol>.tx in the shader.

I'm trying to find the equivalent way to achieve this with operators. It seems that foo[bar] isn't allowed as it looks for a number, is this correct? I did see the 'attr:index' token as a possible solution, but couldn't get this working either (I'm not sure how to assign a 'uint' in houdini) - but I'd prefer to build the texture name string inside a setParameter and then just keep the simpler texture token as it is in the shader.

Tags (2)
Labels (2)
1 REPLY 1
Message 2 of 2

I don't think you can something equivalent with operators and no vex.

You could create the textureVariantBase user data with an operator, but you couldn't select from it the same way. Because while you can use the modulo operator, you can't get a "ptnum"

You could use set_parameter to create uint user data, but you cannot create uniform (per face) user data.

PS For indexed facesets, you need to get HtoA to send this to Arnold:

polymesh
 {
  nsides 4 1 UINT 4 4 4 4

  declare facesets constant ARRAY STRING
  facesets 4 1 STRING "a" "b" "c" "d"

  declare faceset_id uniform UINT
  faceset_id 4 1 UINT 3 2 0 1
 }

 image
 {
  # matches e.g. tex-b.jpg
  filename "tex-<attr:facesets index:faceset_id>.jpg"
 }


// Stephen Blair
// Arnold Renderer Support

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report