AnAardvark opened this issue on Dec 15, 2009 · 9 posts
AnAardvark posted Tue, 15 December 2009 at 9:16 PM
I want to have a water scene looking up from the bottom of a pool. I've used fresnel-based shaders pretty well for looking down, but what should I use for looking up?
bagginsbill posted Wed, 16 December 2009 at 3:09 PM
When you're underwater, you are in a medium with an IOR of 1.33. To see anything above the water, which is in air with an IOR close to 1, the IOR ratio (what you should enter in the Fresnel node) is .75. The Fresnel node doesn't refract correctly with IOR less than 1, and it doesn't implement total internal reflection, either.
Total internal reflection, TIR, is a phenomenon created when light travels above a certain angle of incidence with respect to a surface where the IOR decreases. See this article for more info:
http://en.wikipedia.org/wiki/Total_internal_reflection
So - we have to build this ourselves. Now the question is - are you really going to be looking up through the surface? Because if you're not, then the entire visible surface will be past the angle where total internal reflection occurs. Basically, then, all you need is a Reflect node to implement a perfect mirror (which is what happens under TIR) and then just set up a good bump pattern on the water surface.
If you are going to look up, so that you can see some of the stuff in the air, then we need to use a more complicated shader. This will require a Refract node and a Reflect node and some more nodes to handle the angle of incidence to determine the mix.
In this render, I used a wide angle camera (focal length = 22 mm) and pointed the camera up so we can see some part of the surface where TIR doesn't happen. Look for trees and sky at the top. Where TIR does not happen and we can see through, it produces a fish-eye effect.
Also, to do this convincingly, you'll want to make your main light generate some caustics. And if you're not in a pool, but open water, you'll want to use Poser's Atmosphere to reduce visibility over great distances underwater.
Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)
Synpainter posted Wed, 16 December 2009 at 3:13 PM
::: watching :::
Miss Nancy posted Wed, 16 December 2009 at 3:26 PM
it's logical to assume that the undersurface would reflect bottom-shadows of objects, but it's too cold now to go swimming and see if it actually does so. I just can't recall if it does that in a swimming pool or shallow shore area. no, wait, what I'm thinking is that the bottom-shadows would be tenuous or distorted due to caustics.
AnAardvark posted Wed, 16 December 2009 at 3:27 PM
I think for the image I'm just beginning on, the mirror approach will work well. I won't need a displacement, since the water prop already has a morphing geometry. However, I would like to know how to handle both cases. I'm going to guess that it will look a bit like your open water shader (which uses both reflect and refraction rather than fresnel so it handles non-clear water.)
When I manage to get my first attempt done, I'll post it.
Isn't specularity also affected underwater?
bagginsbill posted Wed, 16 December 2009 at 3:45 PM
Quote - it's logical to assume that the undersurface would reflect bottom-shadows of objects, but it's too cold now to go swimming and see if it actually does so. I just can't recall if it does that in a swimming pool or shallow shore area. no, wait, what I'm thinking is that the bottom-shadows would be tenuous or distorted due to caustics.
How could it not reflect shadows? It can only reflect the light that hits the bottom. If light fails to hit the bottom (a shadow) then it will fail to reflect light from there.
As to the nature of the shadow, it depends on the lighting. If there is bright sun, the shadow will be just as sharp as it usually is. The penumbra of a shadow is based on the angle subtended by the light source, and the distance between the occluder and the surface receiving the light/shadow.
It's hard to find an example. Check this one - not the bottom, but it is reflections of underwater shadows.
Now if the sun is not involved, and we're talking about artifical lights, or maybe the sky, then the same holds for those - whatever the penumbra is, it remains essentially the same, but for one exception.
Suppose you have a pool indoors, with a huge circular lit ceiling. So the incoming light forms a cone. Because refraction bends descending light more towards vertical, it means that the huge lit ceiling cone becomes compressed into a narrower cone. So the net effect is that the ceiling light appears to subtend a smaller angle than it would in the absence of water. Which means the penumbra shrinks, causing the shadows underwater to be sharper than in air.
Surprising, eh?
Observe this man's shadow.
Very sharp shadow there.
Observe the absence of caustics in his shadow. Caustics don't fundamentally change the shadow. They are a localized effect, bringing additional light from random small areas and concentrating it. Localized meaning the light from a neighborhood of a square inch might get concentrated into 1/4 square inch, making it 4 times brighter. That has no impact on the larger shape of a shadow.
Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)
bagginsbill posted Wed, 16 December 2009 at 5:35 PM
OK I'm not going to bother trying to explain the math. The Fresnel equations are pretty complicated, and I have offered approximations before in a few nodes.
But - the underwater case (or more generally going from higher to lower IOR) where TIR comes into play the math involves complex arithmetic (using the math definition of complex, meaning involving imaginary numbers) and approximating it is incredibly difficult. It's easier for me to just give you the 19 nodes it takes.
I've uploaded UnderWater.zip to my free stuff random shaders area. It contains two Poser materials. One is UnderWater.mt5, and the other is UnderWaterGC.mt5. The GC version is a gamma correcting shader and should be used if you have other GC shaders in the scene. Use the non-GC version in Poser Pro with render GC. The gamma is adjustable in the GC version - the top left node labeled PM:Gamma controls it. It is set to 2.2 by default.
In both, there is a Fractal_Sum node to make waves. If you don't want that - delete or disconnect it from the Bump channel. Of course you can connect whatever you want to the Bump instead - the Fresnel part is unaffected by that. Just leave the other nodes alone.
http://sites.google.com/site/bagginsbill/free-stuff/random-shaders
Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)
Anthanasius posted Wed, 16 December 2009 at 5:58 PM
Miss Nancy posted Wed, 16 December 2009 at 6:49 PM
yeah, in the gettyimages one of the feet in pool, the refl of shadow on undersurface are same as foot shadows.