Shader Tutorial for GameMaker 25 - Side-Scroller Water Shader

Поделиться
HTML-код
  • Опубликовано: 22 дек 2024

Комментарии • 29

  • @REALSOLIDSNAKE
    @REALSOLIDSNAKE 5 лет назад +7

    This is such an amazing work. Thank you so much for it. I really enjoyed the video.
    All the best to you, man.

  • @SitoKal
    @SitoKal 4 года назад +2

    YOU'RE AMAZING. Man, I've been seing your videos a you're the best to learn advanced GM!!

    • @gamingreverends-devcorner1379
      @gamingreverends-devcorner1379  4 года назад +1

      Thank you :)

    • @SitoKal
      @SitoKal 4 года назад +1

      @@gamingreverends-devcorner1379 I have a question if you could help me.
      I've been about 5 hours now trying to impplement the water line/water foam distortion into a circular shape since in my case the water is part of a circular planet.
      So in this case for the water line, instead of a line I use a circle outline.
      I have been able to add the effect however since the distortion map moves in the x and y axis, the effect doesn't work well at angles. I think distortionig the distortion map so it makes a circle that closes all the time(Stuff goes from outside to the middle) or/and ;this time easier; making it go in circles around the central point of the surface (Which is the central point of the planet) would work well(R in a direction, G in the opposite,and B going inwards). However I've been unable to find the tools of way to do that.
      I know the key is in this part of the fragment shader:
      *"distort_sample.r = texture2D(distort_tex, fract(v_vPosition_R)).r;"* and *"distort_sample.r = texture2D(distort_tex, fract(v_vPosition_R)).r;"*
      Maybe making the uv coordinates go in circle based on an angle passed to the shader with sin and cos.. but I cannot make it work.
      Could you throw me a little help? If it is too much don't worry, I'll keep working on it and let you know if I get it, but if you can I will love you forever hahaha
      Thanks for all your work!
      *I think I can't post any link here but I have uploaded two gifs of my progress on that on yoyogsmes forum under and you can watch it if you lool for "Rotation of uv coordinates" in the latest post.

    • @gamingreverends-devcorner1379
      @gamingreverends-devcorner1379  4 года назад +1

      @@SitoKal I think you'd need to or can change alot for the effect you want. But I doubt you need to rotate the uvs. you need to rotate the distortion direction. So for each fragment find a distortion strength as a float based on the distortion maps red and green (probably no need for blue).
      Let's say your shader calculates the distortion strength is 0.01. Now create a vector from that where x is the distortion strength and y is 0. Then turn that vector by the angle the current fragment is relative to the centre of the circle. Now the distortion will always be from the centre of the circle.

    • @SitoKal
      @SitoKal 4 года назад

      @@gamingreverends-devcorner1379 that sounds promisong! Thanks a lot man, you're the best 😊😊

    • @SitoKal
      @SitoKal 4 года назад

      @@gamingreverends-devcorner1379 So I have tryed this but makes strange stuff instead of going in circles if you can check it(No need to, just if you want,I understand):
      ·vec2 dir_to_center = vec2(in_Position.x-centro.x,in_Position.y-centro.y);
      ·float angle = degrees(acos(dot(normalize(vec2(1,0)),normalize(dir_to_center))));//Calculate angle between vec2"center" and "inPosition.xy" in degrees
      ·float distance_to_center= length(dir_to_center)/200.0;
      ·v_vPosition_R = (in_Position.xy + vec2(water_shift_RGB.r*distance_to_center*sin(angle), water_shift_RGB.r*distance_to_center*cos(angle))) / pattern_size; //Move anti-clockwise ·v_vPosition_G = (in_Position.xy + vec2(water_shift_RGB.g*distance_to_center*sin(angle), (water_shift_RGB.g*distance_to_center*cos(angle))) / pattern_size; //Moves clockwise ·v_vPosition_B = (in_Position.xy - vec2(0.0, water_shift_RGB.b)) / pattern_size; //Same as original

  • @NoLootStudios
    @NoLootStudios 4 года назад +2

    Holy cow that water looks fantastic

  • @SirSilentPhil
    @SirSilentPhil 5 лет назад +2

    Amazing, thanks!

  • @hectorcastaneda1038
    @hectorcastaneda1038 3 года назад +1

    Does it work with GM 1.4, too?

  • @Andolink66
    @Andolink66 4 года назад

    That AWESOME thank you a lot for your content !

  • @juhasoderqvist1946
    @juhasoderqvist1946 5 лет назад +2

    these are the best!!!!!

  • @lop3436
    @lop3436 2 года назад

    any suggestions on how to do a top-down one?

  • @Corilo91
    @Corilo91 4 года назад

    As always, thank you so much for another beautiful tutorial! How would you suggest to make a water shader for a top-down view game? Would it be better to apply the shader on a tileset layer or have objects drawing the area where there should be water with the shader?

  • @err0rc0degames
    @err0rc0degames 3 года назад

    Really great looking shader but the sliders make it a bit confusing to follow for me

  • @Chickfilae
    @Chickfilae 3 года назад

    Are you using a different camera in GMS?

    • @gamingreverends-devcorner1379
      @gamingreverends-devcorner1379  3 года назад

      very rarely and never in this shder series

    • @Chickfilae
      @Chickfilae 3 года назад

      @@gamingreverends-devcorner1379 when I have the camera zoomed in the reflection moves from directly below to the left or right side

    • @gamingreverends-devcorner1379
      @gamingreverends-devcorner1379  3 года назад

      @@Chickfilae Unfortunately I don't have a solution for you since I don't have time to code one. you need to figuere out where in the drawing and/or shader code you need to apply the camera zoom factor and maybe the cameras position.

  • @dragonisorigins-official4693
    @dragonisorigins-official4693 5 лет назад

    Can you do a motion blur shader next? it seems no one else has yet

    • @gamingreverends-devcorner1379
      @gamingreverends-devcorner1379  5 лет назад +1

      At the moment I have no plans to return to blur shaders. but if you watch all the blur videos in this series you should be able to create motion blur and radial blur without a problem really - so just stat creating one :)

  • @ChrisPriceMusicSamples
    @ChrisPriceMusicSamples 5 лет назад

    Do you have a yyz files with all these shaders and not just the base ones?