Alembic Mantra Stylesheet

   4348   8   1
User Avatar
Member
6 posts
Joined: Nov. 2014
Offline
Hello,

I can get the Houdini packed primitive style sheet examples working fine. But I'm struggling to use the same targetting techniques with Alembic archives. I have created a simple Alembic file with only a sphere using the Alembic ROP. Then I put an Alembic Archive in “/obj” and delve down to find the sphere's geo node where I at a style sheet parameter :

{
“materialDefinitions” : {
“mymat” : {
“properties” : {
“surface” : “opdefShop/v_constant clr 0.0 0.0 1.0”
}
}
},
“styles” : [
{
“target” : “*”,
“overrides” : { “material” : { “name” : “mymat” }}
}
]
}


Targeting with a wildcard works, of course, but as soon as I try to put something to target the sphere specifically, it doesn't work. I would like to be able to use the “abcecho” command line to find my targets and use the alembic “name” values in my style sheet (“/sphere_object1/sphere1” from abcecho).

Also, where is the highest level I can put my stylesheet to encompass the whole scene?

Thanks,

Vincent
User Avatar
Staff
1448 posts
Joined: July 2005
Offline
The “target” : “*” essentially means match any primitive ID or any ‘name’ attribute on a primitive. Similarly “target” : 1 means prim ID 1 or “target” : “agentX” means primitive with ‘name’ attribute set to “agentX”.

If you look at spreadsheet on the Alembic SOP, you will see that there is no ‘name’ attribute. So, wile “*” matches the primitive ID, if you try to set it to “/sphere_object1/sphere1” it won't since there is no ‘name’ attribute.

Instead, you need to specify the target in terms of attribute value. Try these:
“target” : { “attributes” : { “intrinsic:abcobjectpath” : “/sphere_object1/sphere1” } }
“target” : { “attributes” : { “path” : “/sphere_object1/sphere1” } }
“target” : { “attributes” : { “intrinsic:abcobjectpath” : “*sphere1” } }
It should do what you want. You can use the spreadsheet on Alembic SOP to find primitive attribute names and values: RMB on sphere1 node > Spreadsheet then click ‘primitives’ button, then check out Intrinsics menu.

As for the other question, in H14.0, there are three places you can specify stylesheets: as an attribute on a primtive (via Attribute Create SOP), as a parameter on an object node, and as a -S command line argument to mantra. So the highest level is -S, eg mantra -S my_style.json -f scene.ifd. And inside a .hip file it is on the highest level OBJ node (right in /obj network).
User Avatar
Member
6 posts
Joined: Nov. 2014
Offline
Hi! Thanks! Will look into it, but first, can you tell me if there is a way to specify a value to the -S Mantra command line argument in HQueue? Thanks again!
User Avatar
Member
6 posts
Joined: Nov. 2014
Offline
Hi! “intrinsic:abcobjectpath” works, “path” doesn't. I didn't know about the “intrinsic” namespace at all, so thanks for that!

If you know about style sheets and HQueue I'd be happy to hear!

Thanks again!

Vincent
User Avatar
Staff
1448 posts
Joined: July 2005
Offline
I asked around about HQueue, and was told you can specify the command-line option in the Command parameter (in Driver folder) of the Mantra ROP referenced by the HQueue ROP.

So you should be able to specify ‘mantra -S stylesheet.json’ in there.
User Avatar
Member
6 posts
Joined: Nov. 2014
Offline
Hello,

Will try it as soon as I get stylesheets working for OBJs too. Sounds weird, but for the same geo exported from the same app to OBJ instead of ABC, I can't make it work.

What doesn't work is texturing (and it looks like a Houdini bug to me): some texture don't load. When I convert them from their original JPG to PNG via Photoshop and I change the material overrides for one group that uses this texture, it loads the texture. When I change the extension to PNG for ALL the groups, the texture won't load anymore. I have seen that the latest daily build (14.0.296) changes a lot of things for texturing in VEX so I will look at it. But man is it ever weird.

I changed to OBJ from ABC since the original modelling app screwed with the UVs and they are OK in the OBJs. The stylesheet was working (with different targets) with ABC.

I don't know…

Vincent
User Avatar
Member
6 posts
Joined: Nov. 2014
Offline
It really really seems like a bug to me.

When I print the diffuse map file name attribute from the vex shader, I get this (excerpt from thousands of lines):

colorMap : CUsers/vincent/Desktop/walled/maps/smi3_facade01.jpg
colorMap : CUsers/vincent/Desktop/walled/maps/smi3_BrickCLR.jpg
colorMap : $HIP/maps/smi3_facade01.jpg
colorMap : CUsers/vincent/Desktop/walled/maps/smi3_BrickCLR.jpg
colorMap : CUsers/vincent/Desktop/walled/maps/smi3_Metal2CLR.jpg

Some $HIP tokens get expanded (the first line) and some not (the third line) even if it is the same file and even if it is written exactly the same way in the stylesheet (with the $HIP) token. When I try to expand all the paths in the stylesheet, the vex output is fine, but it is still not loading the texture file maps.

All of this was working just fine when it was an Alembic file, but broke when I use an OBJ instead of an ABC.

I'm on 14.0.281 on Windows 8.1 64-bit.
User Avatar
Staff
1448 posts
Joined: July 2005
Offline
Perhaps it's the file path format? What if you hard code the string: does it start working? What was the path with alembic?

The $HIP and other variables are expanded in various ways depending on where the style sheet is defined. Eg, in object node parameter it is expanded by Houdini when writing the IFD stream for mantra, since the style sheet needs to be written out as string block to IFD. And external .json file don't expand variables at all. If style sheet is defined by Attrib Create SOP, then I think the variable expansion may be turned off with “Allow Local Vars” toggle.

If you think that it's a bug, it's probably best to submit a bug report with a simple scene demonstrating the issue:
http://www.sidefx.com/index.php?option=com_content&task=view&id=768&Itemid=239 [sidefx.com]
https://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&t=15603 [sidefx.com]
User Avatar
Member
6 posts
Joined: Nov. 2014
Offline
hello! I haven't been able to reproduce the problem with a default mantrasurface so I must have a bug in my shader. so it works now. I love stylesheets! thanks for the help!
  • Quick Links