Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Our response to Improbable’s blog post (and why you can keep working on your SpatialOS game). Read more here
    Dismiss Notice
  4. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Image based Ripple displacement

Discussion in 'Shaders' started by Anim, Aug 16, 2010.

  1. Anim

    Anim

    Joined:
    Aug 11, 2008
    Posts:
    289
    Hi all

    I need to create a full screen ripple effect, like a shockwave emitting from the middle of the screen outwards which displaces whatever is in the view over a second or two. Almost like a single rain drop hitting a water surface but its the view instead.

    This is a visual effect only, it doesn't need to affect any game objects physically.

    In 3DSMax I would animate a torus mesh that scales up from some point on the screen then use that rendered sequence as an animated displacement texture as a post process effect.

    But I can't quite grasp how to create this in Unity? and with reading how full screen effects use the shader language fear this is beyond me.

    Any help please?

    Thanks
    Geoff
     
  2. tomvds

    tomvds

    Joined:
    Oct 10, 2008
    Posts:
    1,028
    Check out the project in this post:
    http://forum.unity3d.com/viewtopic.php?t=4685

    It demonstrates how to create displacement around a fire.

    You could use this same technique for a shockwave. Basically, it involves replacing the normalmapped particles by your scaling torus (with a normal map texture) and then aligning the display quad with the floor.
     
  3. Anim

    Anim

    Joined:
    Aug 11, 2008
    Posts:
    289
    Hi

    Thanks for the link, looks great.

    If this technique can be combined with an image based shader effect rather than requiring a gameobject then that would be perfect.

    Geoff
     
  4. tomvds

    tomvds

    Joined:
    Oct 10, 2008
    Posts:
    1,028
    If the problem is the quad intersecting with objects, you could render it without ZTest and in the overlay render queue to make sure the effect is visible everywhere.

    If you need it to be an image effect for another reason (one that cannot be fixed by simple shader tweaks) you'll probably have some work to do to get it working. I don't know of any example projects that implement it as image effect, so you may have to write the whole thing yourself.
     
  5. Anim

    Anim

    Joined:
    Aug 11, 2008
    Posts:
    289
    Hi

    Aye, I didn't think it existed and was hoping for a shader writer to have a crack at it. I am more of a 3D Artist than a programmer so find this area quite challenging.

    Would it be complex for a shader to take a normal map from a renderTexture and apply it as an Image based displace effect with controls for displace strength and center point.

    Lots of different effects could be produced from this one shader that also has the bonus of being independent of camera motion.

    Rain running down the camera lens
    The ripple effect I am after
    Cracking screens
    Heat haze/shimmer
    Pin Cushion kind of warp effects
    Dented, pitted view

    If nobody is interested in writing such a shader maybe I could find the source for Singularity Bomb which produces a nice ripple effect.


    Cheers
    Geoff
     
  6. tomvds

    tomvds

    Joined:
    Oct 10, 2008
    Posts:
    1,028
    Yes, that should be possible, but I believe you can achieve the exact same effect using the shaders from the project I linked, by rendering the quad directly in front of the camera (with ZTest disabled and in the overlay queue to force it to be rendered last).

    There may be a performance difference between the two (I don't know how GrabPass compares to image effects in terms of performance), but I don't think there will be much difference visually.
     
  7. Anim

    Anim

    Joined:
    Aug 11, 2008
    Posts:
    289
    Hi Tom, I will give it a shot the way you suggest, thanks for taking the time to help.

    Cheers
    Geoff
     
  8. Anim

    Anim

    Joined:
    Aug 11, 2008
    Posts:
    289