PDA

View Full Version : Weird Terrain Depth Issue with new OpenGL Versions



KnightMareWolff
07-05-2016, 07:52 PM
Hi!

Im having a weird rendering problem with my Objects , mainly with my terrain object, that seems to be a depth problem.
This issue starts when i update my GPU drivers to OpenGL versions greater than 4.3.

I put in youtube a little video showing the issue for better understanding! ;)

https://www.youtube.com/watch?v=WzRqtr_fEOI&feature=youtu.be

This is the history of the problem:

01 - I start use a AMD R9 280X to develop my 3D aplication with the original driver that come with the GPU(Version 4.3)
Everyting was being rendered ok, including my terrain object.
02 - When i first update my GPU AMD drivers(4.4 and after 4.5) , a issue with the depth happen.
03 - I send the problem to AMD check it out if its not a problem with the driver, and they answer to me becouse is the same program it seems a problem with the driver and they will check it out...
04 - I install the original driver again and still developing the solution.
05 - I buy a new GPU but now a NVIDIA GTX 960.
06 - After a clean clean installation of the new GPU (With the card and AMD drivers completely removed) , i test the same program and the same issue happen!

So, looking at the history of the problem, it seems something removed in the new versions of OpenGL , and now i need take a path to solve it...

I see in the Redbook something related to OIT , that make possible be implemented in the fragment shader as a depth test to render the pixels, but i need to know if there is another solution with less work to do than re-implement something that the driver do in the past just with an enable command! ;)

Anyone have an idea of the best choices to solve the problem showed in the video?

PS:. I not put any code here yet, becouse in fact acctually im only using the default depth configuration enabling it and refreshing at every frame using the Clear and enable funcions.

Any help will be much appreciated!

Kind Regards.

KnightMareWolff
07-06-2016, 12:31 PM
Hi!

Finally i find out the root cause of the problem.

Basically when im rendering all the frames i enable/disable the buffers like this:


//Enable States
pGL->glEnable (GL_DEPTH_TEST );
pGL->glEnable (GL_BLEND );
pGL->glEnable (GL_CULL_FACE );
pGL->glEnable (GL_TEXTURE_2D );
pGL->glClear ( GL_COLOR_BUFFER_BIT |
GL_DEPTH_BUFFER_BIT |
GL_ACCUM_BUFFER_BIT |
GL_STENCIL_BUFFER_BIT);

pGL->glPolygonMode(GL_FRONT,GL_FILL );
pGL->glCullFace (GL_BACK );
pGL->glDepthFunc (GL_LESS );
//pGL->glDepthMask (GL_TRUE );


//Disable States
pGL->glDisable (GL_DEPTH_TEST );
pGL->glDisable (GL_CULL_FACE );
pGL->glDisable (GL_TEXTURE_2D );
pGL->glDisable (GL_BLEND );
//pGL->glDepthMask (GL_FALSE );

When i disable the call of glDepthMask , the problem stop, and the things start to work again.
In fact debbuging the code, since now all the rendering commands and states are assinchronous and im not using Sync objects, before the terrain rendering finish...the Depth Buffer was disabled...

So...the solution of the problem was find, but yet i have a doubt why the version 4.3 works and the other versions not, i will check it out my version pointers.

Anyway, please consider this issue solved , and the problem was in my own code.

Kind Regards.