Jump to content
Spamuel91

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

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!

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

You can also use the VEX function setattribtypeinfo() to change the signature of a given attribute after the fact to things like "color", "normal", etc.

  • Thanks 1

Share this post


Link to post
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!

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×