### Analogous VEXpression for 1-\$BBY?

406   4   1
Member
102 posts
Joined: Oct. 2016
Offline
Hi!
Help please please > How to write it in Wrangle (? Point) with VEX instead of Old Point (as in the example image)?
Thanks

Attachments:
Old Point BBY.jpg (103.9 KB)

Member
533 posts
Joined: May 2006
Offline
```vector bb = relpointbbox(0,@P);
@Cd = 1-bb.y;
```
Member
102 posts
Joined: Oct. 2016
Offline
Hi, mestela.
Thanks for the expression! It works works hurrah I dreamt could write it by myself, but exactly not - didn't try even something similar to yours. Interesting that it gives gradient from black to white, rather than point example (gave from black to red), but it doesn't influence somehow on simulation - everything works the same!
Member
533 posts
Joined: May 2006
Offline
Heh, vex can see a little odd at first, but its pretty internally consistent, a lot of functions are called in similar ways, best thing to do is just keep collecting little one or 2 liner scripts like this, start replacing some sop operations with wrangles, it'll click.

Re the red vs grayscale, the way I assigned the colour implicitly sets the same value to the red/green/blue components. If you wanted to make it be red, you'd have to ensure that blue and green are zero. One way to do that is to set it to black first, then set the red channel afterwards:

```vector bb = relpointbbox(0,@P);
@Cd = 0;
@Cd.r = 1-bb.y;
```

Or you could do it all in one hit. Vectors can be set directly with the set() command, so its set( red_value, green_value, blue_value).

```vector bb = relpointbbox(0,@P);
@Cd = set(1-bb.y,0,0);
```

I wrote a quick-moving tutorial on my site for vex, might be of help (or at least give you ideas about stuff you might want to learn more about):

http://www.tokeru.com/cgwiki/?title=HoudiniVex [www.tokeru.com]
Member
102 posts
Joined: Oct. 2016
Offline
Thanks for the advice about VEX! Do you collect scripts inside of Houdini file or as a text in a kind of note editor?

All your expressions work - just the magic feel it as! Thanks for all the examples given and for the explanations. Definitely couldn't write it without you.

Haven't enough fantasy to put somewhy - bb equal - between vector and relpointbbox even for the first stroke… and don't know what should happen or how much time pass by to make me understand why we subtract Cd.y - green and vertical from Cd.r - horizontal and red and have result that have.

You just won't believe - this VEX page linked to your site is opened on my screen from yesterday, and I thought ohh gods seems this is what I really need to read. I will I will.
Edited by ryuku - Feb. 4, 2018 19:18:29