Material Style Sheets - Binding Attributes

   3348   2   1
User Avatar
Member
185 posts
Joined: March 2008
Offline
Hi everyone,

Posted this over on Odforce a while back and garnared no replies (not sure if no-one knows, or it's a silly question); thought I'd try my luck here.

Having a look at stylesheets and having a bit of difficulty with them, and was hoping someone could point me in the right direction

What I’m looking to do is bind the intrinsic:indexorder at one level and then use this value to randomise an attribute at a lower (group) level. This should be relatively straightforward if I'm understanding this paragraph from the docs right:

Higher target levels in a targeting hierarchy can also bind the value of attributes at that level. You can then make those bound data available as arguments to the CVEX script.

So I’ve got a sop object containing 7 packed objects. Inside those packed objects is a primitive attribute, @tag, which I want to control a material parameter (basecolor).

SOP Level Geometry
- Target (Packed Objects)
Bind id here (intrinsic:indexorder)
– Subtarget (Prim Group, e.g. @tag=tank)
Apply override using id from higher level

Since an example is probably better than my explanation, I’ve attached an example scene. The scene has got two stylesheets, one using the path attribute, which works fine and one is attempting to use the @tag attribute, which doesn't. The stylesheet ui looks like this:



I’m relatively certain I’m missing something obvious (style sheets being an exciting new world), but can’t seem to work out what it is (I keep moving the bind around to no avail…).

Attachments:
odforce_packed_example.hiplc (348.8 KB)

User Avatar
Staff
1449 posts
Joined: July 2005
Offline
I could not try it out on your data (locking alembic sop does not load the .abc file), but I think you are missing the data binding on your sub-target. In that data binding you reference the pre-bound data from higher level targets.

p.s.
You can also change the data binding type from “automatic” to “from target” if you don't want to risk Houdini looking for ‘prebound_id’ attribute on the matched geometry, but instead look directly for ‘prebound_id’ on the targets specification.

p.p.s
You need the ‘id’ or ‘prebound_id’ data binding for your override script even if you preboud it earlier, because that override could be one of many, some of which are also scripts but don't want any data binding to ‘id’ or ‘prebound_id’. So you need to explicitly specify that you do want to pass data to your script.

Attachments:
odforce_packed_example-fix.hiplc (348.7 KB)

User Avatar
Member
185 posts
Joined: March 2008
Offline
Cheers Rafal! That worked and thanks for the explanation; that makes sense.


Attatched the alembic so there's a working example in case anyone comes across this thread.

Attachments:
propane_tank.v001.abc.tar.gz (62.8 KB)

  • Quick Links