Attributes in expression?
22756 16 1- Soothsayer
- Member
- 861 posts
- Joined: Oct. 2008
- Offline
How do I use attributes in an expression?
I want to drive something in a POPNET with an attribute. But just typing in the attribute's name won't work. I read something about using the point() expression but I can't find anything in the help.
Would be nice if we could just drag stuff in. xsi style. dumdeedum. :roll:
I want to drive something in a POPNET with an attribute. But just typing in the attribute's name won't work. I read something about using the point() expression but I can't find anything in the help.
Would be nice if we could just drag stuff in. xsi style. dumdeedum. :roll:
--
Jobless
Jobless
- edward
- Member
- 7730 posts
- Joined: July 2005
- Offline
- Soothsayer
- Member
- 861 posts
- Joined: Oct. 2008
- Offline
Thanks, it's kind of working but I don't really understand why and why not.
-$HEAT does work (no error) in the velocity node but not the source1 node. (error) Why?
- $HEAT doesn't create an error (as far as I can tell) but doesn't create an effect either. All particles have the same speed.
But…all the colors are transferred to the particles!?
And the HEAT is also transferred to the particles, which is good because thats what I want too but didn't specify, yet. (visible if I switch on my custom HEAT text in the display)
Also, what does the $FF==1 mean in the Activation of the velocity node?
-$HEAT does work (no error) in the velocity node but not the source1 node. (error) Why?
- $HEAT doesn't create an error (as far as I can tell) but doesn't create an effect either. All particles have the same speed.
But…all the colors are transferred to the particles!?
And the HEAT is also transferred to the particles, which is good because thats what I want too but didn't specify, yet. (visible if I switch on my custom HEAT text in the display)
Also, what does the $FF==1 mean in the Activation of the velocity node?
--
Jobless
Jobless
- varomix
- Member
- 460 posts
- Joined: July 2005
- Offline
$FF==1
is like a very simple if check
if Floating Frame is equal to 1, result 1, else result is 0
you can use this to activate and deactivate stuff on a frame
you could check if frame is less then 5
$FF < 5
simple and powerful
is like a very simple if check
if Floating Frame is equal to 1, result 1, else result is 0
you can use this to activate and deactivate stuff on a frame
you could check if frame is less then 5
$FF < 5
simple and powerful
varomix - Founder | Educator @ Mix Training
Technical Artist @ Meta Reality Labs
Technical Artist @ Meta Reality Labs
- Soothsayer
- Member
- 861 posts
- Joined: Oct. 2008
- Offline
- Soothsayer
- Member
- 861 posts
- Joined: Oct. 2008
- Offline
- Soothsayer
- Member
- 861 posts
- Joined: Oct. 2008
- Offline
Phew, almost there. Here are some hopefully real questions for a change.
● First, I want the HEAT attribute to pass from the flame back to the object so that it can burn itself quicker or slower depending on the angle (see image).
I thought I could just import the POP, but it's missing the heat attribute, even though it exists in the original POP (see image). How to get it?
●Second, there appears to be an artifact with the particles. They circle the match in a spiral, where there is no flame. I think it is related to an expression I put in the Age node in the POP (if($HEAT>0, $LIFESPAN, $DEAD)). I would have used the source node, but it wont accept $HEAT (is that a bug? I can't see why it shouldn't if I can use it in the other nodes below)
● First, I want the HEAT attribute to pass from the flame back to the object so that it can burn itself quicker or slower depending on the angle (see image).
I thought I could just import the POP, but it's missing the heat attribute, even though it exists in the original POP (see image). How to get it?
●Second, there appears to be an artifact with the particles. They circle the match in a spiral, where there is no flame. I think it is related to an expression I put in the Age node in the POP (if($HEAT>0, $LIFESPAN, $DEAD)). I would have used the source node, but it wont accept $HEAT (is that a bug? I can't see why it shouldn't if I can use it in the other nodes below)
--
Jobless
Jobless
- Soothsayer
- Member
- 861 posts
- Joined: Oct. 2008
- Offline
- Soothsayer
- Member
- 861 posts
- Joined: Oct. 2008
- Offline
OK, I made a very simple scene to debug this attribute-in-expressions problem. It looks fishy to me.
In obj>particle>popnet1 both parts are supposed to do the same thing with the exception that source2 won't accept $HEAT in an expression wheras velocity1 does.
The way I can think of removing the unwanted particles in the previous file is by adding if($HEAT>0,1,0) into one of the birth slots of the source node. I can't find a separate birth node to append, like the velocity node)
In obj>particle>popnet1 both parts are supposed to do the same thing with the exception that source2 won't accept $HEAT in an expression wheras velocity1 does.
The way I can think of removing the unwanted particles in the previous file is by adding if($HEAT>0,1,0) into one of the birth slots of the source node. I can't find a separate birth node to append, like the velocity node)
--
Jobless
Jobless
- edward
- Member
- 7730 posts
- Joined: July 2005
- Offline
Soothsayer
In obj>particle>popnet1 both parts are supposed to do the same thing with the exception that source2 won't accept $HEAT in an expression wheras velocity1 does.
I mentioned that this won't work. I think the reason is because the local variable mappings aren't copied until after the particles are all setup. <shrugs>
- edward
- Member
- 7730 posts
- Joined: July 2005
- Offline
Soothsayer
● First, I want the HEAT attribute to pass from the flame back to the object so that it can burn itself quicker or slower depending on the angle (see image).
I thought I could just import the POP, but it's missing the heat attribute, even though it exists in the original POP (see image). How to get it?
The POP Merge SOP is a way to reuse an existing POP network. When you middle-click on it, you should see a much bigger problem than missing attributes, there's 0 points. The reason for this is because there's no input geometry for the POP Merge SOP at all.
There's some problems I see with your match2b.hip file:
- You can't just modify the INITIAL_GEO network. That's only used to set up the initial geometry from which the solver_geo network uses and modifies on a per frame basis. So any work that you want to do on a simulation basis should be done inside the solver_geo network.
- Some careful thought should reveal that you just can't pass the particles which depend on the heat values back into the match _at the same frame_ since those particles uses the heat values from the match itself. What you really want is a way to influence the heat values on the match from the particles at the previous frame. I think the easiest way to do that is to probably append a Cache SOP to your popnet node and then append to that, a Time Shift SOP. Now use an Object Merge (not a POP Merge) to merge in the Time Shift SOP. Now you should be able to AttribTransfer the heat values from the particles of the previous frame onto the current frame. This is just hand-waving of course. Sorry, I can't help you much here because I'm pretty busy these days.
●Second, there appears to be an artifact with the particles. They circle the match in a spiral, where there is no flame. I think it is related to an expression I put in the Age node in the POP (if($HEAT>0, $LIFESPAN, $DEAD)).
Some problems with this:
1. $DEAD is a variable that is 1 if it is marked dead, 0 otherwise. If you read the helpcard for the Age POP, the units of the Lifespan parameter is in seconds. So this means that the particles will have a minimum expected time span of 1 second, or 24 frames for a scene file with 24 FPS.
2. I think you should really be using the Kill POP if you want to kill particles right away anyways. However, there are still some 1 frame rules with this I suspect.
3. If you just want to birth more points at the high heat values, just use an AttribPromote SOP and promote your heat attribute from point to primitive, renaming it at the same time to something like heat_birth. Now in your Source POP, set the birth method to Surfaces (attribute). Then in the Distribution Attribute parameter, set it to heat_birth.
- Soothsayer
- Member
- 861 posts
- Joined: Oct. 2008
- Offline
- Soothsayer
- Member
- 861 posts
- Joined: Oct. 2008
- Offline
:idea: I think I got it! :idea:
・My attributes are data connected with points.
・If a “channel” is not about points it won't accept the $attribute as a variable. I have to extract its value first.
・I do that with a point() function.
So, I typed point(opinputpath(“.”,0), $PT, “heat”,0) into a channel of one of the nodes and bingo it works.
But opinputpath(“.”,0) only gets the path of the node's input. How do I get paths of any nodes? I don't know the syntax for it and can't find it in the docs.
Can I right click on a node or something and copy-paste the path?
・My attributes are data connected with points.
・If a “channel” is not about points it won't accept the $attribute as a variable. I have to extract its value first.
・I do that with a point() function.
So, I typed point(opinputpath(“.”,0), $PT, “heat”,0) into a channel of one of the nodes and bingo it works.
But opinputpath(“.”,0) only gets the path of the node's input. How do I get paths of any nodes? I don't know the syntax for it and can't find it in the docs.
Can I right click on a node or something and copy-paste the path?
--
Jobless
Jobless
- stevenong
- Member
- 1631 posts
- Joined: July 2005
- Offline
Hi,
Here's the help for the point() function:
http://www.sidefx.com/docs/houdini9.5/expressions/point [sidefx.com]
It's also available in the Help docs that comes with Houdini:
http://localhost:48627/expressions/point [localhost]
In addition, you can type “exhelp point” in the textport for the same information. Furthermore, you can type help or exhelp for all the functions then help or exhelp function to get more information. You can also find functions with a keyword and it will return all functions which have the keyword in its help.
help opset
exhelp point
Using keyword:
help -k flag
exhelp -k distance
In the Online Help, there is an Expression Cookbook which should help too.
http://localhost:48627/ref/expression_cookbook [localhost]
With the help docs out of the way, for the path of other OPs, you can just do:
point(“/obj/myObj/mySOP”,$PT,“foo”,0)
Or drag the node to the textport which will give you the path then copy & paste. You can also drag the node to a parameter of the current operator you're editing but it will override the parameter so be careful.
Cheers!
steven
Here's the help for the point() function:
http://www.sidefx.com/docs/houdini9.5/expressions/point [sidefx.com]
It's also available in the Help docs that comes with Houdini:
http://localhost:48627/expressions/point [localhost]
In addition, you can type “exhelp point” in the textport for the same information. Furthermore, you can type help or exhelp for all the functions then help or exhelp function to get more information. You can also find functions with a keyword and it will return all functions which have the keyword in its help.
help opset
exhelp point
Using keyword:
help -k flag
exhelp -k distance
In the Online Help, there is an Expression Cookbook which should help too.
http://localhost:48627/ref/expression_cookbook [localhost]
With the help docs out of the way, for the path of other OPs, you can just do:
point(“/obj/myObj/mySOP”,$PT,“foo”,0)
Or drag the node to the textport which will give you the path then copy & paste. You can also drag the node to a parameter of the current operator you're editing but it will override the parameter so be careful.
Cheers!
steven
- Soothsayer
- Member
- 861 posts
- Joined: Oct. 2008
- Offline
edward
I think the easiest way to do that is to probably append a Cache SOP to your popnet node and then append to that, a Time Shift SOP.
So, if I type in $F-1 then it'll always use the previous frame. But what happens if the previous frame doesn't exits? As in, -1?
By the way, what's the difference between $F and $FF. They both seem to do the same.
Stevenong, thanks for that.
--
Jobless
Jobless
- Soothsayer
- Member
- 861 posts
- Joined: Oct. 2008
- Offline
Unfortunately, importing attributes into my dopnet leads to all kinds of weird feedback strangeness.
If anybody knows the following though, that might help me:
Can I make a copy of an attribute and call it something else?
(I'm thinking of renaming the heat attributes on my particles but keeping the same heat values)
If anybody knows the following though, that might help me:
Can I make a copy of an attribute and call it something else?
(I'm thinking of renaming the heat attributes on my particles but keeping the same heat values)
--
Jobless
Jobless
- Soothsayer
- Member
- 861 posts
- Joined: Oct. 2008
- Offline
Wahoo, I think I got it!
Thanks for everyone's help. Scene attached for anybody interested in it.
As an afterthought, I think it would be great to get some indepth tutorial or discussion on attributes, especially how they are related to different networks and variables, local variables, transfers, in expressions, etc. It's quite tricky at times…
Thanks for everyone's help. Scene attached for anybody interested in it.
As an afterthought, I think it would be great to get some indepth tutorial or discussion on attributes, especially how they are related to different networks and variables, local variables, transfers, in expressions, etc. It's quite tricky at times…
--
Jobless
Jobless
-
- Quick Links