Home Unreal Engine

Water vertex shader - how do you make waves smaller near coast?

I am working on a water shader in UE4 and I am stuck when it comes to making the waves smaller when they get closer to the coast. The vertex shader in UE4 can't read depth. Do you guys have any idea on how to get this result?

Replies

  • Fnitrox
    Offline / Send Message
    Fnitrox polycounter lvl 6
    I'm working on a FFT waves model for a water shader too... haven't really got to actually making shores but I was planning on doing it with vertex color masking, with the alpha controlling the parameters for the amplitude and frequency of the waves.
  • JoakimMellergard
    Fnitrox wrote: »
    I'm working on a FFT waves model for a water shader too... haven't really got to actually making shores but I was planning on doing it with vertex color masking, with the alpha controlling the parameters for the amplitude and frequency of the waves.

    Ah ok! Yes that would work but it's not very generic. I'll consider it!
    Thank you for sharing your ideas!

    Any other ideas out there?
  • kurt_hectic
    Offline / Send Message
    kurt_hectic polycounter lvl 10
    I'm interested too. If you have any tutorials please post.

    I don't know how to detect collision with mesh from shader level ;\
  • PolyBend
    Why can't you use the depth expressions? It is just a limitation of the shader settings you have?
  • JoakimMellergard
    PolyBend wrote: »
    Why can't you use the depth expressions? It is just a limitation of the shader settings you have?

    Yes exactly. The vertex shader in UE4 cannot read depth.
  • PolyBend
    Yes exactly. The vertex shader in UE4 cannot read depth.

    That is unfortunate, could have been easier if you had access to DepthFade. My suggestion would then also be to use vertex colors. Not the most "automatic" solution, but it will work and you do have more control than most other solutions.

    Going to think on this awhile though, I will let you know if I come up with anything.
  • JoakimMellergard
    PolyBend wrote: »
    That is unfortunate, could have been easier if you had access to DepthFade. My suggestion would then also be to use vertex colors. Not the most "automatic" solution, but it will work and you do have more control than most other solutions.

    Going to think on this awhile though, I will let you know if I come up with anything.

    Yes I tried the vertex colors out and it worked as expected but a more generic solution which doesn't need the control you speak of is what I was looking for.
Sign In or Register to comment.