View Full Version : Sine/Cosine phase Shift?
06-20-2012, 08:47 AM
May seem like an odd question,but how can i shift a sine wave left and right in the material editor?...
06-20-2012, 09:27 AM
Just doing a simple add or subtract with a scalar value should be all you need (if I understand you correctly). What are you trying to achieve?
06-20-2012, 10:16 AM
Simply adding/Subtracting will shift the wave up/down and it's corresponding operation is (sinx)+1...i'm trying to achieve a shift in the X axis also known as a phase shift which corresponds to sin(x+1)...pure curiosity...^^
06-20-2012, 10:21 AM
I'm not sure you can get phase shift outside of 90 degree angle without using custom nodes. Adding or subtracting a scalar value wouldn't work because you would need to have those values change too during time to match the phase.
Anyway if you wan't to get 90,180,270 shift it's fairly easy. For 180 just use 1-x on sin, for 90 and -90 (270) you do the same just by using cos node. But for fine tuning like 15, 30, maybe by using custom node it would be possible, anyway I couldn't get it to work before with stock ones.
Actually, maybe even 45 angle should be possible with some simple math, this would be the formula in that case, but I would really need to test that on paper to make sure the numbers are correct
sin (x + 45) = (sin (x) + cos (x)) * sqrt (2) / 2
06-20-2012, 10:43 AM
Great info as always...i'm gonna try those out...thanks money...i had a feeling about using custom nodes...
06-20-2012, 11:06 AM
Ah crap, I'm sorry I gave you an incomplete piece of advice. Add/minus against the time expression going in to your sine wave.
edit: I understand this is more of a hack than anything, and isn't really shifting the sine wave as it is more of an time offset, but it works and is cheap on instruction count.
06-20-2012, 11:10 AM
Yeah I cracked open UDK because it didn't seem right there was no way to control it, by default the sine wave acts like it has a time node plugged into the right socket, but if you make an actual time node then like imbue says you can just add to it before you feed it in.
06-20-2012, 11:24 AM
That should work, for time node 2Pi is neutral value then right? So the desired angle would just be added as a scalar value in radians before that sine node.
Thanks imbueFX, it's been quite some time since I was messing with that, but I totally missed the part to try and control it before sine node.
06-20-2012, 11:58 AM
Np Money, I learned something new here as well. High five to teamwork!
06-20-2012, 12:51 PM
Very interesting,i never looked at it like that,seems right,thanks a lot imbuefx and money.
vBulletin® v3.8.4, Copyright ©2000-2013, Jelsoft Enterprises Ltd.