Jump to content
  • Advertisement
Sign in to follow this  
thefrost

OGL Water Flicker Problem

This topic is 2999 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.

http://www.mediafire.com/?0ji44emdx2g

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
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

// bind the shader
WaterShader->enable();

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

// bind the normal-map
WaterNormalMap->enable(1);
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"
glBegin(GL_QUADS);

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

glEnd();

// disable the water reflection FBO and normal-map
WaterFBO->disable(0);
WaterNormalMap->disable(1);

// disable the shader
WaterShader->disable();

// disable blending
glDisable(GL_BLEND);

Share this post


Link to post
Share on other sites
Advertisement
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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!