Jump to content
Sign in to follow this  

[SOLVED] per-particle attributes Maya to Houdini via Alembic

Recommended Posts

Hi All,

I'm sure this question must be a common one but I have searched this forum without finding the solution I need. So, apologies if I am repeating a previous post.


Right. What I am trying to do it take some nParticles from Maya over to Houdini for rendering in Mantra.

I am using Alembic to transfer the particles. Houdini finds the particle position, P, velocity, v, and particle ID,  but not other per-particle data, such as rgbPP, lifespanPP, aimDirectionPP, etc, which I would like to carry across.

I can see that some data is there in the alembic file, but Houdini does not seem to be translating it properly.


Maybe you can see from the screen grab what is happening.

rgbPP, for example, is coming in as a massive array of floats, the size of the array is three times the number of particles.

I assume I need to wrangle the Alembic data in some way. I would be very grateful for some help with this.

I am fairly new to Houdini, VEX is not something I am experienced with, except for the very basics.


Maya 2016

Houdini 15.0.244

Windows 7x64


Many thanks,










Edited by dansidi
adding more images

Share this post

Link to post
Share on other sites

You don't really need a Wrangle in this case, what you need is an AttributePromote. Promotion allows you to transfer internal data from one aspect of geometry to another.Such as transferring color from points to faces or faces to edges etc.. You can also rename the old attribute to a new name during the promotion process. Read the help card for more detail.

In this image your case is shown. rgbPP is promoted from primitives down to points and renamed to Cd. This should make colors appear in the viewport if the particles were truly colorized in Maya.


Edited by Atom

Share this post

Link to post
Share on other sites

Hi Atom,


Thanks very much for your reply.


Now, I have applied the attribute promote node to the alembic file, now I get a massive array of Cd on each particle. This is getting out of hand!


Hopefully you can see from my screen grabs what is happening.

In the spreadsheet, the Cd[n] columns go on and on until n = 3 * number of particles.


What would you suggest I try next?


Many thanks,







Share this post

Link to post
Share on other sites

Cd should be 3 wide, not 1047 wide.

Can you prepare your attributes better out of Maya? I don't use Maya so I'm not sure what options are there.

Can you post an example Alembic with say only 10 particles for testing purposes?

Share this post

Link to post
Share on other sites

Absolutely! You can have this little alembic file (1.6MB)

It has a couple of hundred particles, each of which should have lifespanPP (single float), rgbPP (three floats).

I have been trying to wrangle the data, but I'm not quite there yet.

I don't know how to access arrays in VEX and get the data into a three-element array, for example Cd.


I got this far:


i@index = 3 * @ptnum;

f@red = f[]@rgb_PP[@index];
f@green = f[]@rgb_PP[@index + 1];
f@blue = f[]@rgb_PP[@index + 2];

v@Cd = set(@red, @green, @blue);


and I think I'm almost there. However this gives three attributes @red, @green and @blue but all are getting set to 0.0

I'm obviously not accessing the rgb_PP array properly.


I am grateful for your help, I think we are almost at the end now...








Share this post

Link to post
Share on other sites
int index = 3 * @id;

float r = v@rgbPP[0];
float g = v@rgbPP[1];
float b = v@rgbPP[2];

//printf("%d,%d,%d\n", r,g,b);

v@Cd = set(r,g,b);

This adds some color to the particles over time but I think it is always fetching the first version of @rgbPP.


I can't figure out how to get an all those values into the array so they can be indexed by @id.

I think we need some kind of VEX array expert to display the correct syntax for such operations.



Edited by Atom

Share this post

Link to post
Share on other sites

Thanks Alexander, that works!

Daniel, you may want to play around with this variation.

vector rgb[] = prim(0, "rgbPP", 0);
v@Cd = rgb[@id];

I noticed while viewing the geometry spreadsheet that @ptnum gets reused by nParticles, probably Maya's version of Houdini's reaping. So when particle#0 dies, instead of keeping it around and taking up memory as a dead element, it is assigned a new id and given new life. Initially @ptnum and @id are identical. But once particles start dying and being reborn, @id falls out of synch and becomes a unique index into @rgbPP.

Edited by Atom
  • Like 2

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
Sign in to follow this