Advertisement
Guest User

easiest fnf psych engine wavy bg tutorial in existence

a guest
Oct 25th, 2022
7,469
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. put this in the Lua file of the chart (if you already have a onCreatePost or onUpdate function just put it at the end of beginning and with some spacing)
  2.  
  3.  
  4.  
  5. function onCreatePost()
  6. initLuaShader("fart")
  7.  
  8. setSpriteShader("background", "fart")
  9. end
  10.  
  11. function onUpdate()
  12. setShaderFloat("background", "uTime", getSongPosition()/1000)
  13. setShaderFloat("background", "uWaveAmplitude", 0.01)
  14. setShaderFloat("background", "uSpeed", 2)
  15. setShaderFloat("background", "uFrequency", 5)
  16. end
  17.  
  18.  
  19.  
  20. then on the folder of your mod on the Shaders folder add a file called fart.frag
  21.  
  22. open that file on notepad and put This text in it:
  23.  
  24.  
  25.  
  26.  
  27. #pragma header
  28. //uniform float tx, ty; // x,y waves phase
  29.  
  30. //modified version of the wave shader to create weird garbled corruption like messes
  31. uniform float uTime;
  32.  
  33. /**
  34. * How fast the waves move over time
  35. */
  36. uniform float uSpeed;
  37.  
  38. /**
  39. * Number of waves over time
  40. */
  41. uniform float uFrequency;
  42.  
  43. /**
  44. * How much the pixels are going to stretch over the waves
  45. */
  46. uniform float uWaveAmplitude;
  47.  
  48. vec2 sineWave(vec2 pt)
  49. {
  50. float x = 0.0;
  51. float y = 0.0;
  52.  
  53. float offsetX = sin(pt.y * uFrequency + uTime * uSpeed) * (uWaveAmplitude / pt.x * pt.y);
  54. float offsetY = sin(pt.x * uFrequency - uTime * uSpeed) * (uWaveAmplitude / pt.y * pt.x);
  55. pt.x += offsetX; // * (pt.y - 1.0); // <- Uncomment to stop bottom part of the screen from moving
  56. pt.y += offsetY;
  57.  
  58. return vec2(pt.x + x, pt.y + y);
  59. }
  60.  
  61. void main()
  62. {
  63. vec2 uv = sineWave(openfl_TextureCoordv);
  64. gl_FragColor = texture2D(bitmap, uv);
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement