Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Unity 5 - Adding Water to a custom mesh

Discussion in 'General Graphics' started by Avengerxp, Mar 8, 2015.

  1. Avengerxp

    Avengerxp

    Joined:
    Sep 9, 2013
    Posts:
    12
    I have made a pool and a plane for water using 3ds max. Imported to unity, all textures work fine. but I cant get hold of adding water to my custom mesh.

    (Tried googling, tried the Unity documentation)

    I added the advanced water prefab to scene, and tried changing it's mesh to my custom plane, it gives weired results, like placing the water effect vertical.

    I tried adding the shader to my custom plane and attached the water script to it. the reflection and refaction is shown as from the water prefabs point. if I delete the water prefab from the scene my water acts weired.

    can anyone show me the correct steps to apply water to a custom mesh and make it look reflective and also refractive as in the water prefab.
     
  2. Neoku

    Neoku

    Joined:
    Oct 27, 2014
    Posts:
    261
    I recommend delete your water mesh and use the Unity water.
     
  3. Jim-Boddie

    Jim-Boddie

    Joined:
    Apr 12, 2014
    Posts:
    15
    Just about to post a similar question! I've been trying to add the Daytime water material to a mesh to make a river. Here is what almost works.

    1. Select the mesh and drag the water material to it.
    2. Add component for the Water script
    3. Change the layer to Water
    Now, I get a water effect with reflections, refractions and animation but there are some strange transitions when changing viewing angles. The water abruptly turns brown when I view it down stream. The interesting thing is that when I add a Water prefab (of any size) in the direction of the brown view, then the water seems to look correctly. Does the water prefab add some light probe that my mesh water can use when placed just so?

    ***Edit. I guess there is some secret sauce in the prefab so I am going to try to use it instead of a custom mesh.
     
    Last edited: Mar 8, 2015
  4. Avengerxp

    Avengerxp

    Joined:
    Sep 9, 2013
    Posts:
    12
    @ Neoku - I will go with using the water prefab if I could fit a circular prefab inside a rectangular swimming pool. Thanks for the heads up!

    @ Jim Boddie : Didnt change the layer to water. gonna try that. I too feel that the water prefab has a camera or something hidden to catch the reflections etc.

    The strange thing is there is no documentation on adding the realistic already available water to a custom mesh. I think most people don't use water in unity
     
  5. Jim-Boddie

    Jim-Boddie

    Joined:
    Apr 12, 2014
    Posts:
    15
    There is one other technique that may work for you.

    Place a water prefab in your scene. Select it and then in the Mesh Filter, select the mesh from your project that you would like to use.

    **Edit. Oh, I see that you tried this. Did you try to fix the vertical orientation by rotating the transform?
     
    Last edited: Mar 8, 2015
    GamingTopTen likes this.
  6. Avengerxp

    Avengerxp

    Joined:
    Sep 9, 2013
    Posts:
    12
    @ Jim Boddie,

    Yes, what I missed was the layer change for the mesh.

    Add the water material to the custom mesh

    Attach the script to the custom mesh

    Change the Custom mesh layer to water.

    Now I get a good water with reflections & refraction.
     
  7. grivvr

    grivvr

    Joined:
    May 5, 2014
    Posts:
    1
    I had some troubles with this, the same brown reflection scenario. I tried everything listed above (thanks for the Water layer tip). What I hadn't noticed is that my meshes from SketchUp were having to be rotated 90 degrees in Unity. That rotation ruined all the reflections. Fixing the model so it didn't require rotation on import fixed all my issues.