Search Unity

can someone modify the water shader?

Discussion in 'Shaders' started by Dorian, Apr 16, 2009.

  1. Dorian

    Dorian

    Joined:
    Mar 31, 2009
    Posts:
    26
    hello could someone modifiy the water shader or tell me how to in order to do the folowing:

    A - refractions: not on texture based but on geometry distortion, like the glass shader, uses a texture only to distort the actual environment its put in.

    B - is there a way to add on top of this shader a falloff self illumination surrounding the edges according to view angle like the ones found in the " shield " or "force field " shaders in the wiki shader list. ( i am planning to use this shader on a spherical shape not a plane ).

    Just an additional question: is it possible to import a small video animated sequence to be used as a texture or bump map in a shader other than the usual image files?

    Thanks.
     
  2. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    A: Not possible without some serious work. Have not seen any shader of this kind actually so far at all, independent of the tech in question.
    Refraction is a pixel shader that visually disorts everything behind the surface.
    If you want the geometry to be disorted, you must apply the shader to all objects that are meant to be disorted and you need to write the corresponding vertex shader to do so.


    Addition: potentially yes.
    But Videos are updated on each frame, which means the texture used on the model too. if the graphics card has to wait each frame for the texture to be present, that will cost you performance. How much actually is something that you will have to test. This is especially because movie decompression costs you cpu time
     
  3. Dorian

    Dorian

    Joined:
    Mar 31, 2009
    Posts:
    26
    Hello thanks for the reply,

    perhaps you misunderstood what i meant by the refraction there.

    ok if you look in the water shader you'll find that the only way its faking the refraction is by a texture map assigned to it, hence its ONLY refracting that texture map, in other words if i create a sphere lets say in the viewport and have couple of boxes geometry in the back i place this sphere infront of the boxes and i apply the water shader on it .. it doesnt refract in any way the objects behind it ( it simply cant see them ), but if i assign the "glass" shader you'll get the distortions from the other objects naturaly, what i want is to keep all the water settings intact but only on that specific refraction settings i want to change it so it could refract like the glass shader does, think of it as a mix material between the two.

    other than that lets suppose this isnt possible as well , is there a way to add on the glass shader then.. some tutorial or script someplace ? , i need to have a fresnel effect on that glass shader along with an outline self illumination like the ones found on those "force field " shaders as mentioned above and reflections! ... thats why i'm trying to use the water shader to get the result .. since it includes more options for me to play with but the refraction part is whats setting me back..

    for the record i'm very familiar with node based shading and not coding .. unfortunately there's no support for imported shaders into unity so we are stuck with the ones inside for the most part and they all need to be coded to be modified.

    Thanks.
     
  4. Dorian

    Dorian

    Joined:
    Mar 31, 2009
    Posts:
    26
    ah one more thing to add, is when i play the island demo i could see the water shader refracting the ground and objects like rocks etc.. properly .. how come it doesnt do that when i apply the shader elsewhere on a different object is there a process to tell it what to refract.. how do you accomplish it.

    thank you for your time.