Home Unreal Engine

Sine/Cosine phase Shift?

polycounter lvl 5
Offline / Send Message
Minato polycounter lvl 5
May seem like an odd question,but how can i shift a sine wave left and right in the material editor?...

Replies

  • imbueFX
    Options
    Offline / Send Message
    imbueFX polycounter lvl 5
    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?
  • Minato
    Options
    Offline / Send Message
    Minato polycounter lvl 5
    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...^^
  • Money
    Options
    Offline / Send Message
    Money polycounter lvl 8
    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
  • Minato
    Options
    Offline / Send Message
    Minato polycounter lvl 5
    Great info as always...i'm gonna try those out...thanks money...i had a feeling about using custom nodes...
  • imbueFX
    Options
    Offline / Send Message
    imbueFX polycounter lvl 5
    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.
  • Angry Beaver
    Options
    Offline / Send Message
    Angry Beaver polycounter lvl 7
    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.
  • Money
    Options
    Offline / Send Message
    Money polycounter lvl 8
    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.
  • imbueFX
    Options
    Offline / Send Message
    imbueFX polycounter lvl 5
    Np Money, I learned something new here as well. High five to teamwork!
  • Minato
    Options
    Offline / Send Message
    Minato polycounter lvl 5
    Very interesting,i never looked at it like that,seems right,thanks a lot imbuefx and money.
Sign In or Register to comment.