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

[RELEASE] Calm Water

Discussion in 'Assets and Asset Store' started by Phantom_X, Jan 22, 2016.

  1. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    212


    Calm water is a simple water shader designed to offer great customization options for an amazing look without having too many features.

    DX11
    Now includes a DX11 version with edge length based tessellation!

    Color
    You can control the depth color and shallow color individually and select the depth level.

    Distortion
    Great distortion effect based on the animated normal map with two quality settings to better fit your needs.

    Reflections
    Distorted reflections with 3 modes. (CubeMap,RealTime,Mixed)

    Foam
    Customizable dynamic foam.

    Displacement
    New displacement animation based on Gerstner wave.

    Inspector
    Beautiful custom inspector for a better user experience.

    Web Demo
    http://yvgrafix.com/CalmWaterDemo/

    Asset Store Link
    https://www.assetstore.unity3d.com/en/#!/content/50834








    1.5
    • DX11 Tessellation Support
    • New Displacement animation based on Gerstner waves
    1.5.1
    • Fixed errors on import
    • Add missing objects in demo scenes
    • Fixed protection level on UnderWaterFog Class.
    1.5.2
    • Fixed normal maps animation on mobile -
    • Show Reflection slider if using only cubemap reflection
    • Foam affected by light
    • Lower Price !
    1.5.3
    • Include a script to create a custom water plane the size and resolution you want
    • Optimize performance of High quality distortion
    • Fix error on import if you had already imported Global Fog image effect
    1.5.4
    • Fix mirror reflection script locking selection in unity 5.3.3 and up. ( you won't be able to preview realtime reflection while not in play mode for now )
    1.5.5
    • Complete rewrite to vertex/frag language
    • Sine Wave displacement method
    • Better reaction to lighting and ambient. Especially in dark lighting setup.
    1.5.6
    • Caustic projector now uses a Triplanar system to work better on vertical shapes.
    • Changes to depth texture sampler precision.
    • Distortion optimization.
    1.5.7
    • PS4 Support.
    • Passes unification.
    • Better lighting effect.
     
    Last edited: Oct 30, 2018
  2. Korok

    Korok

    Joined:
    Dec 19, 2011
    Posts:
    179
    Love the color its really nice sir
     
  3. TheSeawolf

    TheSeawolf

    Joined:
    Apr 10, 2015
    Posts:
    267
    Excellent, you've got your own forum now. I haven't gotten around to adding the underwater fog yet.

    Is the update to 1.5, the DX11 and tessellation update?
     
  4. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    212
    yes it is, also includes the underwater fog which I plan to improve in a future update.
     
  5. Vontarga

    Vontarga

    Joined:
    Oct 14, 2014
    Posts:
    99
    Hi,

    This looks very nice. Are there any alpha issues? I have found some otherwise nice waters do not play well with items like trees - making them distort when the water is behind them.

    Thank you.
     
    Last edited: Jan 29, 2016
  6. Vontarga

    Vontarga

    Joined:
    Oct 14, 2014
    Posts:
    99
    OK. The reviews are so excellent I took a chance and bought this. I have spent hundreds of dollars on water systems that for some reason or don't work or cause too many errors, so what's another $25. ;)

    Question: I had one error on importing...

    Assets/Calm Water/Scripts/ImageEffect/FogControl.cs(12,17): error CS0122: `UnderWaterFog' is inaccessible due to its protection level

    I deleted the FogControl script. Is there a way to correct this problem?

    Thank you. :)
     
  7. Vontarga

    Vontarga

    Joined:
    Oct 14, 2014
    Posts:
    99
    Hundred of errors after hitting play. Many of my daytime waters were damaged on import and had to be deleted. Never diud get acceptable effects. Deleting this and back to the drawing board.
     
  8. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    212
    hey,
    I have a quality option on the shader that allows you to set the distortion to affect only what's under the water surface, so it should be better for alpha as well.



    About the errors you are getting, I noticed that the standard assets folder was included in my last update where it should not be. This is causing error for some people and an update is on it's way to fix this.

    I don't get the error you said on my side but I think I know what the problem is and it will be fixed in the next update too.

    In the meantime, try opening the UnderWaterFog.cs file and change line
    Code (CSharp):
    1. class UnderWaterFog:MonoBehaviour
    to this:

    Code (CSharp):
    1. public class UnderWaterFog:MonoBehaviour
    Thanks
     
    Last edited: Jan 30, 2016
  9. SeriousTangents

    SeriousTangents

    Joined:
    Nov 1, 2013
    Posts:
    11
    This looks like a great effect, but I'm curious to see how it appears on an Android device. I've tried a couple of different water/shader solutions and I tend to get unexpected pixelization issues after it has been in scene for several minutes. Would you mind sharing a few screenshots from a scene playing on an Android-based system over the span of 5-10 minutes?

    Joseph.
     
  10. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    212
    Hey,
    I didn't really target mobile devices with this shader so I did not make any tests that way until now and I found out that it's running not too bad at the moment, 38fps on my nexus 5 1st gen, but I noticed some issues with the distortion. I will try to get it fixed for next version.

    Anyhow, here is a screenshot from slightly modified current version on Nexus 5 after 10 min


    of course features like DX11 doesn't work on android, but everything else does.

    I'll keep you posted when I fix distortion.

    Thanks!
     
  11. KeaGen

    KeaGen

    Joined:
    Feb 12, 2016
    Posts:
    4
    Definitly! Love those!
     
  12. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    212
    Ok so I played a bit with it a little today and I got it working pretty well on my nexus 5, here's how it's looking now



    So I will probably send an update for review later today after I make sure it still works good on PC.
     
    Korok and mimminito like this.
  13. SeriousTangents

    SeriousTangents

    Joined:
    Nov 1, 2013
    Posts:
    11
    This looks great. A pity android does not allow video captures easily to see it in motion. Have you ever tested this with a day/night package?

    Either way, it will work well for my relaxation app. Will be picking this up this weekend.

    Joseph.
     
  14. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    212
    Here's a screenshot with a more night like setup with 3 point lights



    Quick heads up, the price is going down on next update so you might want to wait until then! ;)
     
  15. Serreas

    Serreas

    Joined:
    Jun 1, 2013
    Posts:
    20
    I just purchased your asset and it looks really cool! But I was wondering if you could tell me how I could make a much larger plane mesh (for large terrains for example) that would work with the calm water shader? I messed around a bit in blender a bit trying to make a plane and exporting it as an fbx but haven't had much luck. Maybe you could give me a few pointers on how I could go about doing this? Again great asset!
     
  16. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    212
    Hi,
    thanks for your purchase!
    Unfortunately I know only 3DsMax, however you can use this editor script to generate a plane the resolution you want:
    http://wiki.unity3d.com/index.php?title=CreatePlane

    I will probably include this script in my next update ;)
     
  17. Serreas

    Serreas

    Joined:
    Jun 1, 2013
    Posts:
    20
    Awesome thanks so much! That is so much easier using that script then messing around with blender.
     
  18. bodden

    bodden

    Joined:
    Mar 20, 2013
    Posts:
    3
    Bought your asset yesterday. First impression is great.

    I'm trying to create a island screne with dynamic day/night cycle, using TimeOfDay. Water/reflections seems to be a bit dark in some situations, but, yeah, I have to play around with the material-parameters of calmWater, mybe I can improve this.

    Got errors
    NullReferenceException: Object reference not set to an instance of an object
    FogControl.init () (at Assets/Calm Water/Scripts/ImageEffect/FogControl.cs:53)
    FogControl.OnEnable () (at Assets/Calm Water/Scripts/ImageEffect/FogControl.cs:16)

    Seemed script UnderWaterFog.cs is missing. As I imported CalmWater into a non-empty-scene, I tried figuring out, what's wrong. In my case, there was no file "UnderwaterFog.cs" in StandardAssets but I found the class "UnderWaterFog" inside a file called "GlobalFog.cs". Renamed the file to "UnderWaterFog.cs", now everything works fine.
     
  19. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    212
    Hi, Thanks for your feedback!
    I managed to reproduce the error you are talking about, when you import Calm Water into a project where standard image effects are already there unity thinks that globalFog.cs and UnderWaterFog.cs are the same file and tries to merge them. I found a way to fix this and it'll be included in next update.

    I also look into the darkness at night, this is what I get with these settings:


    you think that it should be brighter than this? I mean if you look at real photos, the water does get pretty dark at night.



    But I will look further into that!

    Thanks!
     
  20. bodden

    bodden

    Joined:
    Mar 20, 2013
    Posts:
    3
    Hi YanVerde,
    thanks for your quick reply. Yes, you are right, the CalmWater works fine, also in low light maps. I got dark refelections even in bright environments. But this was defently not caused by CalmWater. I imported it in a clean empty new scene, and had no problems with this any more.

    But now I've got another problem: I used the script you mentioned above to create a 2000x2000 plane for water. On shoreline I got these weired lines. They appear when using your material Island-DX11 as well as Pond-DX11. It doesn't matter if I turn Foam or Displacement on or off

    upload_2016-2-21_21-39-31.png

    They don't appear when using your default water plane or when using another material/shader of your package.

    Do you have any idea, how to avoid this?
     
  21. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    212
    Humm to me it looks like some depth buffer precision issue due to a large scene, but I did not manage to reproduce the problem on my side even with a 4000x4000 plane.



    I have redone how the depth calculation is done in the shader, I will send you an update in private to see if it helps
     
  22. EwieElektro

    EwieElektro

    Joined:
    Feb 22, 2016
    Posts:
    12
    Hi!
    It is suitable for 2.5D water cubes (2.5D tile based game)?
     
  23. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    212
    Hey,
    I don't thinks this would be the best, depending on the look you want. I think you would rather need something like this shader I made a while ago.

     
  24. bodden

    bodden

    Joined:
    Mar 20, 2013
    Posts:
    3
    It took me a while, but in the end it was simple. On my water plane I forgot to switch off "cast shadows". Now it works fine, even with a 2000x2000 plane.

    I still have to do some tweaking, but I'm really happy so far. Rated it 5/5 in asset store. Again, thanks for your response.

    upload_2016-2-22_22-55-15.png
     
  25. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    212
    ho I see!
    well, glad you like it!
     
  26. TheSeawolf

    TheSeawolf

    Joined:
    Apr 10, 2015
    Posts:
    267
    Hey YanVerde, for some reason I cannot update your asset to 1.52. Actually, when I try to re download it, I can only do version 1..0 which shows up in the asset panel. Any ideas, I think I have 5.2.3 installed.
     
  27. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    212
    Hey,
    Could it be because I submitted version 1.0 with 5.2.3 and other versions were submitted using version 5.3 and up?
    I didn't know you could not download it with an earlier version of unity. I will resubmit using a lower version then, in the meantime you can update your unity version I guess.

    Thanks for the feedback!
     
  28. TheSeawolf

    TheSeawolf

    Joined:
    Apr 10, 2015
    Posts:
    267
    That makes sense, I'll look at updating to 5.3. Cheers for the reply.
     
  29. Brity

    Brity

    Joined:
    Feb 27, 2016
    Posts:
    116
    Hello YanVerde,

    I've found a little bug.
    Stand Unity terrain is not selectable in scene whilst Mirror Reflection script is enabled on water.
    Only happens in Unity 5.3.3 and 5.3.3p1

    Kind Regards
    Brity
     
  30. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    212

    Hi,
    Long story short, I think this is a bug on unity's side, but they updated their water reflection script to work around that as well. So that makes me wonder if this is a known issue and that they won't fix it.

    I still updated my script to match unity's behavior, but that means it won't be possible anymore to have realtime reflections in scene view when not in play mode anymore.

    I will try to submit a bug report and see what they tell me.
    Here's the updated script for now.

    Code (CSharp):
    1. using System;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. [ExecuteInEditMode]
    6. [RequireComponent(typeof(MeshRenderer))]
    7. public class MirrorReflection : MonoBehaviour
    8. {
    9.  
    10.     //private RenderTexture rt;
    11.     public LayerMask reflectionMask = -1;
    12.     [Tooltip("Color used instead of skybox if you choose to not render it.")]
    13.     public Color clearColor = Color.grey;
    14.     public bool reflectSkybox = true;
    15.     public bool m_DisablePixelLights = false;
    16.     [Tooltip("You won't be able to select objects in the scene when thi is active.")]
    17.     public bool UpdateSceneView = false;
    18.     public float clipPlaneOffset = 0.07F;
    19.  
    20.  
    21.     private String reflectionSampler = "_ReflectionTex";
    22.  
    23.  
    24.  
    25.     Vector3 m_Oldpos;
    26.     Camera m_ReflectionCamera;
    27.     Material m_SharedMaterial;
    28.     Dictionary<Camera, bool> m_HelperCameras;
    29.  
    30.  
    31.     void OnEnable(){
    32.         setMaterial();
    33.     }
    34.  
    35.     void Start(){
    36.         setMaterial ();
    37.     }
    38.  
    39.     public void setMaterial(){
    40.         m_SharedMaterial = GetComponent<Renderer>().sharedMaterial;
    41.     }
    42.  
    43.  
    44.     Camera CreateReflectionCameraFor(Camera cam)
    45.     {
    46.         String reflName = gameObject.name + "Reflection" + cam.name;
    47.         GameObject go = GameObject.Find(reflName);
    48.  
    49.         if (!go)
    50.         {
    51.             go = new GameObject(reflName, typeof(Camera));
    52.             go.hideFlags = HideFlags.HideAndDontSave;
    53.         }
    54.         if (!go.GetComponent(typeof(Camera)))
    55.         {
    56.             go.AddComponent(typeof(Camera));
    57.         }
    58.         Camera reflectCamera = go.GetComponent<Camera>();
    59.  
    60.         reflectCamera.backgroundColor = clearColor;
    61.         reflectCamera.clearFlags = reflectSkybox ? CameraClearFlags.Skybox : CameraClearFlags.SolidColor;
    62.  
    63.         SetStandardCameraParameter(reflectCamera, reflectionMask);
    64.  
    65.         if (!reflectCamera.targetTexture)
    66.         {
    67.             reflectCamera.targetTexture = CreateTextureFor(cam);
    68.         }
    69.  
    70.         return reflectCamera;
    71.     }
    72.  
    73.     void SetStandardCameraParameter(Camera cam, LayerMask mask)
    74.     {
    75.         cam.cullingMask = mask & ~(1 << LayerMask.NameToLayer("Water"));
    76.         cam.backgroundColor = Color.black;
    77.         cam.enabled = false;
    78.     }
    79.  
    80.  
    81.     RenderTexture CreateTextureFor(Camera cam)
    82.     {
    83.         RenderTexture rt = new RenderTexture(Mathf.FloorToInt(cam.pixelWidth * 0.5F),
    84.             Mathf.FloorToInt(cam.pixelHeight * 0.5F), 24);
    85.         rt.hideFlags = HideFlags.DontSave;
    86.         return rt;
    87.     }
    88.  
    89.  
    90.     public void RenderHelpCameras(Camera currentCam)
    91.     {
    92.         if (null == m_HelperCameras)
    93.         {
    94.             m_HelperCameras = new Dictionary<Camera, bool>();
    95.         }
    96.  
    97.         if (!m_HelperCameras.ContainsKey(currentCam))
    98.         {
    99.             m_HelperCameras.Add(currentCam, false);
    100.         }
    101.  
    102.         if (m_HelperCameras[currentCam] && !UpdateSceneView)
    103.         {
    104.             return;
    105.         }
    106.  
    107.         if (!m_ReflectionCamera)
    108.         {
    109.             m_ReflectionCamera = CreateReflectionCameraFor(currentCam);
    110.         }
    111.  
    112.         RenderReflectionFor(currentCam, m_ReflectionCamera);
    113.  
    114.         m_HelperCameras[currentCam] = true;
    115.     }
    116.  
    117.  
    118.     public void LateUpdate()
    119.     {
    120.         if (null != m_HelperCameras)
    121.         {
    122.             m_HelperCameras.Clear();
    123.         }
    124.     }
    125.  
    126.  
    127.     public void WaterTileBeingRendered(Transform tr, Camera currentCam)
    128.     {
    129.         RenderHelpCameras(currentCam);
    130.  
    131.         if (m_ReflectionCamera && m_SharedMaterial)
    132.         {
    133.             m_SharedMaterial.SetTexture(reflectionSampler, m_ReflectionCamera.targetTexture);
    134.         }
    135.     }
    136.  
    137.  
    138.     public void OnWillRenderObject()
    139.     {
    140.         WaterTileBeingRendered(transform, Camera.current);
    141.  
    142.     }
    143.  
    144.  
    145.     void RenderReflectionFor(Camera cam, Camera reflectCamera)
    146.     {
    147.         if (!reflectCamera)
    148.         {
    149.             return;
    150.         }
    151.  
    152.         if (m_SharedMaterial && !m_SharedMaterial.HasProperty(reflectionSampler))
    153.         {
    154.             return;
    155.         }
    156.  
    157.         // Optionally disable pixel lights for reflection
    158.         int oldPixelLightCount = QualitySettings.pixelLightCount;
    159.         if (m_DisablePixelLights)
    160.         {
    161.             QualitySettings.pixelLightCount = 0;
    162.         }
    163.  
    164.         //reflectCamera.cullingMask = reflectionMask & ~(1 << LayerMask.NameToLayer("Water"));
    165.         reflectCamera.cullingMask = ~(1<<4) & reflectionMask.value; // never render water layer
    166.  
    167.         SaneCameraSettings(reflectCamera);
    168.  
    169.         reflectCamera.backgroundColor = clearColor;
    170.         reflectCamera.clearFlags = reflectSkybox ? CameraClearFlags.Skybox : CameraClearFlags.SolidColor;
    171.         if (reflectSkybox)
    172.         {
    173.             if (cam.gameObject.GetComponent(typeof(Skybox)))
    174.             {
    175.                 Skybox sb = (Skybox)reflectCamera.gameObject.GetComponent(typeof(Skybox));
    176.                 if (!sb)
    177.                 {
    178.                     sb = (Skybox)reflectCamera.gameObject.AddComponent(typeof(Skybox));
    179.                 }
    180.                 sb.material = ((Skybox)cam.GetComponent(typeof(Skybox))).material;
    181.             }
    182.         }
    183.  
    184.         GL.invertCulling = true;
    185.  
    186.         Transform reflectiveSurface = transform; //waterHeight;
    187.  
    188.         Vector3 eulerA = cam.transform.eulerAngles;
    189.  
    190.         reflectCamera.transform.eulerAngles = new Vector3(-eulerA.x, eulerA.y, eulerA.z);
    191.         reflectCamera.transform.position = cam.transform.position;
    192.  
    193.         Vector3 pos = reflectiveSurface.transform.position;
    194.         pos.y = reflectiveSurface.position.y;
    195.         Vector3 normal = reflectiveSurface.transform.up;
    196.         float d = -Vector3.Dot(normal, pos) - clipPlaneOffset;
    197.         Vector4 reflectionPlane = new Vector4(normal.x, normal.y, normal.z, d);
    198.  
    199.         Matrix4x4 reflection = Matrix4x4.zero;
    200.         reflection = CalculateReflectionMatrix(reflection, reflectionPlane);
    201.         m_Oldpos = cam.transform.position;
    202.         Vector3 newpos = reflection.MultiplyPoint(m_Oldpos);
    203.  
    204.         reflectCamera.worldToCameraMatrix = cam.worldToCameraMatrix * reflection;
    205.  
    206.         Vector4 clipPlane = CameraSpacePlane(reflectCamera, pos, normal, 1.0f);
    207.  
    208.         Matrix4x4 projection = cam.projectionMatrix;
    209.         projection = CalculateObliqueMatrix(projection, clipPlane);
    210.         reflectCamera.projectionMatrix = projection;
    211.  
    212.         reflectCamera.transform.position = newpos;
    213.         Vector3 euler = cam.transform.eulerAngles;
    214.         reflectCamera.transform.eulerAngles = new Vector3(-euler.x, euler.y, euler.z);
    215.  
    216.         reflectCamera.Render();
    217.  
    218.         GL.invertCulling = false;
    219.  
    220.         // Restore pixel light count
    221.         if (m_DisablePixelLights)
    222.         {
    223.             QualitySettings.pixelLightCount = oldPixelLightCount;
    224.         }
    225.     }
    226.  
    227.  
    228.     void SaneCameraSettings(Camera helperCam)
    229.     {
    230.         helperCam.depthTextureMode     = DepthTextureMode.None;
    231.         helperCam.backgroundColor     = Color.black;
    232.         helperCam.clearFlags         = CameraClearFlags.SolidColor;
    233.         helperCam.renderingPath     = RenderingPath.Forward;
    234.     }
    235.  
    236.  
    237.     static Matrix4x4 CalculateObliqueMatrix(Matrix4x4 projection, Vector4 clipPlane)
    238.     {
    239.         Vector4 q = projection.inverse * new Vector4(
    240.             Sgn(clipPlane.x),
    241.             Sgn(clipPlane.y),
    242.             1.0F,
    243.             1.0F
    244.         );
    245.         Vector4 c = clipPlane * (2.0F / (Vector4.Dot(clipPlane, q)));
    246.         // third row = clip plane - fourth row
    247.         projection[2] = c.x - projection[3];
    248.         projection[6] = c.y - projection[7];
    249.         projection[10] = c.z - projection[11];
    250.         projection[14] = c.w - projection[15];
    251.  
    252.         return projection;
    253.     }
    254.  
    255.  
    256.     static Matrix4x4 CalculateReflectionMatrix(Matrix4x4 reflectionMat, Vector4 plane)
    257.     {
    258.         reflectionMat.m00 = (1.0F - 2.0F * plane[0] * plane[0]);
    259.         reflectionMat.m01 = (- 2.0F * plane[0] * plane[1]);
    260.         reflectionMat.m02 = (- 2.0F * plane[0] * plane[2]);
    261.         reflectionMat.m03 = (- 2.0F * plane[3] * plane[0]);
    262.  
    263.         reflectionMat.m10 = (- 2.0F * plane[1] * plane[0]);
    264.         reflectionMat.m11 = (1.0F - 2.0F * plane[1] * plane[1]);
    265.         reflectionMat.m12 = (- 2.0F * plane[1] * plane[2]);
    266.         reflectionMat.m13 = (- 2.0F * plane[3] * plane[1]);
    267.  
    268.         reflectionMat.m20 = (- 2.0F * plane[2] * plane[0]);
    269.         reflectionMat.m21 = (- 2.0F * plane[2] * plane[1]);
    270.         reflectionMat.m22 = (1.0F - 2.0F * plane[2] * plane[2]);
    271.         reflectionMat.m23 = (- 2.0F * plane[3] * plane[2]);
    272.  
    273.         reflectionMat.m30 = 0.0F;
    274.         reflectionMat.m31 = 0.0F;
    275.         reflectionMat.m32 = 0.0F;
    276.         reflectionMat.m33 = 1.0F;
    277.  
    278.         return reflectionMat;
    279.     }
    280.  
    281.  
    282.     static float Sgn(float a)
    283.     {
    284.         if (a > 0.0F)
    285.         {
    286.             return 1.0F;
    287.         }
    288.         if (a < 0.0F)
    289.         {
    290.             return -1.0F;
    291.         }
    292.         return 0.0F;
    293.     }
    294.  
    295.  
    296.     Vector4 CameraSpacePlane(Camera cam, Vector3 pos, Vector3 normal, float sideSign)
    297.     {
    298.         Vector3 offsetPos = pos + normal * clipPlaneOffset;
    299.         Matrix4x4 m = cam.worldToCameraMatrix;
    300.         Vector3 cpos = m.MultiplyPoint(offsetPos);
    301.         Vector3 cnormal = m.MultiplyVector(normal).normalized * sideSign;
    302.  
    303.         return new Vector4(cnormal.x, cnormal.y, cnormal.z, -Vector3.Dot(cpos, cnormal));
    304.     }
    305. }
    306.  
    Thanks!
     
  31. lastlevel

    lastlevel

    Joined:
    Mar 26, 2013
    Posts:
    6
    Hey @YanVerde

    Potentially stupid question. Just wondering how this plugin goes with Orthographics cameras? Not a rendering/shader guy and was wondering if there was an easy way to get the same result in ortho mode as in perspective? Thanks!
     
  32. Korok

    Korok

    Joined:
    Dec 19, 2011
    Posts:
    179
    Beautiful! Can you make the water splash (particle or whatever) when a character walk/run in it? it's the only thing left I need XD
     
  33. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    212
    Hey,
    Unfortunately this won't work in ortho at the moment, not sure if it is possible, will have a look!

    Thanks
     
  34. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    212
    Hi,
    I have more urgent things to do for it at the moment. This doesn't mean I will never do some, but at the moment I won't no.

    Thanks!
     
  35. Brity

    Brity

    Joined:
    Feb 27, 2016
    Posts:
    116
    Hello, I'm having a problem.
    I deleted calmwater from my project and then imported the updated version.
    Now I keep getting error with InControl asset..
    Assets/ADDONS/Physics Platformer Kit/Scripts/PlayerMove.cs(297,37): error CS0117: `InputManager' does not contain a definition for `Devices'

    I have no idea why this asset is causing problems with that one.
    Any ideas?
     
  36. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    212
    Do you have any other errors? maybe one of it's class has the same name as one of mine? I do have an InputManager.cs in the demo scene, try deleting this file. My demo scenes won't work properly, but it might fix your problem.
     
  37. Brity

    Brity

    Joined:
    Feb 27, 2016
    Posts:
    116
    Are you serious... you named your class InputManager.. Are you stoned?
    oh dear.. I lost an hour for this..
     
  38. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    212
    I guess we could say the same from Physics Platformer Kit who also name it that way apparently, but I will change that for next version of course
     
  39. Brity

    Brity

    Joined:
    Feb 27, 2016
    Posts:
    116
    no it wasn't Physics Platformer Kit, it was conflicting with InControl which is an asset that specializes in Input controls so you would expect them to call it that, because you wouldn't have two input control systems in your project. Yours isn't....
     
  40. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    212
    Alright my bad, it will be changed.
     
  41. Brity

    Brity

    Joined:
    Feb 27, 2016
    Posts:
    116
    also your folder structure is wrong. If I don't import the demo section I will end up with missing materials ect. So I have to spend time checking through everything..
     
  42. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    212
    Ho you mean the prefabs? yeah that's right will change that too thanks
     
  43. Brity

    Brity

    Joined:
    Feb 27, 2016
    Posts:
    116
    ok.. I had to delete it from my project. I couldn't select anything in scene view. I know this happened before the update because of the reflection script.. But this time it doesn't matter if you have the prefab in scene or not. by having it in the project is problematic.

    I'll just copy and paste an old version from an old project until theres a fix.
    I'm using Unity 5.3.3p2
     
  44. Brity

    Brity

    Joined:
    Feb 27, 2016
    Posts:
    116
    ok now it seems the old version is doing the same thing. I cant select anything in the scene.

    I think it's best to delete CalmWater and import Unity water.. This way I might actually get some work done.
     
  45. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    212
    I tried latest version on 5.3.3p2, at first you can't select object because the update for mirrorReflections isn't live yet, but if I use the one posted earlier I have no problem selecting objects on my side. Do you have the same problem in an empty project?
     
  46. Brity

    Brity

    Joined:
    Feb 27, 2016
    Posts:
    116
    ok well I imported the new version and disabled mirrorReflections.. I will enable it when level starts. it should be fine for now.


    Thanks for your speedy ninja response :)
     
  47. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    212
    Upcoming in the next version, much better reaction to dark lighting and support for ambient light!

     
  48. DoubleBit

    DoubleBit

    Joined:
    Mar 16, 2016
    Posts:
    6
    I have been using your water a while and really like it a lot. Great work.

    I was wondering though, is there any way to tweak the shaders, to get the shallow, depth and foam color to have emissive setting. i work with a lot on fantasy and night time settings, if the water could have emissive and become glowing that would be just awesome.
     
  49. Phantom_X

    Phantom_X

    Joined:
    Jul 11, 2013
    Posts:
    212
    Hey!
    The water grabs a screenshot of what's behind it to make it's color. That means that if the object that is under the water is emissive, the water will also look emissive. So the easiest way to do this would actually be to have a custom terrain shader that can toggle parts of itself to be emissive with a texture mask and a slider to control it.
     
  50. DoubleBit

    DoubleBit

    Joined:
    Mar 16, 2016
    Posts:
    6
    I suppose that could be a workaround, though it won't have real emissive that would react to post effects like bloom and such and it would look out of place. thanks for reply though.