Jump to content
  • Advertisement
Sign in to follow this  

OGL Water Flicker Problem

This topic is 3086 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello! I am having a strange issue with my water implementation. When the camera moves the water "jitters". I have recorded this phenomenon in a high-quality video to best illustrate the issue.


I apologize, the video is ~50mb. It needed to be high enough quality to show whats happening.

The water is rendered as a large quad extending from (0, 5, 0) to (128, 5, 128). I have also tried rendering the water as 1x1 quads tiled from (0, 5, 0) to (128, 5, 128) but it produces the same result. It uses a GLSL shader to apply the bump-mapping, reflection, and Fresnel effects.

I have encountered issues EXACTLY the same as this, but they where solved by rendering many smaller quads rather than one super-quad. I have tried this but it did not fix it =(

Anyone know what could cause this? Thanks beforehand!

// Enable blending

// bind the shader

// bind the reflection frame-buffer
WaterShader->uniformTexture("waterReflection", 0);

// bind the normal-map
WaterShader->uniformTexture("waterNormalMap", 1);

// bind various variables
WaterShader->uniform("windowWidth", screenSize.x);
WaterShader->uniform("windowHeight", screenSize.y);
WaterShader->uniform("tile", 10.0f);
WaterShader->uniform("noiseFactor", 0.1f);
WaterShader->uniform("time", Timer::getInstance().getElapsedTime());
WaterShader->uniform("waterShininess", 50.0f);

// use the quad-tree to render as 1x1 quads (same result, but slower)
//RootNode->renderWater(true, WaterHeight);

// width, height, and waterLevel (defined elsewhere in my code)
f32 w = 128.0f;
f32 h = 128.0f;
f32 WaterHeight = 5.0f;

// render one "super-quad"

glVertex3f(0.0f, WaterHeight, 0.0f);
glVertex3f(w, WaterHeight, 0.0f);
glVertex3f(w, WaterHeight, h);
glVertex3f(0.0f, WaterHeight, h);


// disable the water reflection FBO and normal-map

// disable the shader

// disable blending

Share this post

Link to post
Share on other sites
looks like a z-fighting problem.

What is the distance to the camera?
What are your near and far plane settings?

Share this post

Link to post
Share on other sites
Thank you for the reply!

Its always something dumb and simple! After reading your post I changed my zNear from 0.0001f to 1.0f (no idea why it was that way anyways =/) and it solved my problem.

Thank you!

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!