Adding additional attribute to OPoints for export

140 views
Skip to first unread message

Nicholas Yue

unread,
May 21, 2012, 4:18:54 AM5/21/12
to alembic-d...@googlegroups.com
Hi,

I'd like to add a couple more attributes to the particle system I
am writing out.

Using the API calls, I can write out the positions, IDs and
velocities without any problems, without problems in the sense that when
I import them into Houdini, the attributes behaves as expected.

However, when I attempt to add additional attributes (using the
PointsTest.cpp as an example), the additional attribute are not visible
when I imported them into Houdini.

Houdini is the only other tools at my disposable for easily looking
at those attributes.

Here is my code segment and h5dump -H of the file (too large to
attached the actual Alembic file)

== CODE ==

Alembic::AbcGeom::OPointsSchema::Sample opmsSample;
NB_INFO ( "Position vector size " << abc_positions.size() );
NB_INFO ( "Velocity vector size " << abc_velocities.size() );

opmsSample.setIds(Alembic::AbcGeom::UInt64ArraySample(abc_indices));

opmsSample.setPositions(Alembic::AbcGeom::P3fArraySample(abc_positions));
opmsSample.setVelocities(Alembic::AbcGeom::V3fArraySample(
abc_velocities ));

// Additional channels
Alembic::AbcGeom::OFloatArrayProperty dropletOut( opms, "droplet");
Alembic::AbcGeom::OFloatArrayProperty emitIdOut( opms, "emitId");

NB_INFO ( "Droplet vector size " << abc_droplet.size() );
NB_INFO ( "EmitID vector size " << abc_emitId.size() );
dropletOut.set( Alembic::AbcGeom::FloatArraySample( abc_droplet
) );
emitIdOut.set( Alembic::AbcGeom::FloatArraySample( abc_emitId ) );

opms.set(opmsSample);

== h5dump -H == layout.txt

Regards

--
Nicholas Yue
Graphics - RenderMan, Visualization, OpenGL, HDF5
Custom Dev - C++ porting, OSX, Linux, Windows
Management - Recruitment, career management
http://www.proceduralinsight.com/
http://au.linkedin.com/in/nicholasyue

layout.txt

Steve LaVietes

unread,
May 21, 2012, 9:00:38 AM5/21/12
to alembic-d...@googlegroups.com, alembic-d...@googlegroups.com
The additional attributes must be written in the form of OGeomParams within the compound returned from getArbGeomParams() on the schema.

The indicates that it's data attached to the geometry rather than just data. You'd use a scope of "varying" for per-point data.

-stevel
> --
> You received this message because you are subscribed to the Google
> Groups "alembic-discussion" group.
> To post to this group, send email to alembic-d...@googlegroups.com
> To unsubscribe from this group, send email to
> alembic-discuss...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/alembic-discussion?hl=en
>
> For RSS or Atom feeds related to Alembic, see:
>
> http://groups.google.com/group/alembic-dev/feeds
>
> http://groups.google.com/group/alembic-discussion/feeds
> <layout.txt>

Nicholas Yue

unread,
May 22, 2012, 4:35:12 AM5/22/12
to alembic-d...@googlegroups.com
On 21/05/12 23:00, Steve LaVietes wrote:
> The additional attributes must be written in the form of OGeomParams within the compound returned from getArbGeomParams() on the schema.
>
> The indicates that it's data attached to the geometry rather than just data. You'd use a scope of "varying" for per-point data.
Does the attached schema looks right ? It matches your recommendation.

Alembic::AbcGeom::OPoints opm(bodyObject, "particle", _tsi);
Alembic::AbcGeom::OPointsSchema &opms = opm.getSchema();
Alembic::AbcGeom::OPointsSchema::Sample opmsSample;
NB_INFO ( "Position vector size " << abc_positions.size() );
NB_INFO ( "Velocity vector size " << abc_velocities.size() );

opmsSample.setIds(Alembic::AbcGeom::UInt64ArraySample(abc_indices));

opmsSample.setPositions(Alembic::AbcGeom::P3fArraySample(abc_positions));
opmsSample.setVelocities(Alembic::AbcGeom::V3fArraySample(
abc_velocities ));

opms.set(opmsSample);

// Additional channels
Alembic::AbcGeom::OCompoundProperty arbParams =
opms.getArbGeomParams();
Alembic::AbcGeom::FloatArraySample droplet_samp(
&abc_droplet[0], abc_droplet.size() );
Alembic::AbcGeom::OFloatGeomParam droplet( arbParams,
"droplet", false, Alembic::AbcGeom::kVaryingScope, abc_droplet.size() );
Alembic::AbcGeom::OFloatGeomParam::Sample dropletSamp(
droplet_samp, Alembic::AbcGeom::kVaryingScope );

droplet.set( dropletSamp );

However, when I tried to import the Alembic file into Houdini, it
crashes Houdini so I was hoping for some guidance.
schema.txt

Lucas Miller

unread,
May 22, 2012, 12:23:34 PM5/22/12
to alembic-d...@googlegroups.com
The data layout looks ok.

Could you send me the Alembic file so I can see the actual data values?

Lucas

--
You received this message because you are subscribed to the Google
Groups "alembic-discussion" group.
To post to this group, send email to alembic-discussion@googlegroups.com

To unsubscribe from this group, send email to

Lucas Miller

unread,
May 22, 2012, 5:56:05 PM5/22/12
to alembic-d...@googlegroups.com
Nicholas sent me an example file, and the data layout of the droplet geometry parameter is incorrect.

In it the arrayExtent  for the GeometryParam named droplet was set to the number of points.

This is not how arrayExtent is meant to be used, and in nearly all situations it should be set to 1.

The only case where it shouldn't be is for situations like when you have a property that represents a color3f[2] per point.

For this example the arrayExtent would be 2, not the number of points, nor floats per point.

Lucas

Nicholas Yue

unread,
May 22, 2012, 6:02:29 PM5/22/12
to alembic-d...@googlegroups.com
On 23/05/12 07:56, Lucas Miller wrote:
> Nicholas sent me an example file, and the data layout of the droplet
> geometry parameter is incorrect.
>
> In it the arrayExtent for the GeometryParam named droplet was set to
> the number of points.
>
> This is not how arrayExtent is meant to be used, and in nearly all
> situations it should be set to 1.
>
> The only case where it shouldn't be is for situations like when you
> have a property that represents a color3f[2] per point.
>
> For this example the arrayExtent would be 2, not the number of points,
> nor floats per point.
Hi Lucas,

Thanks for that. It is now working.
Reply all
Reply to author
Forward
0 new messages