View Full Version : How to animate a water texture?
Michael Hartlef
23-10-2008, 10:59
Hi Petr,
I would like to here your oppinion about this. I need a water surface, basically reassembling the ocean. To animate the water, I was thinking about either using texture switching or UV animating. Which way would you go? The water plane will be a big one. In my oppinion I will need to use a repeating texture but then, I also have to animate the UV positions so it will be a smooth animation.
Michael
Petr Schreiber
23-10-2008, 16:17
Hi Mike,
problem with repeating texture is that it is more and more evident when the surface reaches the horizont ( in case of big water surfaces like sea, lake ... ).
Environmental mapping occured to me as well, but I am not sure - it could result in "mercury"/"quick silver" effect. So maybe two layers? One environmental + one with some extra detail texture?
If you remember the demo with green island and shotting rockets at balloon ... there I used just 2 planes with the same texture, combined to final look via blending. The demo used rotation of planes to achieve the effect, you could use the UV shift ( as you proposed ).
Less drastical than blending could be using multitexturing ( just 2 units, single quad ).
One texture/one surface will always look like "wavy carpet".
I am in school now, I will get home around 20:00, will try to make some tests then :)
Last option is to go shader, and use goniometric functions in vertex shader + one variable bound to one from script to shift the phase. But by having "shader only" water you restrict the target PCs to newer ones.
Petr
Petr Schreiber
24-10-2008, 15:14
Mike,
from which perspective do you plan to watch the water surface - from top or from arbitrary angle?
Petr
Michael Hartlef
24-10-2008, 15:21
I would say that this will be variable. From allmost top to allmost flat over the surface.
Age of Sails has the same kind of camera and they just use an animated texture. Imho it looks good. I think that the cameraXZ position is stationary and the plane for the water surface too. I also think they just do texture animation and just change the position of the ships when you move the camera. It's all relative I think :D
I will try to do it this way. So when you have a nice big water plane, it will still look like it is endless.
Petr Schreiber
24-10-2008, 15:54
Hi Mike,
here is my dummy attempt.
I have some problems with ThinAir even with Scintilla now, sometimes CTRL-S makes it GPF which makes me a bit nervous.
90% of effect is good texture here :)
Petr
Michael Hartlef
24-10-2008, 18:33
Hi Petr! GEIL!!! Looks great when the cam moves. Can I use it for my tries? Where did you got the texture from?
I have some problems with ThinAir even with Scintilla now, sometimes CTRL-S makes it GPF which makes me a bit nervous.
Yip same here. VERY difficult to work with it lately. I'm looking into a temp replacement for now.
Petr Schreiber
24-10-2008, 19:05
Hi Mike!,
sure you can use it :)
I took the texture from here: click (http://www.filterforge.com/filters/4141.html)
I had this link in orignal code, then I went into problems so forgot to update it.
It does not look bad, but there is inevitably some tiling, see the screenshot below.
Petr
P.S. I will post temp workaround in 1.7.0.0 secret preview forum to not scare users of current official and reliable release.
Michael Hartlef
24-10-2008, 19:47
Petr,
when I comment the line
u+=ushift
I would expect a different UV-Animation but it doesn't change anything. Is that parameter working in tbgl_m15SetVertexTexXY?
Michael Hartlef
24-10-2008, 19:48
Forget it. I'm so stupid. ::)