Hi,
I have founded that when you use delete sop by entering the expression rand(@ptnum)or rand($PT),you get the same result.However,when you use wrangle for the same expression,you get a different result?
Can anyone explain why this hanppened?
besides,when you use the “old” sop(such as delete sop),you can use @Cd.r but in new blast sop,you can only use @Cd.x instead of @Cd.r.Why?
An interesting vex question between new and old sops in houdini
3010 12 2- carldrifter
- Member
- 66 posts
- Joined: May 2016
- Offline
- neil_math_comp
- Member
- 1743 posts
- Joined: March 2012
- Offline
carldrifterThe VEX function
when you use delete sop by entering the expression rand(@ptnum)or rand($PT),you get the same result.However,when you use wrangle for the same expression,you get a different result?
Can anyone explain why this hanppened?
rand
is a different function from the HScript function rand
. There's a VEX function hscript_rand
(described here [www.sidefx.com]) that should be equivalent to the HScript function rand
, if you need exactly the same random numbers as HScript.carldrifter
when you use the “old” sop(such as delete sop),you can use @Cd.r but in new blast sop,you can only use @Cd.x instead of @Cd.r.Why?
@Cd.r>0.5
seems to work for me in a Blast SOP, and produces the same result as @Cd.x>0.5
. Can you post an example where it doesn't work?
Writing code for fun and profit since... 2005? Wow, I'm getting old.
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
https://www.youtube.com/channel/UC_HFmdvpe9U2G3OMNViKMEQ [www.youtube.com]
- tamte
- Member
- 8447 posts
- Joined: July 2007
- Online
- carldrifter
- Member
- 66 posts
- Joined: May 2016
- Offline
Hi ndickson,
Thanks very much for your reply.I assumed that way too but I have one more question. As you said, when we use rand($PT) in delete sop, we use hscript,but what about rand(@ptnum)in delete sop? Is that considered to be hscript or vex? I would consider it as vex because the @ptnum signal.Therefore what casue the differences between rand(@ptnum) in delete sop and new group sop in houdini 16
Thanks very much for your reply.I assumed that way too but I have one more question. As you said, when we use rand($PT) in delete sop, we use hscript,but what about rand(@ptnum)in delete sop? Is that considered to be hscript or vex? I would consider it as vex because the @ptnum signal.Therefore what casue the differences between rand(@ptnum) in delete sop and new group sop in houdini 16
- carldrifter
- Member
- 66 posts
- Joined: May 2016
- Offline
Hi ndickson,
Thanks very much for your reply.I assumed that way too but I have one more question. As you said, when we use rand($PT) in delete sop, we use hscript,but what about rand(@ptnum)in delete sop? Is that considered to be hscript or vex? I would consider it as vex because the @ptnum signal.Therefore what casue the differences between rand(@ptnum) in delete sop and new group sop in houdini 16
Thanks very much for your reply.I assumed that way too but I have one more question. As you said, when we use rand($PT) in delete sop, we use hscript,but what about rand(@ptnum)in delete sop? Is that considered to be hscript or vex? I would consider it as vex because the @ptnum signal.Therefore what casue the differences between rand(@ptnum) in delete sop and new group sop in houdini 16
- tamte
- Member
- 8447 posts
- Joined: July 2007
- Online
- carldrifter
- Member
- 66 posts
- Joined: May 2016
- Offline
- tamte
- Member
- 8447 posts
- Joined: July 2007
- Online
right, cause the @ syntax was added to hscript to make it more unified with syntax that emerged in VEX snippets to access attribute values instead of requiring $VARIABLES, that was further extended to support @Frame, @ptnum, etc. instead of just $FF, $PT, … so while it's more unified, it may be adding to the language confusion
Edited by tamte - Nov. 24, 2017 08:54:10
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
- carldrifter
- Member
- 66 posts
- Joined: May 2016
- Offline
- tamte
- Member
- 8447 posts
- Joined: July 2007
- Online
yes, old sops like Delete SOP only use Hscript in parameters
pretty much all new sops with VEXpression parameter are based on AttributeVOP with Snippet VOP inside so you can easily recognize whether you can use VEX code in some parameter by looking inside and seeing whether the content of that parameter is injected into a Snippet or Wrangle
pretty much all new sops with VEXpression parameter are based on AttributeVOP with Snippet VOP inside so you can easily recognize whether you can use VEX code in some parameter by looking inside and seeing whether the content of that parameter is injected into a Snippet or Wrangle
Tomas Slancik
FX Supervisor
Method Studios, NY
FX Supervisor
Method Studios, NY
- carldrifter
- Member
- 66 posts
- Joined: May 2016
- Offline
cool!thanks a again,tamte. What you mentioned really enlighten me!
For a more specific question: I can use rand(@ptnum)>0.5 to delete point in delete sop but I cannot use it in blast sop. Therefore,I have to use wrangle sop to use if statment and removepoints()function to do the same thing.
Do I have more convinient ways to do it use vex in the new sop? which new sop can provide the same function?
For a more specific question: I can use rand(@ptnum)>0.5 to delete point in delete sop but I cannot use it in blast sop. Therefore,I have to use wrangle sop to use if statment and removepoints()function to do the same thing.
Do I have more convinient ways to do it use vex in the new sop? which new sop can provide the same function?
- tamte
- Member
- 8447 posts
- Joined: July 2007
- Online
- carldrifter
- Member
- 66 posts
- Joined: May 2016
- Offline
-
- Quick Links