Jump to content

Sine waves color


Rival Consoles

Recommended Posts

not sure if I'm on the right track...is this what you want ?

vector pos = @P * chv("Position");
vector center = chv("Center");
float d = distance(vector(pos), center);
d *= ch('Scale');
@Cd = fit(sin(d - @Time*4), -1, 1, 0, 1);

if(@Cd.r>0.5){
    @Cd = set(1,1,1);
}
else{
    @Cd = set(0,0,0);
}

(it's crisper if you change your wrangle to run over prims)

DiscreteRings.jpg

Edited by Noobini
Link to comment
Share on other sites

Thanks for your reply Noobini. I also tried the if statement but as you can see the float fade color is lost when the if statement is applied. I keep getting a warning sign in Houdini stating that i should cast the line where the if sits. I tried casting it but i still couldn't get a smooth color as the original black and white rings, if that makes sense.

 

SideFX, would be very nice if you guys implement in H17 a better debugging system other than very basic error messages. People want to learn VEX and Houdini is awesome!

Link to comment
Share on other sites

i get NO warning. Are you sure you're using @Cd.r ? because that is a float....so it's correct to compare a float with 0.5.

If you use @Cd, that's a vector...so it's telling you to cast it properly (if you were comparing to a float)

(odd that if I use @Cd, I get the warning...correctly...but then if I scrub...the warning goes away, incorrectly !! Dunno...)

Edited by Noobini
Link to comment
Share on other sites

Oh man! The master himself! Matt, thank you so much for the amazing material that you posted a few weeks ago in your website. Learning a lot with it! Some challenging exercises but i suppose that programming is supposed to make people think smart before implementing it. We should have a section in the odforce forum dedicated to the Joy of Vex. I bet that a lot of people have questions about the exercises.

 

Thanks for your help on my question. "Lerp" is a good friend. Cheers.

img1.png

  • Thanks 1
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...