Jump to content
  • Advertisement
Sign in to follow this  
Ermacc

OpenGL Weird OpenGl culling problem

This topic is 3218 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 everyone, and first of all, happy holidays!:) I was puzzled by a certain problem in my game engine recently and decided to ask for help. I'm trying to do some basic water(plane with transparent water texture on), and parts of some objects are not rendered "underwater".(or above the water if viewed from below) To illustrate i have a couple of screenshots: http://img163.imageshack.us/i/water1p.jpg/ http://img85.imageshack.us/i/water2a.jpg/ As you can see the rocks and the trees are rendered ok, but the units are cut off at the water plane. Now the reason for this is probably that the map(rocks, trees, water, etc) is a single 3ds model, and the units are separate models. I'm using a 3ds loader i found on the web, but i checked it and i don't think it has some weird culling implemented in itself.. So maybe this is some default OpenGl culling at work, which can somehow be disabled? Any ideas, on what could be the problem? Edit: Sorry, i think i've posted this in the wrong forum. I guess this belongs in the opengl one... If someone can move this, thanks in advance!

Share this post


Link to post
Share on other sites
Advertisement
Moving to OpenGL.

As for the problem, looks just like the depth buffer is doing its job. If you draw the water surface and write it's depth information to the depth buffer, then the units will correctly be clipped at the water surface, since they are then behind it.

Draw the water surface last instead. You need to to that to handle transparency correct.

Share this post


Link to post
Share on other sites
Try drawing your units first, and the map after. Your problem is depth-culling, which will make sure nothing is drawn on top of geometry that is in front of it. Even if the water is partly transparent, it will completely cull objects behind it that are drawn after it, since depth-testing doesn't know about transparency. If you draw your other models first, then this won't be a problem, as the water will just be drawn on top, and no culling be performed.

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!