Search Unity

Ripple

Discussion in 'Made With Unity' started by bronxbomber92, Feb 10, 2008.

  1. bronxbomber92

    bronxbomber92

    Joined:
    Nov 11, 2006
    Posts:
    888
    Here's a small shader I found that was in GLSL, and I thought it was pretty neat. So I ported it to Cg, modified it a little, boom - it worked :)

    Well, I didn't make the fantastic scene, but I do plan to :)
    A few simple scene, the shader, script, and material are all setup and ready to be used.

    Currently the wave frequency and amplitude are adjustable. In the shader, I have commented out the noise portion, but have put comments in if you wish to add it.





    I hope someone find a good use for this :)
     

    Attached Files:

  2. AaronC

    AaronC

    Joined:
    Mar 6, 2006
    Posts:
    3,552
    Well the pic is tiny and clicking on it links to a blank white page
    So I'll trust it looks great-well done modifying shaders
    AC

    EDIT Oh wait its working now along with its lovely ads. looks like I won something. I hate those ads. Shader looks good though. Is the ripple animated?

    If someone reads this in 6months, will image shack still have those pictures? It would be good if this thread made sense to future readers.
     
  3. norby

    norby

    Joined:
    Jul 10, 2006
    Posts:
    277
    Nice shader

    would this be something for an Ocean
    wave shader? . it's nice to have an
    animated wave loop in it, or random
    wave generator (perlin noise)

    norby
     
  4. EducaSoft

    EducaSoft

    Joined:
    Sep 9, 2007
    Posts:
    650
    Could you post a webplayer with this ?

    It so much nicer to see shaders in action rather then a screenshot.


    Tnx
     
  5. bronxbomber92

    bronxbomber92

    Joined:
    Nov 11, 2006
    Posts:
    888
    This is animated, but can be paused (depending if in the shader you use the built in _Time uniform variable).

    Here's a web player of what I've got currently got. Use the up and down arrows to adjust the wave frequency, and the left and right arrows for the amplitude. I tried this on the built in Water, and it seems to work, but I'd need to add a different texture (or somehow combine two like they do in the original Water shader) and add some type of transparency. Neither of things I'm 100% sure of how to do, but I should be able to figure it out.

    I should note that the actual vertices of the mesh stay intact, they aren't moved at all. It's all done in the fragment shader. Would a (sin wave) vertex variant be nice to have also?
     

    Attached Files:

  6. bronxbomber92

    bronxbomber92

    Joined:
    Nov 11, 2006
    Posts:
    888
    Here's what it might look like if you were to use it for water. (Sorry for the ugly scene, I'm slowly improving it :) )

     
  7. norby

    norby

    Joined:
    Jul 10, 2006
    Posts:
    277
    Hi Bronx

    i have tried the web player, i must say it looks great.
    can you put some randomness in the formula?. a little bit
    of noise instead of a sinus would be cool.

    Norby
     
  8. bronxbomber92

    bronxbomber92

    Joined:
    Nov 11, 2006
    Posts:
    888
    Yeah, that can probably be done. ;)
     
  9. KlaRo115

    KlaRo115

    Joined:
    Feb 24, 2006
    Posts:
    675
    Very nice. :)
    Where can I get the shader? :p
     
  10. bronxbomber92

    bronxbomber92

    Joined:
    Nov 11, 2006
    Posts:
    888
    Shader will be posted soon :)

    Attached is a webplayer of shader with some noise added. It's a different scene (water), because with the noise the sphere looks flat :)
    The shader and a basic scene will be released today. Just need to clean a few things up.
     

    Attached Files:

  11. norby

    norby

    Joined:
    Jul 10, 2006
    Posts:
    277
    Yesss , great work. this is fun.
    what if you initiate 2 sources of noise
    crossing each-other . and then use this
    shader on a plane with a mesh deformer
    script to create more Amplitude.javascript:emoticon(':D')

    norby
     
  12. norby

    norby

    Joined:
    Jul 10, 2006
    Posts:
    277
    Yesss , great work. this is fun.
    what if you initiate 2 sources of noise
    crossing each-other . and then use this
    shader on a plane with a mesh deformer
    script to create more Amplitude.javascript:emoticon(':D')

    norby
     
  13. bronxbomber92

    bronxbomber92

    Joined:
    Nov 11, 2006
    Posts:
    888
    I'm not sure if that's possible, since all the work is done on the fragment shader, and at it's core it just does some fancy math to produce a new texture coordinate. If it is possible, I don't know how to (yet) :p
     
  14. norby

    norby

    Joined:
    Jul 10, 2006
    Posts:
    277
    never mind. i am not a coder, that's why
    i am always exited when somebody creates new stuff.
    looking for a way to create realistic ocean waves.
    will you post it on wiki ? thanks for your work.

    Norby
     
  15. bronxbomber92

    bronxbomber92

    Joined:
    Nov 11, 2006
    Posts:
    888
    Original post updated with the shader source :)
     
  16. Jhung

    Jhung

    Joined:
    Jan 22, 2008
    Posts:
    10
    very nice! thanks for sharing