Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

need help with wet ground shader

Discussion in 'Shaders' started by TianWolf, May 25, 2013.

  1. TianWolf

    TianWolf

    Joined:
    Aug 20, 2011
    Posts:
    161
    I'm writing a wet /rain terrain shader. I'll add what I have later,so any general tips will be appreciated also if there is a good
    shader that already does this I would be interested in looking at that too
     
  2. Lulucifer

    Lulucifer

    Joined:
    Jul 8, 2012
    Posts:
    358
    I have seen a snow shader,which can gradually act to snow fall,
    but I dont remember where it is, it is a free shader written as a surface shader tutorial,
    you can google that out, I think it is a link in one of unity's external tutorials
     
  3. Annihlator

    Annihlator

    Joined:
    Oct 15, 2012
    Posts:
    378
    I'm still busy developing my own RainShader too!
    General tips i don't know, for i'm not sure what it is exactly that you want to do with the shader :)

    But if you're looking for a demo; www.annihlator.nl/RainTest is the place to be :) feel free to ask questions.
    note: The bottom two links are from a different scene then the others. there's no local build available for that scene, sorry! (also, in the second scene the "oscillator" function is broken.)

    "Features" I've included in my shader:
    - Diffusion + Specular (RGB + A)
    - HeightMap
    - NormalMap
    - "RainMap" (4-way seamless tiling animated ripplemap)
    - Vertex (Color) Blending
    - Reflections (using MirrorReflection scripts from the Unify Wiki) with (adjustable) Fresnel reaction
    - "Poreusity" (the amount of rain absorbed by the surface, this has effect on different aspects of the shader)

    and then some.

    If you're looking for pointers about a technique or that direction i'll probably spit out everything. I'm not simply giving away the shader though (for reasons which quite likely are obvious) :)

    (And most of the logic has been inspired by the behaviour of this shader; http://www.youtube.com/watch?v=djXuW0912sI )
     
    Last edited: May 27, 2013
  4. TianWolf

    TianWolf

    Joined:
    Aug 20, 2011
    Posts:
    161
    Couple pointer about techniques would be really helpful, I'm kinda new to writing shaders. I've only written some basic shaders until now.
     
  5. Annihlator

    Annihlator

    Joined:
    Oct 15, 2012
    Posts:
    378
    Yeah but what kind of techniques? I have no idea what you can and can't do at this point :)
     
  6. TianWolf

    TianWolf

    Joined:
    Aug 20, 2011
    Posts:
    161
    I've basically just started writing shaders. I've done a few simple shaders for practice(diffuse, specular) and am doing a normal map one right now.
     
  7. jc_lvngstn

    jc_lvngstn

    Joined:
    Jul 19, 2006
    Posts:
    1,508
    Check out the Relief pack shaders (search for relief shader), specifically the one for terrains.
     
  8. TianWolf

    TianWolf

    Joined:
    Aug 20, 2011
    Posts:
    161
    As of right now I'm reading a blog by "Sébastien Lagarde" about how to go about conceptualizing and designing the wet shader. In regards to actual code, I'd have to restart since I was doing it all wrong. What I've learned is that basically there's a lot of things you have to take in to consideration such as having to darken the diffuse and increasing the specularity and needing heightmaps to consider where water would pool up. The blog by Lagarde has some code on the blog as well but thus far make mention of the attributes of the wet surface which I hadn't really thought about before. It's a great read thus far. Will get back to you guys as I make progress.
     
  9. Annihlator

    Annihlator

    Joined:
    Oct 15, 2012
    Posts:
    378
    Ah, this blog? http://seblagarde.wordpress.com/2012/12/10/observe-rainy-world/
    That's indeed a very good one for covering how technically rain "works" in graphic terms.
    I found it very helpfull when designing my version to make graphs of how i wanted the values in the formulae to evolve and influence each other (also for the Vertex Color data).