Scene file attached with a example case(Normal Displacement)where the problem is presented in 3 columns:
left: Just HDA with single input value driving all points.
center: Attempt to use a random value attribute @foo to drive each point. Failing.
right: HDA exploded with @foo driving each point. Working as intended.
I inputing @foo and `point(0, “foo”, @ptnum)` in the HDA parameter but it didn't work.
So what's the best way to set up HDA parameters to also be driven by a per point attribute?
Thanks
should look like this with the random value point attribute.
How to input an attribute in an HDA parameter?
5119 5 1- probiner
- Member
- 337 posts
- Joined: June 2013
- Offline
- goldleaf
- Staff
- 4159 posts
- Joined: Sept. 2007
- Online
I think parameters can do that only via HDK (but I'd love to be proven wrong!), but you can use a string parm to pass in an attribute name:
This would let you specify an incoming point attribute to use; you could modify your HDA to allow the user to use a parameter value, an attribute, or even multiply them together.
Hope that helps!
vector norm = point(1, "N", @ptnum) ; @P += norm * point(0, chs("myattr"), @ptnum);
This would let you specify an incoming point attribute to use; you could modify your HDA to allow the user to use a parameter value, an attribute, or even multiply them together.
Hope that helps!
I'm o.d.d.
- tamte
- Member
- 8515 posts
- Joined: July 2007
- Online
- probiner
- Member
- 337 posts
- Joined: June 2013
- Offline
Thanks for the hints guys. I wasn't aware about the Bindings!
But both solutions seem to require duplication of parameters (one for single values, one to be name the attribute) and my mindset about this is more like what we do in VOPs, where we set an exposed parameter which can then be overridden by wiring something to it, so at SOP level I was expecting to do the same with an expression instead.
Let me know if having 2 parameters per actual parameter is the only way to go about it. Thanks.
[streamable.com]
But both solutions seem to require duplication of parameters (one for single values, one to be name the attribute) and my mindset about this is more like what we do in VOPs, where we set an exposed parameter which can then be overridden by wiring something to it, so at SOP level I was expecting to do the same with an expression instead.
Let me know if having 2 parameters per actual parameter is the only way to go about it. Thanks.
[streamable.com]
Edited by probiner - Jan. 8, 2018 06:45:00
- probiner
- Member
- 337 posts
- Joined: June 2013
- Offline
- probiner
- Member
- 337 posts
- Joined: June 2013
- Offline
Ok, here's the how I went about it to avoid burdening the UI. In a wrangle inside the Asset I check if the attribute exists with the same name as the parameter in the UI, and if not I create it with the UI value:
float attrib = ch(“attrib”) ; // UI value variable from a spare input in the wrangle SOP.
if(! hasprimattrib(0, “hda_attrib”)) f@hda_attrib = attrib ; // If the attribute doesn't exist, it's created and the UI value assigned to it.
or if I just need the variable:
float attrib = ch(“attrib”) ;
if( hasprimattrib(0, “hda_attrib”)) attrib = prim(0, “hda_attrib”, @primnum ) ;
Might not be very pretty to create/rename/copy attributes before the HDA, but since they share the UI parameter name it's straight forward enough, while allowing neat extra control.
Cheers
float attrib = ch(“attrib”) ; // UI value variable from a spare input in the wrangle SOP.
if(! hasprimattrib(0, “hda_attrib”)) f@hda_attrib = attrib ; // If the attribute doesn't exist, it's created and the UI value assigned to it.
or if I just need the variable:
float attrib = ch(“attrib”) ;
if( hasprimattrib(0, “hda_attrib”)) attrib = prim(0, “hda_attrib”, @primnum ) ;
Might not be very pretty to create/rename/copy attributes before the HDA, but since they share the UI parameter name it's straight forward enough, while allowing neat extra control.
Cheers
Edited by probiner - Jan. 22, 2018 13:48:26
-
- Quick Links