jfrancis Posted February 15, 2011 Share Posted February 15, 2011 Hi, New Houdini user here. So far so good, except for a little confusion here and there. For example: I am trying to do things based on a user-defined attribute I call the magnetic 'charge,' (0 or 1) of objects. At the moment I don't want to do anything too fancy - just change colors based on charge, Later I'll need to get more elaborate. I have a sphere. It has a new attribute called 'charge,' which is a detail integer attribute created by using $FF and noise to produce an integer that randomly flips between 0 and 1. The color nodes see the $CHARGE variable But when I try to use it in an expression in the swith the $CHARGE variable is undefined. Any idea why? Quote Link to comment Share on other sites More sharing options...
Macha Posted February 15, 2011 Share Posted February 15, 2011 (edited) Uhm...first of all I'd say use a detail attribute. But even then, the switch sop does not accept it directly as $ATT, you need a detail() expression. But even then this is not a very clean way of doing it. Better would be a copy sop and stamping because with the switch you'd need to refer to a node higher up the network, not immediately before, or perhaps with opinput(), but it gets all rather messy later on I reckon. However, I attached a file for you to inspect your case (press play to see switching) because I don't know what you would eventually like to do, so it may after all be the right solution for you! switch.hipnc Edited February 15, 2011 by Macha Quote Link to comment Share on other sites More sharing options...
hopbin9 Posted February 15, 2011 Share Posted February 15, 2011 Why use a switch? It's just extra work for Houdini. If you know the charge at the time of setting the color, then use an expression to create a different color. You don't even need to create an attribute if that's all it's doing is changing the color. Quote Link to comment Share on other sites More sharing options...
jfrancis Posted February 16, 2011 Author Share Posted February 16, 2011 Why use a switch? It's just extra work for Houdini. If you know the charge at the time of setting the color, then use an expression to create a different color. You don't even need to create an attribute if that's all it's doing is changing the color. Create a color where? In the color node? It doesn't seem to accept local variables, and I need that $CHARGE for something later. Quote Link to comment Share on other sites More sharing options...
jfrancis Posted February 16, 2011 Author Share Posted February 16, 2011 Uhm...first of all I'd say use a detail attribute. But even then, the switch sop does not accept it directly as $ATT, you need a detail() expression. But even then this is not a very clean way of doing it. Better would be a copy sop and stamping because with the switch you'd need to refer to a node higher up the network, not immediately before, or perhaps with opinput(), but it gets all rather messy later on I reckon. However, I attached a file for you to inspect your case (press play to see switching) because I don't know what you would eventually like to do, so it may after all be the right solution for you! This seems to work for me (although I replace the %2 with a more complex noise-based function)- thanks I didn't realize I needed this detail() function to access the data. I thought a $ANDSOMECAPITALLETTERS would be enough of a way to reference the detail attribute data. Quote Link to comment Share on other sites More sharing options...
Macha Posted February 16, 2011 Share Posted February 16, 2011 (edited) Here's a few more ways to do it. By the way, $ATT doesn't work always. If you look in the helpfile you'll see which node accepts wich local attributes. Often you can get it to work by using a point(), prim(), vertex() or detail() expression. Also, vector attrib components are usually referred to as something like $ATTX $ATTY $ATTZ, whereas that is not true for 3 floats. Just something to be aware of. Color itself is a little unusual in that you refer to its components as $CR $CG and $CB, unless they are volumes in which case they are Cd.x Cd.y, Cd.z Aaaahhh.... switch.hip Edited February 16, 2011 by Macha Quote Link to comment Share on other sites More sharing options...
jfrancis Posted February 16, 2011 Author Share Posted February 16, 2011 thank you Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.