Announcement

Collapse
No announcement yet.

Water Caustics

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Water Caustics

    Hello everyone,

    Here's a quick tutorial on how I created a underwater caustic effect.

    1 - Add in a World position node
    2- then a multiple node: give "A" a value of 1 and "B" a value of 64
    3- Divide those two together: "A" = World position node "B" = Multiply node
    4- Plug the divide node into a component mask and mask off the red and green channels
    5- Add in a Panner node and plug the mask into the coordinate connection then add a Time node and plug that into the time connection
    6- Now you'll need to find and add "Motion_4wayChaos" it's found under "Engine Content/Functions/Engine_MaterialFunctions03/ComplexMotion"
    7- Once you add that in plug your Panner into the coordinates(V2) connection
    8- Create a parameter and name it "Speed" set it to 1 and plug it into the "Speed" connection
    9- Add in your texture sample then convert it to a Texture Object and plug it into the Texture connection
    10- Multiply all this by a parameter to control the intensity of the effect and plug it into the Emissive channel
    11- Change your Material domain from "Surface" to " Light Function"
    12- Add a spotlight to your scene
    13- Under it's properties turn off cast shadows
    14- Then scroll down to "Light Functions" and add in your Caustics material.

    Add that's it!

    I hope someone found this useful.

    Caustics Texture

    Click image for larger version

Name:	mat_setup.png
Views:	1
Size:	475.2 KB
ID:	1148577
    Attached Files
    Last edited by papptimus; 02-06-2016, 02:22 PM.

    #2
    Thank you! it would be good to see an image of how it looks in a scene, do you have any you could post?
    [FREE] Procedural Bridge Blueprint, [FREE] Spline Enabled Ivy BP

    Comment


      #3
      Originally posted by ULLS View Post
      Thank you! it would be good to see an image of how it looks in a scene, do you have any you could post?
      Yea would be nice
      Marketplace Asset - Economy Kit; Marketplace Asset - Notification Kit; Marketplace Asset - Achievepedia; Marketplace Asset - Player Stats Kit; Marketplace Asset - Photomode;
      Marketplace Asset - Interaction Kit; Marketplace Asset - Turret Kit; Marketplace Asset - Character Stats Kit; Marketplace Asset - Smooth Camera Kit; Plugin - Toggl Plugin;
      Hire us here; Panda Studios, Game development company.; Official Unreal Engine Game Jam Sponsor

      Comment


        #4
        Here's a screen shot of the effect in action.

        Also it might be helpful to change the "B" value of the first Multiply to a parameter so that you can adjust the scaling of the effect.

        Click image for larger version

Name:	shot1.png
Views:	1
Size:	617.9 KB
ID:	1074999

        Comment


          #5
          Very nice.
          Thank you
          My small game on IndieDB ****** Beams on Twitter ****** Beams on Steam ****** VideoStuff ****** PictureStuff
          UE brings Math back into my life or i am not sure.

          Comment


            #6
            Very cool tutorial, I think I can need that

            EDIT: So basically it just pans the texture in a given direction.. Wouldn't it be more realistic to have some deforming and distortion effects? As if the water surface would be in motion? (Although Iam not sure about how to achieve that at the moment)
            How does your setup look in real time?

            EDIT2: Or is the Motion_4wayChaos dealing with that already?
            Last edited by Hackmet; 04-24-2015, 05:46 AM.
            Check out my GTA2 remake in UE4

            Comment


              #7
              Here's a video of the effect in action.

              https://youtu.be/DDvl1TSysQE

              Comment


                #8
                Thanks for the tutorial, very useful for material novices such as myself. It definitely works well on flat surfaces, but I noticed that the effect stretches into thin lines along the Z axis regardless of the light's directional angle. What can you do to make the light function work on vertical surfaces as well?

                By the way, is the caustics texture free to use? It looks more natural than the one I had in my library.

                Comment


                  #9
                  Yes the texture is free to use. As far a the vertical surface problem goes, I'll have to look into that because I honestly have not tried projecting it that way.

                  Comment


                    #10
                    Week before last, before I came down with the flu, I was trying to experiment with creating fractal designs in the material editor.. and while I failed miserably, I did wind up with an animated design that looked exactly like a water caustics. If I can manage to come up with it again, could we compare?
                    WIP: Science Project - A collection of middle school through advanced college level science theory and formula-based functions for use in your own projects
                    World Machine to UE4 Export Macro
                    WM Folder Generator - Creates a folder that you name with HeightMap, NormalMap, SplatMap, and Tile sub-folders

                    Comment


                      #11
                      Originally posted by SaviorNT View Post
                      Week before last, before I came down with the flu, I was trying to experiment with creating fractal designs in the material editor.. and while I failed miserably, I did wind up with an animated design that looked exactly like a water caustics. If I can manage to come up with it again, could we compare?
                      That would be great!

                      Comment


                        #12
                        I'm pretty new to UE4 and i can't find the "Motion_4wayChaos" node. I'm not even sure where to look for it

                        Comment


                          #13
                          Originally posted by Smashin' View Post
                          I'm pretty new to UE4 and i can't find the "Motion_4wayChaos" node. I'm not even sure where to look for it
                          Look at step 6

                          In the content browser, go to view options, check "Show engine content", go to the path specified in step 6 and there you go.

                          Comment


                            #14
                            The real question is whether or not it's possible to create a material that applies the caustics to the geometry "below" it. I know it's ppssible to mask out deep regions of the geometry below based on screen depth, but having caustics conform to the geometry of the water bed is obviously a different matter.

                            Comment


                              #15
                              Originally posted by DamirH View Post
                              The real question is whether or not it's possible to create a material that applies the caustics to the geometry "below" it. I know it's ppssible to mask out deep regions of the geometry below based on screen depth, but having caustics conform to the geometry of the water bed is obviously a different matter.
                              Since this is a light function, which essentially is just an animated light mask. The pattern will behave just like a light shining on the surface of the geometry.

                              Comment

                              Working...
                              X