Jump to content

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


dansidi

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,

 

Dan

 

alembic_01.png

alembic_02.png

alembic_03.png

alembic_04.png

alembic_05.png

alembic_06.png

Edited by dansidi
adding more images
Link to comment
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.

Untitled-1.jpg

Edited by Atom
Link to comment
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,

 

Dan

alembic_07.png

alembic_10.png

alembic_08.png

alembic_09.png

Link to comment
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?

Link to comment
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...

 

Cheers,

 

Dan

 

particleTest_v001.abc

particleTest_v001.hip

Link to comment
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.

 

Untitled-1.jpg

Edited by Atom
Link to comment
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
Link to comment
Share on other sites

  • 1 year later...

Bumping this old thread in the hope that someone sees it.

I'm having trouble getting Maya to export PP attributes, P, V and ID are there in Houdini but nothing else. (They're not there as primitive attrbs that I can promote yet)

So I think I'm missing something on the Maya side, but there's not really any options on the Alembic export. I'm trying to bring across some of the firework's examples that are in the Content Browser for a quick turn around job.

Cheers

Martin

Link to comment
Share on other sites

Don't worry, you have to list the attributes in the alembic export window but I was naming the wrong. They also seem to go into the detailed field in houdini instead of the primitive list like above, but reckon I can figure it out now

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...