Jump to content

How to create a detail attribute of size 9?


magneto

Recommended Posts

Hi,

I want to save a matrix3 as a detail attribute temporarily. How can I do this?

I can't do it with AttribCreate, nor there is a Detail SOP. Is this not possible?

I can't create it on points and promote it from there though because then for 1M points, it will take 1M iterations. I only want to store a hard coded value. So it doesn't really exist anywhere.

Thanks :)

Edited by magneto
Link to comment
Share on other sites

That's exactly what I mean in my first post. My incoming geometry is very heavy, adding a point attribute for the matrix that will be the same value for each point and promoting it after that is very nonoptimal IMO.

I was hoping a direct way to set the detail attribute values.

Link to comment
Share on other sites

Thanks, I could do that, but even though I said temporary, I didn't mean it's only used once and then deleted.

I meant it's added onto your incoming geometry and then modified slightly and then that version is kept forever, unless you delete it yourself.

I could make an example file, but it's basically this:

[incoming geo]

-> [add matrix3 detail attribute]

-> [do some trivial operations]

-> [modify the matrix3 detail attribute]

[out of subnet]

...

[next incoming operators]

So in the end the detail attribute should stay on the actual geometry. Sorry for being clear about it, because your temporary 1 point vopsop method would work otherwise.

This is the bit that deludes me :)

Link to comment
Share on other sites

You can use detail string attribute and store your matrix as string.

then use matrix expression function to convert string to matrix and then use explodematrix, explodematrixp to extract components.

Here is example where i got the obj transform, stored it as detail string attribute and then transformed back at sop level:

3ak_store_matrix_as_attrib.hipnc

  • Like 1
Link to comment
Share on other sites

Thanks, that's an interesting idea. I was thinking of using python to create a new operator just to do this.

Although in your method, I won't be able to store the final detail attribute as float9, right?

So using it via a string or a temporary point attribute like Kim suggested works to modify the value, but in the end I would really like to have it as float9.

IMO the AttribCreate SOP interface should show additional components if the size is greater than 4. Then none of these workarounds would be needed.

Link to comment
Share on other sites

I think everything > 4 floats is intended to store as string. that's why there is bunch of expression functions to extract, convert from/to string.

As for the python, you're definitely better at it so i may guess only if it's possible to store array of floats per object (using your own python node for that).

Link to comment
Share on other sites

Thanks, yes it's possible to do it in python, using:

hou.Geometry.addAttrib which both allows you to specify the type of the attribute but also a sequence of floats.

Are you sure about everything >4 to be strings though? Because adding a matrix/matrix3 point attribute actually saves them as float16 and float9 respectively.

It's just that the non-point attributes don't seem to have that UI support.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...