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.
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) Code (csharp): _Flip("Flip", Float) = 1.0 then I fixed this spot Code (csharp): // 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: http://tinyurl.com/84djjbo ... 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: Code (csharp): 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.
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.
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: http://forum.unity3d.com/threads/wanted-ocean-shader.16540/ 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.