change displayColor with attWrangle

   4354   6   1
User Avatar
Member
281 posts
Joined: 11月 2014
オフライン
Hello guys.
I'm trying to port some custom HDAs into Solaris and i struggle even with simple VEX expression to change displayColor

Anyone would be able to help how to change the displayColor with VEX?

I managed to get to this stage, but that creates different type (color3f), then then USD displayColor expects (color3f).
I just was not able to get the correct type, thus the Array


string att_name =chs("att_name");
string primitive = chs("primpattern");
usd_addprimvar(0, primitive, att_name, "color3f[]", "constant");
usd_setprimvar(0, primitive, att_name,  vector[] (array({0,0,0},{0,0,0} , {1,1,1})));
Edited by martinkindl83 - 2020年11月17日 01:29:16

Attachments:
attwrangle.png (417.8 KB)

User Avatar
Member
8173 posts
Joined: 9月 2011
オフライン
I find it's easier to use bound attributes rather than the usd functions directly. For really fancy stuff (large per vertex arrays) it's much easier and probably more performant too to use sops.

Attachments:
lopwrangle.png (326.0 KB)
lop_wrangle_displayColor.hip (221.3 KB)

User Avatar
Member
281 posts
Joined: 11月 2014
オフライン
Thank you.
Would this work for alembic brought by file node as well?
User Avatar
Member
8173 posts
Joined: 9月 2011
オフライン
martinkindl83
Thank you.
Would this work for alembic brought by file node as well?

All data in USD is fair game, except for primitives that are children of an instanceable primitive.

By file node do you mean sublayer or reference lop?
User Avatar
Member
281 posts
Joined: 11月 2014
オフライン
jsmack
By file node do you mean sublayer or reference lop?

Originally i was using Alembic node at sops and sopimporting. You mentioned its not the right way how to bring alembic, so i tried File, which is by looking at the name Sublayer node.
User Avatar
Member
281 posts
Joined: 11月 2014
オフライン
Thank you for the example, it worked as expected
string att_name =chs("att_name");
string primitive = chs("primpattern");
usd_addprimvar(0, primitive, att_name, "color3f[]", "constant");
usd_setprimvar(0, primitive, att_name,  vector[](array({0,1,0})));
User Avatar
Member
281 posts
Joined: 11月 2014
オフライン
also why are you having second line in the vex? is it just safety thing?
As it looks, like the first line already creates constant interpolation.

v[]@primvars:displayColor = array(vector(rand(@elemnum)));
usd_setprimvarinterpolation(0, @primpath, "displayColor", "constant");
  • Quick Links