fx notes

Search

Search IconIcon to open search

Alembic

Last updated Oct 16, 2024 Edit Source

# Work with the Alembic Hierarchy

# Building Path Hierarchy

You can use the [ ] Build Hierarchy From Attribute option on the Alembic ROP to manage how geometry gets organized in an alembic file and rebuilt in e.g. Maya. the node expects a primitive attribute usually called @path.

//primitive wrangle

1
s@path = "/Group/GeoNodeInMaya/ShapeNodeInMaya"

This is similar to how USD hierarchy is defined with @name.

# Path Attribute to Groups

A lot of the time you want to have access to the path as groups:

//primitive wrangle

1
2
3
4
5
string name[] = split(s@path, "/");

foreach (string s; name){
    setprimgroup(0, s, @primnum, 1, "set");
} 

For more snippets check out VEX Snippets.

This creates groups for every segment of the path which can be a lot. To deal with them you can use wildcards in pretty much all fields that take group names.

Say you have a few paths that also include some material information:

You can use that to assign a glass material to the relevant parts by using *Glass* in the group field.

# Hiccups

# Getting the Time Range, Startframe and Endframe

There is no time range intrinsic available by default so we need to write 3 lines of python to read the range from the file itself.

// python shell

1
2
3
import _alembic_hom_extensions as abc 
abcPath = r"C:/Path/To/Cache.abc" 
timeRange = abc.alembicTimeRange(abcPath)

You can make it more procedural by first getting the filename automatically. I read it from the instrinsics first and stored it in a regular attribute, but I’m sure you could do that in python too.

// python SOP

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
import _alembic_hom_extensions as abc

node = hou.pwd()
geo = node.geometry()
fps = hou.fps()

abcPath = geo.primStringAttribValues('abcfilename')[0]
abcTimeRange = abc.alembicTimeRange(abcPath)

startframe = int(abcTimeRange[0] * fps);
endframe = int(abcTimeRange[1] * fps);

geo.prims()[0].setAttribValue("startframe", startframe)
geo.prims()[0].setAttribValue("endframe", endframe)

# Vertex Colors to Maya

Make sure to:

“Sometimes” this also helped:


sources / further reading:


Interactive Graph