per-particle attributes from Maya nParticles to Houdini via Alembic

   4430   5   2
User Avatar
Member
59 posts
Joined: Oct. 2010
Offline
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
Edited by dansidi - Oct. 11, 2016 02:51:48

Attachments:
alembic_01.png (599.7 KB)
alembic_02.png (62.3 KB)
alembic_03.png (41.5 KB)
alembic_04.png (71.6 KB)
alembic_05.png (46.5 KB)
alembic_06.png (45.4 KB)

User Avatar
Member
59 posts
Joined: Oct. 2010
Offline
Hello again,

I have been given a clue to solving this problem, which is to use the Attribute Promote node, which will move the rgbPP attribute from the primitive, to the particle context.

Now, I'm not entirely convinced this is correct, but let's go along with it. Here is what happens:

Maybe you can see what is going on.

I have applied the attribute promote node to the alembic file, now I get a massive array of Cd on each particle. In the spreadsheet, the Cd columns go on and on until n = 3 * number of particles.

Attachments:
alembic_07.png (55.4 KB)
alembic_08.png (23.6 KB)
alembic_09.png (25.4 KB)
alembic_10.png (93.0 KB)

User Avatar
Member
59 posts
Joined: Oct. 2010
Offline
Right, so I have tried some attribute wrangling, but I have very little experience doing this in Houdini.

I need to access data from the rgb_PP attribute array, in groups of three, for each particle.

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);

This is creating three float attributes (red, green and blue) and a vector attribute Cd from the three floats.
When this is run, all the float attributes have 0.0 assigned to them, but I do not understand why.
Clearly, I am not accessing the rgb_PP attribute array correctly.

Can anyone help me with this?

I am attaching my little Houdini script and the alembic file I have been testing, which has a couple of hundred particles.

Many thanks

Dan
Edited by dansidi - Oct. 11, 2016 03:12:10

Attachments:
particleTest_v001.hip (63.9 KB)
particleTest_v001.abc (1.7 MB)

User Avatar
Member
59 posts
Joined: Oct. 2010
Offline
… and here is the solution provided b y SASHO78 from Sofia.

in an Attribute Wrangle, directly after the Alembic node, add the following

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

So, we are creating a vector array, rgb
I think the prim function looks to the primitive context and fetches some data from there.
vector rgb[] = prim(0, "rgbPP", 0)
fetches rgbPP from the 0'th element in the 0'th input of the Attribute wrangle node (I think) and then assigns that data to an vector array called rgb

v@Cd = rgb[ @ptnum ]
creates a vector called Cd and then looks up the @ptnum'th value of the array rgb and copies it to Cd.

Very useful. I with I had thought of it, but ALL the credit goes to Sasho78.

Thanks a lot!
Edited by dansidi - Oct. 11, 2016 04:54:31
User Avatar
Member
17 posts
Joined: Jan. 2008
Offline
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
User Avatar
Member
17 posts
Joined: Jan. 2008
Offline
Don't worry, you have to list the attributes in the alembic export window but I was naming them 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
  • Quick Links