Basic chramp question in VEX
5382 13 0- Island
- Member
- 339 posts
- Joined: June 2017
- Offline
I am trying to replicate a simple attribute VOP in VEX, without all the overhead that I see in the VEX code from VOP. How can I assign a ramp to a parameter in VEX? Here is the file with a switch between VOP and Wrangle. I would like the attribute wrangle to replicate the VOP. The code I am using is:
float py = @ptnum/(@numpt-1.0);
float rampval = chramp(“ramp”, py);
@P.x=.075+rampval*@P.y;
Thanks.
float py = @ptnum/(@numpt-1.0);
float rampval = chramp(“ramp”, py);
@P.x=.075+rampval*@P.y;
Thanks.
Edited by Island - Aug. 16, 2020 12:33:53
- BabaJ
- Member
- 2024 posts
- Joined: Sept. 2015
- Offline
- Island
- Member
- 339 posts
- Joined: June 2017
- Offline
- BabaJ
- Member
- 2024 posts
- Joined: Sept. 2015
- Offline
I thought ramp was a function, and you could click the “create spare parameter” to add the ramp. It seems like there should be a way to do this in VEX rather than depend on a VOP. The VEX code from the VOP suggests that there should a way.
Not sure what your issue is. If you create the ramp parameter (gear icon) to your wrangle node…you get the same results like you have with your vop + nodes on the right of your network.
Edit: In your wrangle code you have to change the type of quotes for your ramp reference. Straight Double or single is fine but not curly.
Edited by BabaJ - Aug. 16, 2020 16:09:17
- Island
- Member
- 339 posts
- Joined: June 2017
- Offline
- BabaJ
- Member
- 2024 posts
- Joined: Sept. 2015
- Offline
- Island
- Member
- 339 posts
- Joined: June 2017
- Offline
Thanks. I made an error above by omitting a decimal point which should be 0.2 multiplication (same as divided by 5) but the ramp still does not seem to work (regardless of whether the ramp is based on @P.y or @ptnum/@numpt):
float py = @ptnum/(@numpt-1.0);
float rampval = chramp(“ramp”, @P.y) / 5.0;
@P.x=.075+rampval;
(I am using straight quotes, but this forum seems to change to curly)
float py = @ptnum/(@numpt-1.0);
float rampval = chramp(“ramp”, @P.y) / 5.0;
@P.x=.075+rampval;
(I am using straight quotes, but this forum seems to change to curly)
Edited by Island - Aug. 16, 2020 18:08:51
- mestela
- Member
- 1716 posts
- Joined: May 2006
- Offline
- Island
- Member
- 339 posts
- Joined: June 2017
- Offline
- tamte
- Member
- 8449 posts
- Joined: July 2007
- Offline
Islandso you better use code block when pasting any code, to match the VOP exactly you will need to base the ramp on v@P.y and not multiply by it afterwards
(I am using straight quotes, but this forum seems to change to curly)
float rampval = chramp("ramp", clamp(@P.y,0,1)); @P.x=.075+rampval/5;
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
- Island
- Member
- 339 posts
- Joined: June 2017
- Offline
Thank you, tamte. That gives exactly the result I wanted.
Just out of curiosity, why did you use the clamp function rather than point number divided by (total points - 1)? Shouldn't they give the same result with a line? These give me exactly the same values:
Just out of curiosity, why did you use the clamp function rather than point number divided by (total points - 1)? Shouldn't they give the same result with a line? These give me exactly the same values:
f@test = @ptnum/(@numpt - 1.0); f@test1 = clamp(@P.y,0,1);
Edited by Island - Aug. 17, 2020 00:31:52
- Island
- Member
- 339 posts
- Joined: June 2017
- Offline
- tamte
- Member
- 8449 posts
- Joined: July 2007
- Offline
IslandI mean as long as the line is 0-1 in y then they are the same and also clamp() is not necessary
Just out of curiosity, why did you use the clamp function rather than point number divided by (total points - 1)? Shouldn't they give the same result with a line?
but since your VOP was using v@P.y I used v@P.y
and since Ramp Parameter VOP seems to automatically clamp the input I also clamped the value in VEX
because chramp() otherwise doesn't clamo the input and it would repeat the ramp for out of range values
so all the code was to simply match your VOP version, and not just for the current 0-1 line input
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
-
- Quick Links