Looking for suggestions for water shader.

Started by
6 comments, last by CycloCode 18 years, 12 months ago
Greetings. Ive been working recently on a water effect. I am to the point where i have a reflection map and refraction map for my water. Im looking for suggestion on how to use/blend them. i have two shots : here and here. and im using (HLSL) :

float3 fReflect = tex2Dproj(sReflect, i.Uv).rgb;
float3 fRefract = tex2Dproj(sRefract, i.Uv).rgb;

float3 fColorWA = { 0.13f, 0.13f, 0.68f };
float3 fColorRR = lerp(fRefract, fReflect, 0.4f);

return float4(lerp(fColorRR, fColorWA, 0.3f), 1.0f);

I dont fell like its looking particulary good. Any tips/pointers on how i should use both "maps" would be appreciated. Im trying to get somekind of clear tropical water. Thanks you.
Advertisement
For this line:
"float3 fColorRR = lerp(fRefract, fReflect, 0.4f);"

I'd replace 0.4f with a Fresnel approximation equation, e.g. (1-cos(N dot V))^5
Thanks for the suggestion.

In the equation (1-cos(N dot V))^5
N stand for the normal vector, correct?
What does V stand for?

Sorry but im not very familiar with Fresnel approximation equation(s).

Normalised Eye->Surface vector, IIRC.

Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse

V stands for normalized vector to viewer...
Maciej Sawitus
my blog | my games
Quote:Original post by superpig
Normalised Eye->Surface vector, IIRC.

:) You were first.

Note, that although our explanations are different, they're both correct, because of cosinus nature.
Maciej Sawitus
my blog | my games
Yes as they said using a proper Fresnel aprox can grealy improve the look.

I would suggest the use of a normal map for additional wave detail. It can greatly improve the look of the wave without too much cost.
Thanks everyone, im going to try this out :)

This topic is closed to new replies.

Advertisement