An interesting vex question between new and old sops in houdini

   3052   12   2
User Avatar
Member
66 posts
Joined: May 2016
Offline
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?
User Avatar
Member
1743 posts
Joined: March 2012
Offline
carldrifter
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?
The VEX function randis 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.5seems 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]
User Avatar
Member
8538 posts
Joined: July 2007
Online
2. may depend on your build, are you using 16.5?

Houdini 16.5.230 The ad-hoc groups based on attribute will accept rgba and uv for the vector index name, ie: @Cd.r>0.1 Mon. September 11, 2017
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
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
User Avatar
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
User Avatar
Member
8538 posts
Joined: July 2007
Online
Delete SOP uses Hscript for it's filter expression, so in there rand($PT) and rand(@ptnum) are both Hscript expressions
new Group Expression SOP uses VEX, so rand(@ptnum) in there executes VEX rand() function
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
66 posts
Joined: May 2016
Offline
Thanks tamte!
That's to say I cannot judge the language by the @ symbol but by the sop where I use it~ rand(@ptnum) could be a hscript when I use it in the delete SOP!
User Avatar
Member
8538 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
User Avatar
Member
66 posts
Joined: May 2016
Offline
Great infos!
But it strikes me with anohter question: the old sops like delete sop can never use vex language? we put @ syntax but we acctually use hscript instead of vex?
User Avatar
Member
8538 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
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
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?
User Avatar
Member
8538 posts
Joined: July 2007
Online
you can still use Delete SOP for now
or Group Expression and than Blast that group
or as you mentioned VEX to either create group or just an attribute and then Blast based on either
or delete within VEX with removepoint()
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
66 posts
Joined: May 2016
Offline
ok,thanks tamte~
hope houdini would update a new sop with vex which has the same function as delete sop does~
  • Quick Links