I am having trouble trying to show water reflections while under the water. Does anyone know how to flip the texture so that while under water you can see the reflections? Any help appreciated.
Why no one have adressed this is beyond me. The problem is still there even with water4!
anyone?
Because it doesnât make any sense. What exactly are you reflecting when youâre under water? Water surface reflection is caused by light rays bouncing off the water. When youâre underwater the light is being reflected away from you so you wouldnât see a reflection anyway.
i see . the same way you can put gravity to -1 (which âmakes no senseâ) the same way i want my water-surface to work underneath.
wrong. if you have been under water at any time in your life you would have seen that reflections is the same if not more visible from below the water-surface than from above.
this image speaks for itself.
http://s2.desktopia.net/wp-content/uploads/walls/thumbs/Underwater-Pool-575x431.jpg
even this one speaks for itself.
http://www.safariegypt.com/egypt_hotels/cairo_hotels/Images/hyatt/p36388p010.jpg
aaaaanywayâŚ
i made a really hacky fix to this problem, but i think this is on unityâs hands not the users.
I âdeclaredâ this (or whatever itâs called iâm not a coder)
_Flip("Flip", Float) = 1.0
then I fixed this spot
// shading for fresnel term
worldNormal.xz *= _FresnelScale;
half refl2Refr = Fresnel(viewVector, worldNormal, FRESNEL_BIAS, FRESNEL_POWER) * _Flip;
it makes the water NOT akwardly bright when viewed from below but refractive/reflective.
I think it has something to do with the way unity calculates the fresnel. When camera angle is below the water surface the fresnel just takes over instead of only taking over when the angles are close, and then go back to nothing when the angles are steep.
Does anyone have a better solution?
Wow. Searching the basement to find a lost post in a locked filing cabinet in a disused lavatory with a sign on it saying âBeware of the Leopardâ.
Andreasng: As this post was SOOOO old, it was probably OK for you to start a new post.
I believe the question is:
âWhen underwater, how can I make the surface look like real water from underneath?â
Some images of the water surface can be found here: under water surface - Google Search ⌠some of which I have posted below:

This is not an easy task, but one, if itâs solved, may be useful to many people.
A challenge to the entrepreneur to get a package together for the Asset Store?
yeah i guess i could just start a new thread - on the other hand itâs newer appreciated to have 10 threads with people wanting the same thing. HAHAHA
Anyway⌠It ISSSSS and easy task. Unity team, and anyone with experience in shading would be able to âflipâ the numbers for the water4 shader in no time.
All I want is the already working reflection and refraction to work both above and below.
If you simply want the reflection for the water plane but from below, you can use two water planes:
This was created in a few minutes by:
- Creating a new stock Unity Terrain and sculpting it into a ring.
- Adding a water plane and positioning it (demo shows both basic and pro water)
- Duplicating the water plane and setting the transform.scale.y on the second plane to -1.0
The underwater fog is a simple script:
using UnityEngine;
using System.Collections;
public class Underwater : MonoBehaviour {
public float waterLevel;
public Transform waterPlane; // Testing
private bool isUnderwater;
private Color normalColor;
private Color underwaterColor;
// Use this for initialization
void Start () {
normalColor = new Color (0.5f, 0.5f, 0.5f, 0.5f);
underwaterColor = new Color (0.22f, 0.65f, 0.77f, 0.5f);
}
// Update is called once per frame
void Update () {
if ((transform.position.y < waterLevel) != isUnderwater) {
isUnderwater = transform.position.y < waterLevel;
if (isUnderwater) SetUnderwater ();
if (!isUnderwater) SetNormal ();
}
}
void SetNormal () {
RenderSettings.fogColor = normalColor;
RenderSettings.fogDensity = 0.01f;
// Testing
waterPlane.localScale = new Vector3 (waterPlane.localScale.x, 1.0f, waterPlane.localScale.z);
}
void SetUnderwater () {
RenderSettings.fogColor = underwaterColor;
RenderSettings.fogDensity = 0.1f;
// Testing
waterPlane.localScale = new Vector3 (waterPlane.localScale.x, -1.0f, waterPlane.localScale.z);
}
}
Out of curiosity I tested flipping a single water plane when under the water level, which worked as well, but Iâm completely unclear if doing this has any value at all⌠I was just curious. You can delete the lines marked âTestingâ
I saw a comment on YouTube re: this threadâŚ
First off, reply to the thread, not the YouTube clip please. YouTube is hosting the clip, but YouTube is not part of the Unity Forum.
Please check your code, and donât forget to fill in all of the public data in the inspector. If the water plane is not triggering your fog, then most likely you have forgotten to set your water level value in the inspector.
Do you attach this to the water? @Adam-Buckner_1
If you look at the âUpdateâ, this script needs to be attached to something thatâs related the the camera/player. When the âtransform.positionâ of the GameObject with the script on it is âless thanâ the âwater levelâ then the script changes the fog level, etcâŚ
Be aware that this is a very very simple script and will proably need to be made more complex to actaully work properly in a game project. This script simply illustrates the idea and is a proof of concept.
Thanks!
Does anyone have a fix for the flipped water plane in Unity 5?
I tried Adamâs method and several other methods for flipping the duplicate plane, but it never shows from below.
Which water system are you using? There are several to choose from now, in Standard Assets. Some of the more advanced ones may not allow flipping as they are far more complicated and include things like mesh deformation.
The Unity âProâ water should allow flipping, but the two water planes my affect the otherâs rendering. What you may want to try is the above script with the active flip. I have successfully done this flip technique (just now) using WaterProDaytime and WaterProNightime prefabs from Standard Assets. I believe that the "Water4 samples will not flip successfully.
Thank you Adam, I was using the âWater 4 Simpleâ, so that must have been the problem.
Thanks to your tip, I was able to get the Pro water looking great from underneath!
It wasnât quite the look I wanted on top of the water though (water 4 looks much more like an ocean), so I used the pro water from beneath, and the water 4 on top of that (right side up), and it works beautifully!
Yay! Great!
Now, if you really want a challenge,mouth can sort thru this thread:
There are many gems and lots of tidbits to be found, but itâs also a deep excavation into ancient temples of water shader wisdom.
Iâm sorry, but Iâm new to unity⌠and i really didnât understand that⌠could you plase run me through the steps of adding the script ( what do i add it too??)
cheers, frennle
You should probably get a little more familiar with unity before trying these intermediate tricks. Try going to the learn tab and doing several of the tutorial projects.
This script checks the transform position of the GameObject it is attached to to do the flipping. Be aware that this script is proof of concept only and will require further work to be production ready.
ok, thanks ![]()