Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Help Wanted Vertex height shader and caustic effect on Terrain with shader graph?

Discussion in 'Shader Graph' started by Rakowu, Nov 19, 2020.

  1. Rakowu

    Rakowu

    Joined:
    Nov 15, 2017
    Posts:
    16
    Hello everyone,
    i have an underwater scene where i have a terrain. This terrain should be paintable and just have a overlaying caustic effect.

    If this is not possible to paint and use the caustic effect with the shader graph then the second option would be to blend different textures depending on the vertex height instead of painting it. I know the theory for old shader versions but I have no idea how to do it with the pbr shader graph. I need shader graph because I use the Universal Render Pipeline template.

    Any help is appreciated :)
     
    Last edited: Nov 20, 2020
    unity_V6C2VjJnkACZgQ likes this.
  2. Rakowu

    Rakowu

    Joined:
    Nov 15, 2017
    Posts:
    16
    So neither of these are possible? Or is my question incomprehensible? If it is so please let me know and i'll try to explain it better.
     
  3. unity_V6C2VjJnkACZgQ

    unity_V6C2VjJnkACZgQ

    Joined:
    Oct 27, 2019
    Posts:
    8
    You're not alone with this Problem. I've the same probloems with Shader Graph. I tried to use the Projector instead, but it doesn't work in the Universal Render Pipeline. :( I want to create AoE and some Spelleffects on the surface on an uneven Terrain.
     
  4. Rakowu

    Rakowu

    Joined:
    Nov 15, 2017
    Posts:
    16
    Hey i found a workaround which could maybe help you. I've created a "triplanar" shader (It splits top, side and front of the vertex to give them indivdually textures). I added 3 textures, sand for the top, rocks for front and side. And after that just a caustic texture (an image which you add overlayin everything) and moving it's offset by sine time. Now when you set heights and depths while painting it paints different textures when raising etc. Maybe it helps you.
     
  5. Rakowu

    Rakowu

    Joined:
    Nov 15, 2017
    Posts:
    16
    I also found this video, i will have a look at it later, maybe it can help you too :)


    Seems that Polybrush is the solution
     
  6. Rakowu

    Rakowu

    Joined:
    Nov 15, 2017
    Posts:
    16
    Ok I think the best way is a combination between triplanar, using the position node, split it for the axis and lerp all together to make it more random. Than overlay it with your caustic texture for example. This ist what i've got so far :)


    Would be great to make the tiling in a stochastic way (no repetitive tiling texture). I saw a plugin but i will try to figure out how to generate it just with nodes.
     
    unity_V6C2VjJnkACZgQ likes this.
  7. unity_V6C2VjJnkACZgQ

    unity_V6C2VjJnkACZgQ

    Joined:
    Oct 27, 2019
    Posts:
    8
    I'm right, you figured it out how it works? Can you show me and others, how you've done?
     
  8. Rakowu

    Rakowu

    Joined:
    Nov 15, 2017
    Posts:
    16
    In this setting you can see how to divide in a triplanar way the textures. Triplanar means "rop,left, front" of a object. In my case it has now for each side of the object a texture and for the top layer i added also color.
    The pow setting above is to smooth the transition.

    upload_2020-12-2_9-18-43.png

    In this setting i divided the height what is basically what we both need. You can make it relative to the object or the world. In this setting i added the a overlaying caustic effect for the top part of the object. With the properties you can blend them and set the y value of the position.

    upload_2020-12-2_9-21-8.png


    In my case i added also the normalmap which is done in the same way as the triplanar division of the textures (image 1). I also added a shadow version which is basically the same as image2 but instead for the top part i made it for the bottom part. After all of the settings lerp it all together and you are good to go. I think the result is nice and made my game improve a lot. I hope i could help ^^
     
unityunity