Jump to content

How to create a custom colour attribute in the format of Cd[rgb] rather than Cd[012]


Spamuel91

Recommended Posts

Hi guys,

I'm trying to make custom colour attributes so that I can export various properties across to Maya. In the past to access this data in Maya via alembic I have had to make sure there is a vertex vector attribute with the channels being rgb(Cd.r, Cd.g, Cd.b). This is fine if I am just taking across just the standard colour, but ideally I would like to take across several custom colour attributes. So I have tried creating new attributes but they always seem to default to being in the format of customColour.0, customColour.1, customColour.2, even if I select the attribute type to be colour. I'm sure I'm probably missing something fairly obvious, but is there any way to change this format or create the attribute with rgb channels rather than 012?

I hope all that makes sense let me know if any of it is unclear or if you need any other details and I'll get that to you as soon as I can.

Thanks guys!

Link to comment
Share on other sites

1) in houdini it doesnt matter if it's xyz, rgb, 012. Any vector component can be accessed with any of those conventions (attrib.x and attrib.r but attrib[0])

2) use a attribcreate, set type to color and you get rgb in the spreadsheet instead of 012

Edited by 3dome
  • Thanks 1
Link to comment
Share on other sites

Thanks for the responses guys!

Dominik, really appreciate the advice, I am aware that in houdini it doesn't really matter what format it is in as they are all vectors regardless, however importing these into Maya as an alembic seems to fail unless they are in the format rgb. I realised I was approaching the attribute create incorrectly, so instead of setting the type to vector, the correct approach as you said would be to leave the type as a float with the type qualifier set to color, then increase the size to 3. That all seems to work perfectly with that set up, so thanks for pointing me in the right direction.

Henry, the setattribtypeinfo() type info also worked a treat for switching it once it had already been created, so thanks for that too!

Link to comment
Share on other sites

You can also use Attribute Create SOP to edit. Set it to the same as the attribute you want to edit, un-tick "write values" and you can change the float type to color/vector etc.

edit: Also it actually does matter for Houdini what type it is, sometimes. If you set it to "position", and then put down a Transform SOP and move the geo - you will notice the attribute will translate too. The same applies for "vector"/"normal" and rotations etc.

Edited by Skybar
  • Thanks 2
Link to comment
Share on other sites

10 minutes ago, Skybar said:

edit: Also it actually does matter for Houdini what type it is, sometimes. If you set it to "position", and then put down a Transform SOP and move the geo - you will notice the attribute will translate too. The same applies for "vector"/"normal" and rotations etc.

that's of course true and an important thing to remember! Thanks for pointing it out.

I was referring to accessing a certain component, maybe should have included the transformation behaviour for completeness

Link to comment
Share on other sites

23 minutes ago, Skybar said:

You can also use Attribute Create SOP to edit. Set it to the same as the attribute you want to edit, un-tick "write values" and you can change the float type to color/vector etc.

edit: Also it actually does matter for Houdini what type it is, sometimes. If you set it to "position", and then put down a Transform SOP and move the geo - you will notice the attribute will translate too. The same applies for "vector"/"normal" and rotations etc.

Brilliant! Thanks for such a thorough response David! Good point about the transform too.

Edited by Spamuel91
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...