Search Unity

Wave Creator - Real Waves in Unity!

Discussion in 'Assets and Asset Store' started by SP0KK0, Sep 21, 2013.

  1. GCatz

    GCatz

    Joined:
    Jul 31, 2012
    Posts:
    282
    Hey this looks very nice !
     
  2. Azaroth

    Azaroth

    Joined:
    Oct 17, 2012
    Posts:
    43
  3. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    774
    Sure. Go to the Water Body object in your scene, and in the inspector, adjust the "Waves" values as shown here:

    $WC2 Settings.PNG

    The end result looks a bit like this:

    $WC2 Test 1.jpg

    You can make them even bigger, but at some point it just gets ridiculous.
     
    Last edited: Jan 31, 2014
  4. Azaroth

    Azaroth

    Joined:
    Oct 17, 2012
    Posts:
    43
    Thank you very much for the fast answer. What about the color? I saw in the images that it looks more to green. Is there an option for the color or i can apply a trick like paint the grount or make it deeper? Also in the image i posted the water looks much more realistic. Is there a special shader that does that? Thank you :)
     
    Last edited: Jan 31, 2014
  5. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    774
    The "Colours" tab expands out to give you a selectors for both deep and shallow water that control color and transparency:

    $WC2 Settings 2.PNG

    The possibilities are endless:

    $WC2 Test 2.jpg

    Best advice is to just go through all the settings and fiddle with them to see what they do. It really is quite flexible.
     
    Last edited: Jan 31, 2014
  6. Azaroth

    Azaroth

    Joined:
    Oct 17, 2012
    Posts:
    43
    I see. thank you very much!
     
  7. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    774
    There's also a "Reflection" setting, that you can set up to match your skybox, so if you have some weird purple or green alien sky, it can influence the color as well.

    $WC2 Test 3.jpg
     
    Last edited: Jan 31, 2014
  8. Azaroth

    Azaroth

    Joined:
    Oct 17, 2012
    Posts:
    43
    Yeah, i tested the demo and it is very very good. My only problem is that the wave lines create small connection lines between them and they look like squares. Is there a way to avoid that?
     
  9. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    I'm having trouble with the submerged effect -- after changing the Terrain's height, and then clicking Regenerate on Water Body: Heightmap, it's sold blue-green underwater, no matter what I set the underwater visibility at on the camera script. I put a cube right in front of the camera, but its never visible, just solid blue-green. Is there another step?
     
  10. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    774
    I tried regenerating mine, and got an error message saying it couldn't find part of the path to the height map file. When I went underwater though, everything appeared fine. I'd delete the water body and re-create it from scratch to get a new height map, and if you still have trouble, delete and re-create your camera - they sometimes get stuck in a weird state, and it's often easier to start over than to figure out what went wrong. Still, the regenerate feature may have a bit of a problem, so you might want to report it.
     
  11. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    774
    None of the water packages I've tried give completely random waves. They all repeat, depending on your viewing position. I'd try going into the "Waves" settings though, and changing the height, steepness, and frequency values, while watching the results in the scene view. You might also try changing "Wave Movement" from Directional to Circular, and adjust the "Move Towards" values, to see if any of them break up or reduce the repeating pattern. You could also try replacing or changing the tiling on the wave texture files.
     
    Last edited: Jan 31, 2014
  12. Azaroth

    Azaroth

    Joined:
    Oct 17, 2012
    Posts:
    43
    Yes, i also thought of the circular movement but in order foor the waves to look normal the body must be very big. I will try a good settings configuration.
     
  13. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,684
    I wonder if it would be desirable to have more than one wave generator in the same body of water?
     
  14. Azaroth

    Azaroth

    Joined:
    Oct 17, 2012
    Posts:
    43
    What about rotation? I see the ship going up and down. Does the script take care about the rotation of the object or i have to make a custom one?
     
  15. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    774
    Wave Creator uses a non-physics based floatation script. You simply place it on the object you want to float, identify the water body you want it to float on, and adjust the Offset and Random Rotation Factor to control how high it will sit in the water, and how much it will rock. Increasing the Random Rotation Factor will make it rock more.

    $FloatScript.PNG

    Although it doesn't use proper buoyancy physics to calculate the rocking motion, it still looks pretty good for most purposes, unless you're building a hardcore naval simulator.

    $FloatTest.gif
     
  16. Julian-S

    Julian-S

    Joined:
    May 31, 2013
    Posts:
    73
    I'm wondering if there is a way to create water bodies on the fly via a script and also modifying the water body's properties via script?
     
  17. Azaroth

    Azaroth

    Joined:
    Oct 17, 2012
    Posts:
    43
    You have being very helpful. No my purpose is simple enough but i was wondering if the ship would rotate correct on a wave bigger than itself.
     
  18. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    774
    Since WC2 really just fakes the rotation, your results might not be physically accurate. You can tweak the Rotation Factor to approximate what it should be, but if you need proper physics, you'll need to write your own script, or adapt a 3rd party solution to work with the WC2 water mesh.
     
  19. darkl4805

    darkl4805

    Joined:
    Jul 28, 2013
    Posts:
    5
    I think what Azaroth was looking for was the ability to duplicate the screenshot posted on page 3 (and inserted below). The settings posted are helpful but they don't get us all the way there. I'd really like to create waves identical to the image. Any additional information such as shader, lighting, texture, maps, etc would be very helpful! I'm assuming everything needed to replicate the image is in the Waves2 package.

    Really looking forward to the response and think it's a great product so far!

    $Screenshot 7.png
     
  20. Azaroth

    Azaroth

    Joined:
    Oct 17, 2012
    Posts:
    43

    Yes, i totaly agree, the colors here are much more realistic and the foam looks different in every spot and better quality, not like a pattern.
     
    Last edited: Feb 5, 2014
  21. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    774
    You've got me there. I was able to get similar wave geometry in the sample I posted, but the detailed SSS effects and 3d textured foam have eluded me so far. One thing to note is that the screen shot was from a pre-release version, and may not be using the same textures and shaders that finally shipped. This may have been necessary if they were from a 3rd party, and the developer didn't have the rights to use them. I'd be delighted if Spokko would chime in and tell me I'm wrong on this though, because the screen shot really is gorgeous, and I'd love to have water like that too.
     
  22. creat327

    creat327

    Joined:
    Mar 19, 2009
    Posts:
    1,756
    yep, i've been tryingn to get it to look like that for a while and it seems impossible, no idea how you were able to generate it but a demo project would be nice
     
  23. SP0KK0

    SP0KK0

    Joined:
    Aug 18, 2012
    Posts:
    103
    Hey there

    I can see where you guys are coming from, the screenshot I posted back then does look very nice. Surprisingly the waves in that screenshot were using a very simple shader, the scene had no lighting, reflection or normal maps. It was simply using a wave displacement shader. The reason why you guys can't replicate this screenshot is because the texture used is not included in the package. You can download this texture here. Hopefully you should be able to create a very similiar effect now. The waves in WC2 look slightly different to the waves in that picture but it shouldn't be too noticable.

    Thanks
     
    Last edited: Feb 5, 2014
  24. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    774
    Done, and thank you very much. In the sample below, I used only the new diffuse map, and dialed the WC2 settings for Lighting, Reflections, and Foam down to near zero:

    $Water05Test.png

    Looks pretty close now. :)

    Edit: a bit of Lighting, Transparency and Reflection looks good with this too, as long as you don't overdo them.

    $Water05Test2.png
     
    Last edited: Feb 5, 2014
  25. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    Finally got the example scene built to a device, and the wave texture is extremely pixellated . This is on an iPad Air, using both Mobile and Mobile+ shaders. See screenshot. What am I doing wrong?
     

    Attached Files:

  26. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    774
    I'm surprised nobody has taken a shot at this yet. I have no real idea, since I don't work on mobiles, but have you tried it on a PC/Mac using the standard shader to confirm if it's a mobile shader related issue or something else? Maybe a quality setting?
     
  27. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    I just did a build with the Water Creator+ shader, and it looks the same on iPad Air (though slower, of course).

    This is obviously a showstopper. SP0KK0, do you have any suggestions?
     
  28. SP0KK0

    SP0KK0

    Joined:
    Aug 18, 2012
    Posts:
    103
    This problem is very strange. I have just exported the example scene to my Ipad Air and it worked perfectly. All i can say is make sure the textures are set to Truecolor and that you are using the 'Wave Creator Mobile +' Shader. Other than that change the texture you are using to find whether it's the texture or the Shader at fault.

    Keep me updated. Thanks
     
    Last edited: Feb 7, 2014
  29. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    All textures are set to Truecolor. I deleted and reimported the package, but it's the same. And a totally different texture also pixellates. (Both water and foam textures are pixellated.) I've tried it on both iPad Air and iPad Mini 1. I've fussed with the textures (making sure they were POT, disabling mipmaps, etc.), no improvement. Here's another screenshot, with a 1meter cube in view so you can see how close the camera is to the water. It's not pixellated on your iPad when that close to the water?

    EDIT: I also tried different water mesh resolutions, no difference.
     

    Attached Files:

    Last edited: Feb 7, 2014
  30. SP0KK0

    SP0KK0

    Joined:
    Aug 18, 2012
    Posts:
    103
    Ok, I've looked at the quality on my iPad (Air) and up close the textures do need to be improved. I have posted some screenshots below which I took on my iPad:

    From a distance:
    $pic 1.png

    Up-close:
    $pic 2.png

    In my opinion the screenshot you sent me in your last post looks less pixelated than the screenshot in your first post nevertheless if the quality is still lower than in my screenshots I will thoroughly look into it if you send me your project via a private message. I would love to hear from other people who have used WC with on Mobile on whether it's produced a desired effect for them.

    Thanks
     
    Last edited: Feb 8, 2014
  31. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    I'm uploading my project; will send you a PM with the link. I think the pixellation is less in my 2nd screenshot only because the waves are not quite as close to the camera. I want to use this in game where the camera will be quite close to the water's surface, so the pixellation is a real issue. Thanks!
    Dave
     
  32. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    774
    It seems to me that you'll need to compromise a bit to achieve this on a mobile device. For mobile performance, you want smaller, low-res texture files, and a minimum of video processing, but to get really close to the surface, you're bound to see pixelation unless you have a large hi-res texture and use anti-aliasing, anisotropic filtering, and other video processing to make it less noticeable. You can increase the texture tiling, but it won't look right when viewing from a distance if you do it too much, plus you'll see more noticeable tiling effects. Is there any way to use something like a detail shader here, so you see one texture at a distance, and a finer, more detailed one up close?
     
    Last edited: Feb 9, 2014
  33. Julian-S

    Julian-S

    Joined:
    May 31, 2013
    Posts:
    73
    Hey just reposting this question as it went unnoticed.

    I'm wondering if there is a way to create water bodies on the fly via a script and also modifying the water body's properties via script?

    Thanks!
     
  34. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    But it still pixelated when I increase the texture tiling to. 150 or so--that isn't the problem, and I'm not quite sure what is.
     
  35. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    774
    The pixelation you're seeing definitely isn't screen resolution based, but seems to result from the way the water/foam texture is being processed. It almost looks like digital compression noise. I've tried testing this on a PC, and get no detectable pixelation at all. For comparison, this shot also uses a 1m cube for reference:

    $WC2_Low.png

    As you can see, it may be a bit blurry and indistinct up close, but there's no pixelation. I wonder if anyone using Android or other mobile platforms has similar problems, or if this is unique to the iPad Air or iOS devices?
     
    Last edited: Feb 9, 2014
  36. SP0KK0

    SP0KK0

    Joined:
    Aug 18, 2012
    Posts:
    103
    This a slightly annoying problem, I have been looking into it and I don't think it's WC specific, maybe Unity / Mobile devices reduce the resolution of the textures when being used with complex shaders to reduce lag. I will be researching this for future updates such as a LOD system but for the meanwhile I think we will need to come to a compromise, it is a very advanced Shader to have on Mobile and I had to simplify the shader in development just to get playable frame rates. As you can see in my last post the pixelation is not noticable when looking at it from a distance it's only when you get closer than 1 unit away from the waves where it's noticable. This is unfortuate if, like Gecko, your game is set around the surface of the water and is targeted at mobile devices.

    Sorry for not replying to your first question. Unfortuately you cannot create Water Bodies at runtime, at least not without large amounts of code. You can however easily modify WC's properties through a script. This script is adjusting the water bodies amplitude and deep water colour. All you need to do is assign the 'Water Body' variable in the inspector.

    Code (csharp):
    1.  
    2. //AdjustWaves.cs
    3. using UnityEngine;
    4. using System.Collections;
    5.  
    6. public class AdjustWaves : MonoBehaviour {
    7.  
    8.     public GameObject waterBody;
    9.  
    10.     public Color deepWaterColor = Color.red;
    11.     public float amplitude = 1.0f;
    12.    
    13.     void Update () {
    14.  
    15.         waterBody.renderer.material.SetColor ("_DeepColor", deepWaterColor);
    16.         waterBody.renderer.material.SetFloat ("_Amp", amplitude);
    17.  
    18.         /*
    19.         These are the properties you can access:
    20.         _DeepColor, _ShallowColor, _HeightAdjustment (Shallow to Deep adjuster)
    21.         _SpecColor, _Shininess
    22.         _MainTex, _BumpMap
    23.         _ReflectPow, _Cube
    24.         _FoamColor, _FoamTex, _ShorelineFoamAdjustment, _WaveFoamAdjustment
    25.         _Amp, _Steepness, _Freq, _Velocity, _DirectionType, _Dirx (or move towards x), _Dirz (or move towards z), _WaveFadeout
    26.         _Heightmap
    27.         */
    28.     }
    29. }
    30.  
    Thanks
     
  37. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
    An LOD system would be really great. I don't need it urgently, but it would be very helpful to know if, within a few months, this pixelation issue will be resolved. But I suppose you can't promise until you've actually solved it...
     
  38. gecko

    gecko

    Joined:
    Aug 10, 2006
    Posts:
    2,241
  39. Julian-S

    Julian-S

    Joined:
    May 31, 2013
    Posts:
    73
    Perfect, thank you. The reason I was wondering about creating it at runtime was so that I could try to set up tiling of my own by creating water bodies at the correct time and syncing that water body with the other already running ones.

    Thanks again for the answer, still trying to come up with a solution for infinite water bodies.

    Cheers :)
     
  40. Thengi

    Thengi

    Joined:
    Jan 25, 2014
    Posts:
    2
    I love this Asset, he's very effective ^^.

    But I have somes request... :/
    How can I add an "edge blend" effect, an camera reflection and a surface distortion when I'm underwater ? These effects are used in the Water4 of Unity :s
    Another thing, will you add an effect of ridges on the top of waves?

    Thank you !
     
  41. SP0KK0

    SP0KK0

    Joined:
    Aug 18, 2012
    Posts:
    103
    Hi Thengi

    Edge blend effect will be coming in the next update. The camera reflection and distortion effects are only available on Unity Pro and unfortunately I do not have a copy so I can't implement these effects. Can you give me some more detail on what effect you would like to see at the top of the waves?

    All comments appreciated.
     
  42. Drum

    Drum

    Joined:
    Dec 8, 2010
    Posts:
    29
    Hi,

    I've recently bought this rather good bit of kit. I ran the example scene fine and tweaked things with no trouble. However I am trying to make waves in my own scene, but am running in to trouble trying to use the heightmap to reset the shorelines etc.

    My terrain is created in world composer, which, although it generally works with arrays of heightmap tiles and textures, also has the ability to generate a single heightmap.raw or a JPG texture.

    When I try to use this combined heightmap with wave creator it throws an error. First of all it won't accept the generated raw file as a heightmap. Clicking generate anyway produces an IndexOutOfRangeException in the WaveCreatorHelperFunctions.cs file.

    I guess this is less likely to be a thing in WaveCreator than one in World Composer and I will post this same message in the relevant thread there too.

    cc World Composer
     
  43. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    774
    Don't you need to create a terrain first? The RAW file gets imported into the Unity terrain, and used to shape its physical features. The finished terrain is what Wave Creator uses to create a shoreline, not the RAW file. If you make changes to the Unity terrain, after creating the water body, you can either regenerate the height map in Wave Creator, by hitting the Regenerate Heightmap button, or just delete and recreate the water body, in which case Wave Creator will automatically generate a new shoreline. You shouldn't need the RAW file from World Composer at all for this.
     
    Last edited: May 3, 2014
  44. Drum

    Drum

    Joined:
    Dec 8, 2010
    Posts:
    29
    The terrain is there alright. It's just made up of multiple tiles. What usually happens with multi tile terrains and Wave Creator?
     
  45. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    774
    I'll take a wild guess here and say it probably doesn't support tiled terrains. What you could do, if I read your first post correctly, is create one terrain, covering the entire area, using a single RAW file from World Composer, and use that to generate your shoreline, then delete or hide it, and use the tiled version of your terrains for actual game play. As long as the scale of the single terrain and the tiled terrain match, the shoreline should be reasonably close, even if not as detailed as the tiled version would have allowed. Does this sound possible, or have I misunderstood your first post?
     
    Last edited: May 3, 2014
  46. Drum

    Drum

    Joined:
    Dec 8, 2010
    Posts:
    29
    I will give this a try and let you know the results. Thanks
     
  47. goat

    goat

    Joined:
    Aug 24, 2009
    Posts:
    5,182
    Hey Sp0kk0,

    I bought these water effects:

    https://www.assetstore.unity3d.com/#/content/3906

    and they are very nice but require a mesh for the sea floor and for the water surface. I also must have the island / land as a separate mesh from the ocean floor and the sea surface which is a bit inconvenient. There are also no waves. But I like the looks of some of the sea effects very much.

    Your Wave Creator looks very similar in look to some of his water effects but has the waves which I really like. Would it work with a mesh floor? What about when Unity 5 comes out with mesh terrains?

    Most of my game will take place underwater but some will take place overwater and in a ship. Your package seems to handle this already.

    My main concern is the low end devices I will be publishing too. A cheap ProScan 7" Android 4.2 WVGA tablet with 512MB RAM and a iPod Touch 4th Gen.

    Unity defaults to 2 sq km with a 513 pxl terrain heightmap and all but a small part of mine will be sea. If you try and scale the waves to a reasonable length and height (I'm going from memory when I lived in Florida) I'd expect wave height to be 6 - 9 ft (2 - 3 m) and length 12 - 24 ft (4 - 8 m) and this general size would be repeated over the 2 sq km sea. Can Wave Creator do this on such as the hard ware I listed above?

    Maybe I should shrink to 1 sq km or 1/2 sq km (which is getting pretty small though)?

    Thanks
     
  48. Drum

    Drum

    Joined:
    Dec 8, 2010
    Posts:
    29
    Ok, I've tried this now and the results were no better I'm afraid. No matter what I drop in for the image in the heightmap section doesn't seem to make any noticable difference. I'm stumped at this point...


    Another thing I've noticed is that, when setting the parameters for the waves, I only seem to get any height to them at all if I use a negative number (typically around -0.1 to -0.2). Using a positive number, no matter how big, produces nothing but millpond flatness.

    The other parameters steepness, frequency etc seem to act as you'd expect once I've used a negative wave height. Maybe the two are connected?
     
  49. FargleBargle

    FargleBargle

    Joined:
    Oct 15, 2011
    Posts:
    774
    All I can suggest at this point is to go back to basics. Make sure the demo scene works properly. Then try making a simple terrain in Unity, without any plugins, and drop in a new water object using the default settings. You should get a shoreline automatically when you create the water. No need to touch the heightmap settings. You might need to tweak the foam values to really see it, but it should be there. If that doesn't work, you might want to try deleting and reinstalling Wave Creator to be sure it hasn't been corrupted. If you can get it to work properly in these cases, you should be able to pinpoint where the process starts to break down when using World Composer.

    Also, what version of Wave Creator and Unity are you using? I'm running 4.3.4 at the moment, and the latest Wave Creator seems to work fine with it.

    As for the wave height issue, I haven't seen that problem at all. If you look back on page 7 of this thread, I've posted some screen caps that show lots of wave height, and the settings I used worked pretty much as expected.

    Sorry I don't have anything better to suggest. If you still have problems, you may need to contact SP0KK0. Good luck.
     
    Last edited: May 4, 2014
  50. SP0KK0

    SP0KK0

    Joined:
    Aug 18, 2012
    Posts:
    103
    Hi Drum.

    Sorry about this problem you have been having. Unfortunately Wave Creator does not support tiled terrain at the moment. However you should be able to get this working using the approach FargleBargle suggested. If you can create one png or jpeg texture of the whole terrain (You wont be able to input a RAW Image into Wave Creator) then it should work fine. If World Composer creates a grayscale image of the terrain you may need to check the 'Alpha From Grayscale' check box in the import settings of that texture. All Wave Creator does is looks at each pixel of this texture and uses the alpha value of that pixel to know how much foam / transparency to apply to that patch of water. If you can create a grayscale image in png or jpeg of your whole terrain it should work fine. You won't be able to click the Regenerate Heightmap button once you have done this though otherwise it will produce an error. I hope this helps you, if not don't hesitate to get back to me.

    Hi Goat

    Thanks for the interest in Wave Creator. Wave Creator works with a mesh floor and I will be updating it accordingly when Mesh Terrains comes out. Although I cannot be certain about the performance figures it should work ok on these low end devices without making the Water Body too small. You will have to use a low resolution water plane and the mobile shader though so you will not be able to have specular reflections on the low end devices.

    Thanks