Greetings,
i’ve been really really really busy trying to make my own “Rainshader” or simply put,
a normal-mapped-specular shader, which also has the ability to use depthmaps and some script assigned values to determine where it should display an effect that ends up like rain.
And i’m really far, but there’s one obstacle that’s been punching my face the past two afternoons.
I used the well-known MirrorReflection script (http://wiki.unity3d.com/index.php?title=MirrorReflection2) and shader parts and added them into the shader for achieving the reflections cast on the water surfaces, but I want to apply a fresnel effect to these, too.
I’ve used the basis of the rim-shader, as i thought the effect that causes the rim would be the same as a normal fresnel equation.
albedo is a fixed4, determined further up in the code.
refl is the reflection map, as handed over by the mirrorreflection
half fresnel = 1.0 - saturate(dot (normalize(IN.viewDir), o.Normal));
o.Albedo = albedo+(refl*(pow (fresnel, _FresnelPower)))
But the result I end up with, is the same as you can see on the webplayer here:
(Dont note the project name, this is just another test scene i dumped in a test project i once named Occlusion culling ;p )
http://annihlator.nl/RainTest/Web/Web.html
if I understand correct, fresnel is supposed to be calculated from your viewing angle to the surfaces angle… why does it not seem to be happening here? when i turn in some directions (as in, North East South West), it’s as if the fresnel completely does not excist.
It’s most clearly seen when you’re standing on the darkest surface (rock) and face the opposing (concrete), in that direction i don’t witness ANY fresnel. when standing exactly the other way around… the fresnel seems way too active (to me, but this may be a matter of tweaking afterwards)
Its almost like the angle calculation is… rotated?
does anyone have a pointer?
PS: the shader employs Shader Model 3.0 and is highly unoptimized and thus may turn out to be very slow or even incompatible with some systems! (optimisation comes after this technical tidbit’s finished
)
PPS: yes, i know the textures have minor seams.
PPPS: also windows clients available, check: www.annihlator.nl/RainTest