Search - User list
Full Version: Color by Y position
Root » Houdini Learning Materials » Color by Y position
stigolsen
Hi,

I have this project where I try to color the falling particles when they reach the Y position that is set in the attribute create.
I then reference the attribute in the color tab of the point sop, but nothing happen. Can someone take a look at my project and tell me what Im doing wrong?

Stig
stigolsen
And in this another project (see attachment) I have made a group and a color sop for the same purpose. This doesnt work neither.
sidenimjay
From what I could see, you were not applying the color to the particles

I put in a pop wrangle to set this. I also made a pop vop to do the same, just set the switch parameter to 1 to use the pop vop instead. The second vopsop will blend from one color to the other from one height to your yposy height.

the last thing is, in the attribCreate sop you are using the $TY<0 expression. However, this is only to your source particles, which never cross the threshold.

so the particles will change once the y value is less than 0.
stigolsen
Thanx!

That actually helped me understand POP Wrangle a b bit more.
I did set the code like this:

@Cd = set(0,1,0);

if( @P.y<4)
@Cd = set(1,0,0,0);

I guess @ is the same as using $ for variables?
Is the @P and @Cd variables that are already set, or a part of Houdini? Why dont I need to create those attributes?

Stig
sidenimjay
You are welcome Stig glad to help out!

yes the @ symbol is used in the wrangle instead of a $ symbol

you are correct that the P and Cd are native attributes , as well as v and N, which is why you dont need to create them…it is best practice to declare them however…v@P and v@Cd

to declare a new type or access non native attributes in a wrangle node, you need to specify the type before the @ , f@ v@ s@ i@, for float vector string and integer respectively

if you want to create a local variable in a wrangle node, you can just use the c style notation float foo , vector fee, then use them in the code with no symbol, foo = .53; or fee = set( 1,1,1) . These will be local to this wrangle node and not added to the attributes of the geo
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB