Water Shader Textures

Started by AGP, January 09, 2011, 09:13:08 PM

Previous topic - Next topic

AGP

I'm trying to play with the wiki's NormalMap shader. I have a water plane. The example adds two textures, "stones" and "normals" to the TextureManager. Seeing as how I don't know what the textures look like, or what mine should (I would like the water plane's vertices to distort up and down such that it looks remotely like water) I don't know what textures to load. Any help is appreciated.

EgonOlsen

It's a standard texture map and a normal map. The resources for the advanced example contain such a combination. You can find plenty of other examples on the net as well. But keep in mind that when using shaders, you'll loose all fixed function support, i.e. lighting, shadow mapping, projective texturing, fogging...all won't work unless you reproduce the required calculations in your shaders.

AGP

Fortunately, the ReflectionHelper has been failing me anyway, so I've nothing to lose. :p Anyway, am I supposed to lose the texture as well (because I have been)?

EgonOlsen

You get all you do in the shader, everything else is lost. The example shaders in the wiki of course do texturing, or otherwise, it wouldn't make much sense. Also keep in mind that some hatdware/drivers simply fail with shaders...like some Intel chips.

EgonOlsen

Btw: What went wrong with the ReflectionHelper? Its supposed to work even on the lowest chips like crap from Intel and a Geforce2 MX...i've tested both.

AGP

The program hangs. I've waited for as much as 20 minutes.

AGP

#6
About the shader, I noticed it strips the sphere. Is that necessary (I'm trying to determine why my plane is losing its texture)?

EDIT: Anyhow, removing strip() didn't solve the texture disappearance problem. And yes, I'm setting the right texture in the shader.

EDIT2: Got the texture back by removing compile()! Is that necessary (other than to speed it up)?

AGP

So now that I got my texture, how do I animate this thing? Do I have to keep replacing the normal texture (and is that the best way to achieve movement)?

EgonOlsen

Removing compile()-call will disable shader support. You can't use shaders on uncompiled objects. If your texture doesn't appear when compiling it, you are doing something wrong with the shader or shaders aren't supported by your hardware/driver (some Intel OpenGL drivers don't support GLSL shaders even if the hardware should be able to handle them). You should get some information in the log if that happens. Maybe you can post the log when using compile and shaders?

EgonOlsen

About the hang with the ReflectionHelper: Seems to be a threading issue in your code. You have to be careful of what you do in which thread when using the AWLGLCanvas, or you'll make one thread wait for the drawing thread which is blocked...which results in an infinite wait. If you can create a simple test case, i can have a closer look.

AGP

It can't be a threading issue since there's a total of two lines referencing it, and the game loop is where render() draw() and display() are called. And even a GeForce 9800 is producing the message "shadow-mapping is not supported." In my opinion, based on these two facts alone (not a threading thing and the GeForce 9800 message) there's something wrong with both ShadowHelper and the ReflectionHelper.

EgonOlsen

Nope, it's not. I have thousands of screen shots from different machines from all over world provided by the Robombs feedback function that show nice shadows. The only plattforms that have trouble doing it correctly are some SiS "gpus" and some linux drivers that go crazy on the shadows. Apart from that, everything works fine.
If shadow mapping doesn't work on a GeForce 9800, check your drivers. Maybe you are using the stock Windows drivers or some other obscure one (which OS btw?).
As said, a log output might help.

And it may very well be a threading issue of some kind, because the AWTGLRenderer has to do it's own threading stuff in the background which might interfere with whatever you are doing. Without a test case, i can't do anything...

EgonOlsen

Quote from: AGP on January 10, 2011, 07:19:15 PM
EDIT: Anyhow, removing strip() didn't solve the texture disappearance problem. And yes, I'm setting the right texture in the shader.
Remember that the shader needs a light source to work with. Without one, everything will be black.

AGP

I'll see about a test case, but the output is nearly 10 thousand lines lomg.

AGP

Very interesting development: this shader works compiled and stripped, yours doesn't. http://forum.bonzaisoftware.com/viewthread.php?tid=10